Pra*_*gar 5 python video video-streaming html5-video telethon
我正在尝试流式传输 Telegram 视频文件并在网页上播放它们。
我正在使用此脚本将 Telegram 视频流式传输到 Web 服务器。它使用Telethon和AIOhttp来流式传输文件。流媒体部分可以在这里看到。
我目前在服务器上提供它来提供媒体文件。可以使用脚本提供的链接下载视频,并可以在任何媒体播放器上流式传输。但是当我尝试在网页上流式传输它们时,它有问题。
对于 mp4 视频,Chrome 不会播放,而 Firefox 会播放。例子
这是我在Chrome中打开上述脚本时脚本的DEBUG日志
INFO:tl.web_routes:Serving file in 723 (chat 550559022) to ::1
DEBUG:tl.paralleltransfer:Starting parallel download: chunks 0-663 of 663 InputDocumentFileLocation(id=4981324115240550559, access_hash=7389576518823114674, file_reference=b'\x01\x00\x00\x02\xd3^*\xe3\xe5\xca;oLS\xe7k\xe1i\xae\xf0\xaf#Z_\xd5', thumb_size='')
INFO:tl.paralleltransfer.dc1.conn1:Connecting...
INFO:telethon.network.mtprotosender:Connecting to 149.154.175.51:443/TcpFull...
INFO:telethon.network.mtprotosender:Connection to 149.154.175.51:443/TcpFull complete!
INFO:tl.paralleltransfer.dc1:Exporting auth to DC 1 (main client is in 5)
INFO:aiohttp.access:::1 [24/Jan/2020:12:32:40 +0000] "GET /favicon.ico HTTP/1.1" 404 172 "http://localhost:8080/watch/12423247656120/Little.America.S01E03.WEB-DL.x264-ION10.mp4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
DEBUG:tl.paralleltransfer.dc1.conn1:Part 0/663 (total 663) downloaded
DEBUG:tl.paralleltransfer.dc1.conn1:Parallel download interrupted
INFO:tl.web_routes:Serving file in 723 (chat 550559022) to ::1
DEBUG:tl.paralleltransfer:Starting parallel download: chunks 659-663 of 663 InputDocumentFileLocation(id=4981324115240550559, access_hash=7389576518823114674, file_reference=b'\x01\x00\x00\x02\xd3^*\xe3\xec\xbb\xd2vinG\xa3Q\xb1\xf4\x033;\xa0$?', thumb_size='')
DEBUG:tl.paralleltransfer.dc1.conn1:Parallel download interrupted
Run Code Online (Sandbox Code Playgroud)
对于 mkv 视频,他们都没有播放。Firefox 显示错误matroska files can't be played
对于一两个 mp4 视频,我也让 Chrome 播放它们。例子
我在这里使用Fluidplayer,它使用的dash.js
可能与 mp4 文件不兼容。我曾尝试使用video
标记播放带有准系统 HTML 的视频,但效果不佳。
对于网页部分,我在包含所有 AIOhttp 服务器路由的web_routes文件中添加了一个路由。
如何在网页上播放视频?(我也尝试过使用 Flask 添加路由。所以,一侧是服务器,另一侧是播放网站)。