利用jwplayer的API实现播放定时弹出框效果
2015-04-10 19:44
483 查看
最近写的javaWeb涉及到了视频这块,用的是jwplayer,需要实现一个播放到某一进度视频自动暂停平且弹出一个框这样的功能。这需要找到一个类似于定时中断执行的函数可以实现不断的检测播放进度。在网上找了一下发现jwplayer的中文资料非常少,于是只好去翻官网提供的API。
最终还是找到了需要的API,以下是该函数的原文。
onTime(callback)
While the player is playing, this event is fired as the playback position gets updated. This may occur as frequently as 10 times per second. Event attributes:
duration (Number): Duration of the current item in seconds.
position (Number): Playback position in seconds.
Note that seeking for progressive downloads in Flash mode only works within the already downloaded portion. When seeking beyond that section, the video seeks to the last downloaded frame.
This issue is not present for HTML5, so should only be relevant for IE8.
说明:这个函数可以随着视频帧的更新而触发,时间间隔小于十分之一秒。
用法示例:
最终还是找到了需要的API,以下是该函数的原文。
onTime(callback)
While the player is playing, this event is fired as the playback position gets updated. This may occur as frequently as 10 times per second. Event attributes:
duration (Number): Duration of the current item in seconds.
position (Number): Playback position in seconds.
Note that seeking for progressive downloads in Flash mode only works within the already downloaded portion. When seeking beyond that section, the video seeks to the last downloaded frame.
This issue is not present for HTML5, so should only be relevant for IE8.
说明:这个函数可以随着视频帧的更新而触发,时间间隔小于十分之一秒。
用法示例:
var pausePoint=30;
jwplayer("player").onTime(function (){ if (jwplayer("myElement").getState() === "PLAYING" && jwplayer("myElement").getPosition()>pausePoint) { jwplayer("myElement").pause(true); alert("Hi!"); jwplayer("myElement").play(true); } });作用:在视频播放的第30秒暂停视频并且弹出框。
相关文章推荐
- 利用TitleWindow和VideoPlayer组件轻松实现视频弹出播放效果
- android定时定位 - 利用百度定位API来实现定时定位功能
- 调用AnimateWindow API来实现弹出效果
- 利用DecorView实现播放视频开灯/关灯效果和仿QQ消息提示框
- android定时定位 - 利用百度定位API来实现定时定位功能
- Android 利用TimerTask实现ImageView图片播放效果
- 利用Animatewindow API实现窗口动画效果
- IOS8下利用自动布局实现键盘的弹出效果
- 2.3、jwplayer实现类PPT课件播放效果
- Dom利用javascript实现模拟弹出对话框效果的代码,类似JQuery中的dialog!
- #Android笔记#利用第三方播放器vitamio实现悬浮播放效果
- IOS8下利用自动布局实现键盘的弹出效果
- 利用DecorView实现播放视频开灯/关灯效果和仿QQ消息提示框
- Android笔记#利用第三方播放器vitamio实现悬浮播放效果
- Android 利用TimerTask实现ImageView图片播放效果
- 2.2.4、用jwplayer实现youku可拖拽播放效果(nginx,yamdi)
- 使用jQuery实现页面定时弹出广告效果
- 利用Swing的Api实现镜面效果
- android定时定位 - 利用百度定位API来实现定时定位功能
- 利用JS实现简单的弹出窗品效果