【问题标题】:Live stream playing直播播放
【发布时间】:2012-01-12 03:40:27
【问题描述】:

好吧,我可以捕获传入的流。它由 FFMpeg 制作。我正在使用的 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);

所以它产生了很好的文件,如果我重播它看起来不错。但我想在网站上播放它,如果我只是放一个指向 .flv 的链接,它会从头开始播放。如何让它真正活起来?提前谢谢。

【问题讨论】:

    标签: php stream ffmpeg live


    【解决方案1】:

    在这种情况下,您可以只添加流播放器/JW 播放器。此播放器可帮助您在服务器中显示视频文件,一旦它们被捕获。您可以自定义视频流并将其嵌入到网页中。此工具将为您带来live streaming

    【讨论】:

    • 你能给我一个使用这个播放器的例子吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-18
    • 2013-01-29
    • 2020-03-05
    相关资源
    最近更新 更多