Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 单击jwplayer的带有成绩单的事件_Javascript_Jquery_Video_Click_Jwplayer - Fatal编程技术网

Javascript 单击jwplayer的带有成绩单的事件

Javascript 单击jwplayer的带有成绩单的事件,javascript,jquery,video,click,jwplayer,Javascript,Jquery,Video,Click,Jwplayer,这只是家庭作业的一小部分,但我现在陷入困境,不知道该做什么。整个项目是创建JWplayer,将视频与成绩单匹配,突出显示成绩单中与视频同步的短语,并能够单击短语并让视频跳转到它。我被最后一部分卡住了 $.fn.playerConnect = function(player){ var transcriptElements = this; player.onTime(function(evt){ return this.click(function(evt){

这只是家庭作业的一小部分,但我现在陷入困境,不知道该做什么。整个项目是创建JWplayer,将视频与成绩单匹配,突出显示成绩单中与视频同步的短语,并能够单击短语并让视频跳转到它。我被最后一部分卡住了

$.fn.playerConnect = function(player){


    var transcriptElements = this;

    player.onTime(function(evt){



    return this.click(function(evt){ // where the action happens
    var i = 0;
    var startTime = parseFloat($(transcriptElements[i]).attr("data-start"));
             player.seek(startTime);

   });
};

})(jQuery);
这是项目的Html部分。如您所知,这些短语分为span。所以基本上,伪代码是

对于click事件,返回数据开始的值, 在视频中查找值(player.seek)

视频将出现在此处
嘿,这是
德韦恩·约翰逊。在电影《星球》中扮演宇航员查克·贝克时
我得到了很多
尊重我们国家的太空计划。美国宇航局对我们的宇宙有了新的发现
每天只有一天
美国航天局最酷的事情之一是它为人类创造的技术
探索太空是
也改善了地球上的生活。美国宇航局的技术可以找到
到处
从鞋底
把鞋子放在你谷类食品中的冻干水果上。这些技术被称为
附带产品,帮助
医生治愈心脏病患者科学家追踪罕见病例
动物,还有消防员
警察和士兵在工作中保持安全。空间技术甚至起到了帮助作用
奥运游泳运动员赢得金牌
奖牌。全部的
在这些衍生产品中,最初是美国宇航局(nasa)太空任务的创新
航天飞机、哈勃太空望远镜和国际空间站
车站。你
不必成为宇航员就可以追溯到你居住的地方。访问nasa.gov了解更多关于
nasa技术如何在你的生活中发挥作用。毕竟,没有比这更大的空间了
家

不管我点击哪个跨度,视频只会将我返回到10秒。请帮忙

这是一个可以用作模板的演示-

 <div id="playerDiv">Video Will Appear Here</div>
  <div id="transcript"> <span class="words" data-start="10.099" data-dur="7"></span>
    <span class="words" data-start="17.869" data-dur="3.82">Hey this is
      Dwayne Johnson. While playing astronaut Chuck Baker in the film Planet</span>
    <span class="words" data-start="21.689" data-dur="0.701">51</span> <span
      class="words" data-start="22.39" data-dur="3.56">I gained a lot of
      respect for our nation's space program. NASA makes new</span> <span class="words"
      data-start="25.95" data-dur="1.35">discoveries about our universe</span>
    <span class="words" data-start="27.3" data-dur="4.11">every day but one
      of the coolest things about nasa is the technologies that</span> <span
      class="words" data-start="31.41" data-dur="1.55">it creates for
      exploring space</span> <span class="words" data-start="32.96" data-dur="3.739">are
      also improving life here on earth. NASA technologies can be found</span>
    <span class="words" data-start="36.699" data-dur="0.621">everywhere</span>
    <span class="words" data-start="37.32" data-dur="3.71">from the soles of
      the shoes to the freeze dried fruit in your cereal. These</span> <span
      class="words" data-start="41.03" data-dur="1.58">technologies, called
      spinoffs,</span> <span class="words" data-start="42.61" data-dur="4.36">help
      doctors heal patients with heart problems, scientists track rare
      animals, and</span> <span class="words" data-start="46.97" data-dur="2.409">firefighters
      and police officers and soldiers</span> <span class="words" data-start="49.379"
      data-dur="4.45">stay safe on the job. Space technology has even helped
      Olympic swimmers win</span> <span class="words" data-start="53.829" data-dur="0.711">gold
      medals.</span> <span class="words" data-start="54.54" data-dur="3.63">All
      of these the spinoffs began as innovations for nasa missions</span> <span
      class="words" data-start="58.17" data-dur="3.86">like the space
      shuttle, the Hubble Space Telescope, and the International Space</span>
    <span class="words" data-start="62.03" data-dur="3.18">Station. You
      don't have to be an astronaut to trace</span> <span class="words" data-start="65.21"
      data-dur="3.47">space back to where you live. Visit nasa.gov</span> <span
      class="words" data-start="68.68" data-dur="3.549">to learn more about
      how nasa technologies play a role in your life.</span> <span class="words"
      data-start="72.229" data-dur="3.331">After all, there's no space like
      home</span> </div>
</div>