在 IE8 上的 pauseVideo() for youtube 视频,给出“对象不支持此属性或方法”

pauseVideo() on IE8 for youtube videos, gives "Object doesn't support this property or method"

本文关键字:不支持 对象 属性 方法 给出 pauseVideo 上的 IE8 视频 youtube for      更新时间:2023-09-26

当尝试在IE8上使用pauseVideo()拍摄youtube视频时,它给了我"对象不支持此属性或方法",

这是我的嵌入式视频:

<div class="ytLarge">
    <object width="400" height="300">
        <param value="http://www.youtube.com/v/Y4EZULqhP2E" name="movie">
        <param value="true" name="allowFullScreen">
        <param value="always" name="allowscriptaccess">
        <param value="transparent" name="wmode">
        <embed width="400" height="300" wmode="transparent" 
               allowfullscreen="true" allowscriptaccess="always" 
               type="application/x-shockwave-flash" 
               src="http://www.youtube.com/v/Y4EZULqhP2E&autoplay=1&version=3&enablejsapi=1">
    </object>
</div>
这是

召唤:

$('embed').each(function(index){
        $(this).get(0).pauseVideo();
});

代码在 Firefox 和 Chrome 中运行良好,但在 IE8 上的 $(this).get(0).pauseVideo() 行中给出了"对象不支持此属性或方法";

对于我提醒的标签<embed> IE 无法识别的内容,这就是为什么也使用标签<object>

<object>适用于IE(这就是您的脚本在IE中失败的原因)

<embed>适用于所有其他浏览器