jPlayer 2.9.2搜索/播放时间在Firefox中不起作用?

时间:2015-08-03 18:51:22

标签: position jplayer seek

这对我最近的firefox(桌面版,仅在osx上测试)不起作用:

$("#jpId").jPlayer("play", 42); // seek 42sec. not working
$("#jpId").jPlayer("play"); // works

它什么都不做。 test case here。 赞赏的想法。

编辑: 解决方法是

// load sound and start play without time, then again with time. odd. 
$("#jpId").jPlayer("play");
$("#jpId").jPlayer("play", 42);

1 个答案:

答案 0 :(得分:0)

  

<强>解

请改为尝试:

setTimeout(function(){ 
    $("#jpId").jPlayer("play", 42);
}, 100);
  

<强>原因

需要调用setTimeoout,因为根据play方法的文档:

  

如果在setMedia命令之后立即使用time参数发出,并且当浏览器使用HTML5解决方案时,此命令将最初失败并设置内部超时以重试每个命令100毫秒,直到成功。

  

<强>样本

请参阅this jsFiddle进行演示。