Detect play event in youtube wrapped via MediaElement.js

Deadly 提交于 2019-12-08 13:27:17

问题


I wrapped a youtube video into video tag via MediaElement.js:

<video id="v" width="640" height="360">
    <source src="http://www.youtube.com/watch?v=nOEw9iiopwI" type="video/youtube" >
</video>

It can be played correctly. I want to detect the play event (assume jQuery loaded):

$("#v").on('play', function() {
  console.log('play event entered');
  // do something more here
});

});

It seems the event can't be detected correctly. Is it because of the cross-origin issue? If so, theoretically I can build a proxy server for videos and then detect it correctly?

What I ultimately want to do is load the youtube clips into canvas. Any suggestion?


回答1:


Try accessing 'video' directly

$('video').on('play', function() {
     alert('playing');
 );


来源:https://stackoverflow.com/questions/14166857/detect-play-event-in-youtube-wrapped-via-mediaelement-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!