E企盈小程序营销工具技术服务商 热线:4006-838-530

小程序中插入腾讯视频

E企盈小程序直播系统

公司的一个业务中要用到将腾讯视频用到小程序上面,但是小程序中暂时不支持iframe标签,所以只能将腾讯视频的分享地址实时转换为真实播放地址放到video标签中,实现实时播放。    该教程的前提是你已经会用fiddler抓包工具,下面的具体的实现步骤: 1、找到https://h5vv.video.qq.com/getinfo?前缀的url,里面有视频真实地址需要的数据,简化后的url地址为GET https://h5vv.video.qq.com/getinfo?platform=11001&otype=json&guid=45011fffaa92f34af8272889c71c7f3da6&vids=c0540xi5va6&_qv_rmt=1R1Mhan3A11166G0h=1 HTTP/1.1Host: h5vv.video.qq.comConnection: keep-aliveAccept: */*Referer: https://v.qq.com/iframe/preview.html?vid=c0540xi5va6&width=500&height=375&auto=0Accept-Encoding: gzip, deflate, brAccept-Language: zh-CN,zh;q=0.9Cookie: RK=Lc0X9N36+2; tvfe_boss_uuid=b384a0d67bdfd3df; pac_uid=1_438479842; eas_sid=M1t4L9E5o9F4g6A0S6H4F2E5S8; LW_uid=M1u4P9n5E924h640C8G4V1N3f9; pgv_pvi=863570944; sd_userid=88291502963260646; sd_cookie_crttime=1502963260646; _ga=GA1.2.658568282.1512541689; LW_sid=M1o5n1V229q5g9z8d7T2E4B480; pgv_pvid_new=438479842_1022dd76273; luin=o0438479842; lskey=00010000daad7530dcca1f5f203cfb133172c65026a38f538d7905dc325587a247ea6bd5c22ccb71ac654faa; pt2gguin=o0438479842; ptcz=db51f6d03a841cd1e563f27f18381def1994a805d20a1ac51171eedbe0661037; main_login=qq; pgv_pvid=6968704130; o_cookie=我的cookiexxxcookie暂时不要,上面的url地址中替换掉vids就可以,其他数据不可缺,但是好像暂时可以是随便文字 从上面的地址中可以获取到以下内容,fvkey和vid、url是播放视频要用到的{“dltype”:1,”exem”:0,”fl”:{“cnt”:2,”fi”:[{“id”:100701,”name”:”msd”,”lmt”:0,”sb”:1,”cname”:”标清;(270P)”,”br”:14,”profile”:2,”drm”:0,”video”:1,”audio”:1,”fs”:5812571,”sl”:0},{“id”:2,”name”:”mp4″,”lmt”:0,”sb”:1,”cname”:”高清;(480P)”,”br”:39,”profile”:1,”drm”:0,”video”:1,”audio”:1,”fs”:7797164,”sl”:1}]},”hs”:0,”ip”:”59.42.210.78″,”ls”:0,”preview”:192,”s”:”o”,”sfl”:{“cnt”:0},”tm”:1517197684,”vl”:{“cnt”:1,”vi”:[{“br”:39,”ch”:0,”cl”:{“fc”:0,”keyid”:”c0540xi5va6.2″},”ct”:21600,”drm”:0,”dsb”:0,”fmd5″:”32117579b3e9cf0d962d8298c94e82e5″,”fn”:”c0540xi5va6.mp4″,”fs”:7797164,”fst”:5,”fvkey”:”31724216958118F86922A2411A256B13734A9DCA1C18108964E05B4B451EEEA620224E1045EC2984928DD1D3899BA4B12A3736477979F81D016F3C7E43A96C40DAE96FA0AEB26F79E92A4D124344F21C2A537E0DF13DD4ECE83682FE3CA1C7F1308EEAB000C1D3583D0F07E83C41A67286F8E8CCAB2FF714″,”head”:0,”hevc”:0,”iflag”:0,”level”:0,”lnk”:”c0540xi5va6″,”logo”:1,”mst”:8,”pl”:null,”share”:1,”sp”:0,”st”:2,”tail”:0,”td”:”192″,”ti”:”宾利添越搞V8 吉利出租车登录英国”,”type”:24,”ul”:{“ui”:[{“url”:”http://ugcsjy.qq.com/”,”vt”:176,”dtc”:0,”dt”:2},{“url”:”http://ugcdl.video.gtimg.com/”,”vt”:116,”dtc”:0,”dt”:2},{“url”:”http://183.56.149.29/om.tc.qq.com/AgtVkLCF22aOFPeG9NcgOnBXcDuA_v2DQ-Tqd-RBMhTw/”,”vt”:219,”dtc”:0,”dt”:2},{“url”:”http://video.dispatch.tc.qq.com/”,”vt”:0,”dtc”:0,”dt”:2}]},”vh”:480,”vid”:”c0540xi5va6″,”videotype”:29,”vr”:0,”vst”:2,”vw”:848,”wh”:1.7666667,”wl”:{“wi”:[]}}]}} 2、拼接视频播放的正式地址http://ugcdl.video.gtimg.com/c0540xi5va6.mp4?vkey=9B7C15609A430DAD73B865DBD1F0B987C384E45D2FB7A5A8AEDBFFA25F90A669B95AB4A86EE4419222997950DA39FCF427062E125EB3FC15332A985CD6DDEE565CA0510F22A1FB12EA6444E544D244209832BB8DC3FEEE6FD5CB37602764BD1689CF724271C055CFF9D4EF4384CD11FB957E5F3AB4DB9C51&br=39&platform=2&fmt=auto&level=0&sdtfrom=v5010&guid=450fffaa92f34af8272889c71c7f3da6暂时把上面的vkey和修改为上面的就好【通过测试发现每个视频要用自己的vkey和vid,不能共用】 3、获取到真实地址后,可以给一个接口,该接口实现了302跳转小程序端插入视频代码:<video src=”http://你的域名/news/tencent/video/redirect?url=http://v.qq.com/iframe/player.html?vid=t0025rmg9nn&tiny=0&auto=0″ controls=”controls”>上面的url=xxx后面是腾讯分享iframe中的urlPS:在 video 中添加腾讯视频是无广告的小程序

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 小程序中插入腾讯视频
分享到: 更多 (0)
E企盈小程序直播营销卖货系统

评论 抢沙发

E企盈小程序开发

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏