ckplayer通过Mod-H264支持随意拖动功能

ckplayer是一个国产网页播放器,可以支持在线播放FLV和MP4视频。

这个播放器类似于国外的JWplayer和FLOWplayer,可以通过官方提供的API接口进行定制。

ckplayer官网提供了一种基于IIS6的使用Mod-H264方法,在这里提供基于IIS7及以上版本的方法。

英文原文如下:

By default, IIS 7.0 is not installed on Windows Vista. You can install IIS by clicking Windows Features in Advanced Options under Programs in Control Panel.

When running Windows 32 bit:

  • Create an App_Code folder, if you don't already have one, in c:\inetpub\wwwroot.
  • Copy the Mod-H264-Streaming module (mod_h264_streaming.dll) into this directory (c:\inetpub\wwwroot\app_code).

When running Windows 64 bit:

我使用的是windows server 2008 r2 x64系统,因此要在IIS的应用程序池的高级选项中将启用32位程序改为True。

Open up IIS Manager.

  • Select 'MIME types'.
  • Select 'Add'.
  • Set 'File name extension' to '.mp4' and 'MIME type' to 'video/mp4'.
  • Click 'OK'.

在MIME类型中添加MP4类型,这里要注意MP4不是使用video/mpeg而是video/mp4,这样才能成功映射到ModH264Streaming模块上。

  • Select 'Modules'.
  • Select 'Configure Native Modules'.
  • Select 'Register'.
  • Set 'Name' to 'ModH264Streaming'.
  • Set 'Path' to the path where the mod_h264_streaming.dll is located.
  • Click 'OK'.
  • Click 'OK' again.

在模块中注册mod_h264_streaming.dll模块。

  • Select Handler Mappings.
  • Select 'Add Module Mapping'.
  • Set 'Request Path' to '*.mp4'.
  • Set 'Module' to 'ModH264Streaming'.
  • Set 'Name' to 'ModH264Streaming'.
  • Click 'Request Restrictions'.
  • Set 'Mappings' to 'Invoke handler only if request is mapped to file'.
  • Set 'Verbs' to 'All verbs'.
  • Set 'Access' to 'Scripts'. (Note to self: verify why this was previously 'Execute').
  • Click 'OK'.
  • Click 'OK' again.

处理程序映射中添加ModH264Streaming,之前网站上写的是提供执行的访问权限,但是在页面调用中是通过javascript脚本调用的,因此用脚本的访问权限,后来官网上也修正了这个错误。

下面给出一段调用代码:

<html>
<head>
<script type="text/javascript" src="http://10.1.50.183:9000/jwplayer/jwplayer.js"></script>
</head>
<body>
<br/><br/><br/><br/><br/>

<div id="a1"></div>
<script type="text/javascript" src="http://192.168.1.21:9000/ckplayer/ckplayer.js" charset="utf-8"></script>
<script type="text/javascript">
    var flashvars={
        f:'http://192.168.1.21:9000/video/01.mp4',
        c:'0',
                h:'4',
                q:'start'
        };
    CKobject.embedSWF('http://192.168.1.21:9000/ckplayer/ckplayer.swf','a1','ckplayer_a1','878','503',flashvars); 

</script>
</body>
</html>

其中flashvars的h和q参数表示开启拖动,并且通过自动识别播放影片的后缀判断是通过关键帧还是关键时间点进行拖动。

 

 

posted @ 2013-10-01 22:25  cyano  阅读(7421)  评论(1编辑  收藏  举报