使用Flowplayer从Apache流式传输MP4文件

3

我在使用此功能时遇到了一些问题。根据http://flowplayer.org/forum/5/14664#post-14830,我认为我已经正确地完成了操作。视频剪辑开始播放得很好,但是当我跳转到尚未加载的部分时,它只会返回到文件/视频的开头。

不幸的是,大多数情况下使用的浏览器是IE6 :(

Apache 2运行在Redhat上

我使用ffmpeg创建了一个mp4文件。运行qt-faststart 1.mp4 1.qt.mp4

安装mod_flvx.c

添加:

LoadModule flvx_module modules/mod_flvx.so
AddHandler flv-stream .flv

关于Apache httpd.conf的内容:

以示例页面为例:

<script type="text/javascript">
flowplayer("player", "flash/flowplayer-3.0.3.swf", {
  clip: {
    url: 'http://servername/player/media/1.qt.mp4',
    // default provider: 'h264streaming'
    provider: flashembed.isSupported([9, 115]) ? 'h264streaming' : 'lighttpd',
    scaling: 'fit',
    autoBuffering: true,
    autoplay: false,
    bufferLength: 3
  },
  log: {
    level: 'debug'
  },
  plugins: {
    h264streaming: {
      url: 'flash/flowplayer.h264streaming-3.0.5.swf'
    },
    controls: {
      url: 'flash/flowplayer.controls-3.0.3.swf',

      // which buttons are visible and which not ?
      play:false,
      fullscreen:true,

     // scrubber is a well known nickname to the timeline/playhead combination
      scrubber: true
    }
  }
});
</script>

有没有什么建议?

谢谢

1个回答

1

首先,您需要查看您的Apache是否配置正确,以便寻找视频的各个部分。您可以通过传递一个get参数,例如my_vide_path.mp4?start=10,让它从第10秒开始播放。如果它成功地从第10秒开始播放,则Apache已正确设置,您需要使Flowplayer正常工作。如果Apache没有正确设置,则即使是正确的Flowplayer配置也无法帮助。

我怀疑您的Apache没有正确设置。您告诉Apache处理.flv文件,但实际上您正在使用mp4文件。

我已经成功地使用http://h264.code-shop.com/trac/wiki中的Apache模块完成了这项工作。

您需要将该模块添加并加载到Apache中,并告诉Apache使用它来处理.mp4文件。

下一步是使用get参数?start=10进行测试,以查看它是否正确寻找。之后,您所需要做的就是:

<script type="text/javascript">
flowplayer("player", "flash/flowplayer-3.0.3.swf", {
  clip: {
    url: 'http://servername/player/media/1.qt.mp4',
    default provider: 'h264streaming'

  },
  plugins: {
    h264streaming: {
      url: 'flash/flowplayer.h264streaming-3.0.5.swf'
    }
  }
});
</script>

我使用了更新的flowplayer swf,而不是h264的swf,flowplayer plugin for psuedostreaming则适用于新版本的flowplayer,而显然h264的swf不适用。


谢谢,我已经安装了这个模块并使用wget进行了测试,跳过文件的前五分钟,它可以正常工作。然而我的播放器没有播放任何东西,在apache日志中也没有看到任何错误,访问日志中也没有看到mp4文件被访问,这只适用于flow player 3.0.3吗?当我在下面的代码中使用'default provider'而不仅仅是'provider'时,我遇到了错误: - Raoul
<script type="text/javascript"> flowplayer("player", "flash/flowplayer-3.2.6.swf", { clip: { url: 'http://servername/player/media/1.qt.mp4&#39;, provider: 'h264streaming', autoPlay: true }, plugins: { h264streaming: { url: 'flash/flowplayer.h264streaming-3.0.5.swf' } } }); </script> - Raoul
将h264streaming swf从flowplayer网站更改为psuedostreaming swf。我无法在最新版本的flowplayer中使h264streaming正常工作,但是使用来自flowplayer网站的psuedostreaming swf对我有效。 - tbonci

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接