一直在研究.net 的視頻播放,最近做起了jwplayer,然后項目要求是視頻不能快進,但是可以重復觀看已經看過的視頻資源。
很簡單
在標簽<script>
中定義兩個變量
var maxPlayPosition = parseInt({KS:Field:historytime});
var seeking = false;
然后在代碼的適當位置放一段代碼
jwplayer().onTime(function(event)
{
if (!seeking)
{
maxPlayPosition = Math.max(event.position, maxPlayPosition);
}
})
.onPlaylistItem(function()
{
maxPlayPosition = 0.0;
}) // consider using only if you have playlists
.onSeek(function (event)
{
if (!seeking)
{
if (event.offset > maxPlayPosition)
{
seeking = true;
setTimeout(function ()
{
jwplayer().seek(maxPlayPosition);
}, 100);
}
}
else
{
seeking = false;
}
});
</script>
已經OK 了!!!