通过MediaElement.js检测youtube中的播放事件 [英] Detect play event in youtube wrapped via MediaElement.js
本文介绍了通过MediaElement.js检测youtube中的播放事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过 MediaElement.js :
<video id="v" width="640" height="360">
<source src="http://www.youtube.com/watch?v=nOEw9iiopwI" type="video/youtube" >
</video>
它可以正常播放。我想检测播放事件(假设加载了jQuery):
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?
我最终想做的是将youtube剪辑加载到画布。任何建议?
What I ultimately want to do is load the youtube clips into canvas. Any suggestion?
推荐答案
尝试直接访问视频
$('video').on('play', function() {
alert('playing');
);
这篇关于通过MediaElement.js检测youtube中的播放事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文