1. using jQuery I have this.
$(document).ready(function(){
$('#stoptest').click(function () {
$("#ytplayer").stopVideo();
});
}); My iframe code is this:
<iframe id="ytplayer" class="youtubeVideo" src="http://www.youtube.com/embed/nZb0fpttZXQ?wmode=transparent&version=3&enablejsapi=1" style="width:500px; height:300px; z-index:2000" frameborder="0" allowfullscreen="true">
</iframe> But when I try to add a simple link to page to stop the player and try calling stopVideo() it is not stopping. Ultimately I would change the #stoptest to elements on the page that want to top the video, but currently it is having issues calling stop video. I have tried to see anything in Firebug but nothing seems to be firing and I get no errors. It is like the function is just not being called. Any ideas>
------------------------------------------------------------------------------------------------
On Tuesday, April 12, 2011 12:04:20 PM UTC-6, Jeffrey Posnick wrote:
Hello,
There's not that much additional work if you already are familiar
with JavaScript and are using the iframe embed method. There's some
tips on using the API when you have a pre-existing <iframe> tag
already on your page (as opposed to loading the iframe embed via the
API itself) at
http://code.google.com/apis/youtube/iframe_api_reference. html#Loading_a_video_player
You'd just want to call the pauseVideo() method on the player object.
There's no difference with regard to IE7 support between including
the <iframe> tag in your HTML and loading the iframe embed dynamically
via JavaScript.
Cheers,
-Jeff Posnick, YouTube API Team
~ YouTube is hiring! ~ http://google.com/jobs/workyoutube ~
On Apr 7, 4:53 pm, dreyefunk <eyv...@spectra.no> wrote:
> Hi
>
> I'm setting up a jquery slide show with option to use a youtube clip as a
> slide. When navigating to the next or previous slide from a slide containing
> i youtube clip (regular iframe embed), I've noticed that some browsers do
> not stop or pause playback. Both firefox and safari appears to handle this
> well by stopping the playback. But Opera and at least ie7, is continuing the
> playback in the background when navigating away from the youtube slide.
> (Haven't been able to test ie8 and ie9 yet)
>
> So my question is. Is there a simple way to ad a pause (or stop) event by
> javascript and still use the standard iframe embed, or do I have to do the
> full IFrame Player API?
>
> If I have to go full iframe API by letting a javascript generating the
> player - will this fix this issue in Explorer 7 also? (since ie 7 does not
> support postMessage)
>
> Another thing. I've noticed that firebug is reporting some 20 errors in the
> s.ytimg.com/yt/cssbin/www-embed-*****.css
> This is not a huge problem. I just wondered why.
>
> And.. is the iframe embed the best/only way to ensure correct playback on
> iphones, ipads and other mobile devices?
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/9G-5AJGIogcJ.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.
No comments:
Post a Comment