简体   繁体   English

现场直播

[英]Live stream playing

well, I can capture the incoming stream. 好吧,我可以捕获传入的流。 Its produced by FFMpeg. 它由FFMpeg生产。 The php code Im doing it with: 的PHP代码我这样做:

$address = '127.0.0.1';
$port = 1234;
$outfile = "output.flv";

$ofp = fopen($outfile, 'w');

 if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) { echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n"; sleep (5); die; }
 if (socket_bind($sock, $address, $port) === false) { echo "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; sleep (5); die; }
 if (socket_listen($sock, 5) === false) { echo "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; sleep (5); die; }
 if (($msgsock = socket_accept($sock)) === false) { echo "socket_accept() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; sleep (5); break; }
 do {
    $a = '';
    socket_recv ($msgsock, $a, 65536, MSG_WAITALL);
    fwrite ($ofp, $a);
    echo strlen($a);
 } while (true);

so it produces good file, if I replay this it looks good. 所以它产生了很好的文件,如果我重播它看起来很好。 But I want to stream it on a site, if I just put a link to the .flv, it would play it from the beginning. 但是我想将其流式传输到站点上,如果我只添加指向.flv的链接,它将从一开始就播放它。 How to make it real live? 如何使其真实地生活? Thanx in advance. 提前感谢。

In this case, you can just add the flow player/JW player. 在这种情况下,您可以仅添加流播放器/ JW播放器。 This player helps you to display the video files in the server, once they are captured. 捕获视频文件后,此播放器可帮助您在服务器中显示视频文件。 You can customize and embed the video streams into web pages. 您可以自定义视频流并将其嵌入到网页中。 This tool would bring you the live streaming . 该工具将带给您实时流媒体

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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