日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

防盗链测试01 - Jwplayer+Tengine2.3.1 mp4模块打造流媒体测试服务器

發(fā)布時(shí)間:2025/4/16 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 防盗链测试01 - Jwplayer+Tengine2.3.1 mp4模块打造流媒体测试服务器 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

最近有個(gè)想法,想做類(lèi)似下面的視頻URL防盜驗(yàn)證;

1、URL Tag Validation2、Special format of URL for preventing unauthorized usage and access、 sampleOriginal: http://www.baidu.com/2016/0704/8025915_HD-60i_7198.mp4Using UTV:http://www.baidu.com/2016/0704/8025915_HD-60i_7198.mp4?px-time=1467685158&px-hash=a08a3c149514aae2aea14755a45a29c2px-time : current time or expire timepx-hash : hash(secret + url_path +expire_time) 

  

下面是我的想法,按照想法先搞一下;

?

1. 一個(gè)簡(jiǎn)單流媒體測(cè)試服務(wù)器。

2. 搞清楚頁(yè)面防盜鏈接所需要的知識(shí),比如打開(kāi)視頻鏈接繼而驗(yàn)證referer,還有添加校驗(yàn)的args等。

3. 優(yōu)化,添加功能。

4. 驗(yàn)證這些是否符合需求。

?

搭建流媒體使用tengine 新版自帶的mp4模塊

下載源碼:http://tenine.taobao.org/download.html

./configure --prefix=/web --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_v2_module --with-http_ssl_module --with-http_image_filter_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_mp4_module && make && make install

?

Nginx配置文件:

#### server {listen 80;server_name xxxxxx;access_log logs/vhost/xxxxxx_access.log main;#access_log "pipe:rollback logs/vhost/xxxxxx.access_log interval=1d baknum=7 maxsize=2G" main; location / {root xxxxxx;index index.html index.htm;mp4; #mp4配置,沒(méi)有做優(yōu)化}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html# error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}}

?

播放器選用Jwplayer

https://www.jwplayer.com? PS:注冊(cè)??勾選了開(kāi)發(fā)者就可以獲取JS鏈接;jdk等用來(lái)測(cè)試嗯嗯免費(fèi)^ ^。

?

?

編輯測(cè)試頁(yè)面:

index.html

<!DOCTYPE heml> <html><head><!-- 在這里替換自己的JW Player id --><script type="text/javascript" src="https://cdn.jwplayer.com/libraries/xxxx.js"></script><script type="text/javascript" src="getParam.js"></script><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /></head><body bgcolor="#000000"><div id="myElement">Loading the page...</div><script type="text/javascript">var file_name=getParam('id');console.log(file_name);jwplayer("myElement").setup({file: "http://x.x.x.x:8081/" + file_name,// image: "data/myposter.jpg",title: file_name,});</script></body> </html>

?

獲取文件getParam.js?

function getParam(paramName) {paramValue = "", isFound = !1;if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++;}return paramValue == "" && (paramValue = null), paramValue; }

?

流媒體測(cè)試服務(wù)器就基本搭建ok了,測(cè)試如下:

PS: 個(gè)人的VPS已升級(jí),流媒體測(cè)試防盜鏈學(xué)習(xí)將使用 referer+nginx 驗(yàn)證token來(lái)打造。token: md5(appId+appKey)? 敬請(qǐng)期待;

?

參考資料:

https://www.xiaohulu.com/video/user_detail?plat=201&roomid=61936357840

https://www.cnblogs.com/nopnog/p/7452405.html

https://www.cnblogs.com/vinyuan/p/3556218.html

https://leefige.github.io/2019/03/05/%E5%9F%BA%E4%BA%8ENginx%E9%85%8D%E7%BD%AEWeb%E8%A7%86%E9%A2%91%E6%B5%81%E5%AA%92%E4%BD%93%E6%9C%8D%E5%8A%A1%E5%99%A8/

?

轉(zhuǎn)載于:https://www.cnblogs.com/sean-yao/p/11448324.html

總結(jié)

以上是生活随笔為你收集整理的防盗链测试01 - Jwplayer+Tengine2.3.1 mp4模块打造流媒体测试服务器的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。