简体   繁体   English

是否可以使用代理网址提供视频内容?

[英]Is it possible to serve video content using a proxied url?

Lets say we have a video that is available at http://www.example.com/video.mp4 假设我们有一个视频,可以在http://www.example.com/video.mp4上找到

Is it possible to embed this video using another name of link which will be untraceable ? 是否可以使用其他链接的名称来嵌入此视频,而该链接的名称是无法追踪的?

<video src ='http://www.proxyserver.com/video.mp4'/>

like Proxied link ? 喜欢代理链接?

To be Clear : I don't want to download the video. 明确说明:我不想下载视频。

It is possible, you should create a http server with node using the http librairie, and when you get a request on that server you just have to make the real request on http://www.example.com/video.mp4 using a request module with streaming support, then you can just res.pipe(videoStream) and it should work. 可能的是,您应该使用http librairie创建一个带有节点的http服务器,并且当在该服务器上收到请求时,您只需使用http://www.example.com/video.mp4进行真正的请求即可。请求模块具有流支持,那么您可以只使用res.pipe(videoStream) ,它应该可以工作。

Exemple (not tested but something like this should work of course you can use express/koa/etc instead of http) 示例(未经测试,但类似的东西应该可以工作,当然您可以使用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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM