【问题标题】:PHP fseek with remote videos or alternative带有远程视频或替代方案的 PHP fseek
【发布时间】:2016-11-03 23:47:36
【问题描述】:

我正在尝试制作可搜索的 mp4 视频

视频与 PHP 文件位于不同的服务器上

关于标题它发送所有正确的信息

但问题是 fseek 不支持远程视频

我尝试改用 stream_get_contents

     stream_get_contents($fp, $start);
     fseek($fp, $start);

它自己已经转换并准备流式传输的视频

知道怎么做吗?

谢谢

【问题讨论】:

    标签: php linux html video fseek


    【解决方案1】:

    为了从different offset 开始读取$fp 的内容,您应该使用函数的第三个参数:

    string stream_get_contents ( resource $handle [, int $maxlength = -1 [, int $offset = -1 ]] )
    

    在你的情况下:

    stream_get_contents($fp, -1, $start);
    

    (在您的原始代码中,您将第二个参数设置为 $start,这是错误的)。

    请记住,并非所有流媒体都支持偏移,因此它可能不起作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-17
      • 1970-01-01
      • 2011-05-31
      • 2018-12-10
      相关资源
      最近更新 更多