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

1.3k Views Asked by At

when trying to use pauseVideo() on IE8 for youtube videos, it gives me "Object doesn't support this property or method",

here is my embedded video:

<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>

and here is the calling:

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

the code is working fine in firefox & chrome, but gives the "Object doesn't support this property or method" on IE8 in the line $(this).get(0).pauseVideo();

1

There are 1 best solutions below

1
On

For what i remind the tag <embed> isnt recognize by IE, that's why is used also the tag <object> so:

<object> is for IE (that's why your script fail in IE)

<embed> for all the other browsers