启动和停止控制不工作youtube

时间:2016-12-22 08:38:43

标签: javascript jquery html youtube

我尝试在youtube视频中创建自定义启动和停止。它在参考小提琴中工作正常reference link

我在html文件中试过。它不能在html文件中工作,我已经在下面给出了我的代码

--Create temprary table with rownumber
with tmp0 as (
select f0.*, rownumber() over(partition by parentno order by componentno) rang, (select count(*) from jgrun.tmp1222 f1 where f1.parentno=f0.parentno) as nb   
from yourlib.yourtable f0
),

--Create temporary table recurse with componentno concatenante
tmp1 (parentno, componentno, listcomponentno, rang, nb, rgcal) as (
select parentno, componentno,  cast(tmp0.componentno  as varchar(500)), rang, nb, 1 from tmp0
union all
select tmp0.parentno,  tmp0.componentno,  cast(tmp0.componentno || ', ' || tmp1.listcomponentno as varchar(500)), tmp0.rang, tmp0.nb, tmp1.rgcal+1 
from tmp0 inner join tmp1 on tmp0.parentno=tmp1.parentno  and tmp1.rang-1=tmp0.rang
),
--Select last concatenation
tmp2 as (
select * from tmp1
where nb=rgcal
)
--Cross parent different and same list component no
select f1.parentno, f2.parentno, f1.listcomponentno
 from tmp2 f1 inner join tmp2 f2 on f1.parentno<>f2.parentno and f1.listcomponentno=f2.listcomponentno

1 个答案:

答案 0 :(得分:2)

听起来你的页面在脚本开始之前没有完成加载,

尝试剪切脚本标记并将其移动到正文的末尾(因此首先加载页面,然后加载脚本):

  <html>
  <head>


  </head>
  <body>
     <div id="whateverID" class="video-container"><iframe width="640" height="390" id="yt" frameborder="0" title="YouTube video player" type="text/html" src="http://www.youtube.com/embed/u1zgFlCw8Aw?enablejsapi=1"></iframe></div>
     <div  id="playButton" class="playVideo"><a href="javascript:void callPlayer(&quot;whateverID&quot;,&quot;playVideo&quot;)">Play button</a></div>
     <div class="close_icon" ><a href="javascript:void callPlayer(&quot;whateverID&quot;,&quot;pauseVideo&quot;)">Pause close</a></div>

<script>

 /*call player*/
function callPlayer(frame_id, func, args) {
    if (window.jQuery && frame_id instanceof jQuery) frame_id = frame_id.get(0).id;
    var iframe = document.getElementById(frame_id);
    if (iframe && iframe.tagName.toUpperCase() != 'IFRAME') {
        iframe = iframe.getElementsByTagName('iframe')[0];
    }
    if (iframe) {
        // Frame exists, 
        iframe.contentWindow.postMessage(JSON.stringify({
            "event": "command",
            "func": func,
            "args": args || [],
            "id": frame_id
        }), "*");
    }
}
</script>
  </body>
</html>