[英]Is it possible to serve video content using a proxied url?
假設我們有一個視頻,可以在http://www.example.com/video.mp4上找到
是否可以使用其他鏈接的名稱來嵌入此視頻,而該鏈接的名稱是無法追蹤的?
<video src ='http://www.proxyserver.com/video.mp4'/>
喜歡代理鏈接?
明確說明:我不想下載視頻。
可能的是,您應該使用http
librairie創建一個帶有節點的http服務器,並且當在該服務器上收到請求時,您只需使用http://www.example.com/video.mp4
進行真正的請求即可。請求模塊具有流支持,那么您可以只使用res.pipe(videoStream)
,它應該可以工作。
示例(未經測試,但類似的東西應該可以工作,當然您可以使用express / koa / etc代替http)
const http = require('http')
http.createServer(function (req, res) {
if (req.path === '/video.mp4') {
const stream = request.get('http://www.example.com/video.mp4')
res.end(stream)
}
}).listen(3000)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.