Once stopVideo() is called the video won't be playable anymore. Is
that causing the behavior you're seeing? You don't have to include
that code that calls stopVideo() in your own app; it's just part of an
example.
Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev
On Feb 24, 8:29 am, bash grep <bashg...@gmail.com> wrote:
> I'm trying to use the iframe embed, because the chromeless as3 is
> broken in ie8, with the javascript api. Everythign works fine when I
> start and stop the video using my custom html controls via
> javascript. However, when I click the video directly it doesn't fires
> the onStateChange function a few times then it stops firing.
>
> var player;
> function onYouTubePlayerAPIReady() {
> player = new YT.Player('player', {
> height: '390',
> width: '640',
> videoId: 'u1zgFlCw8Aw',
> events: {
> 'onReady': onPlayerReady,
> 'onStateChange': onPlayerStateChange
> }
> });
> }
>
> function onPlayerReady(event) {
> event.target.playVideo();
> }
>
> var done = false;
> function onPlayerStateChange(event) {
> if (event.data == YT.PlayerState.PLAYING && !done) {
> setTimeout(stopVideo, 6000);
> done = true;
> }
> }
>
> This works if you click on the controls to start the video, but if you
> click on the video screen/image to start the video then this won't
> work (code from the examples page:http://code.google.com/apis/youtube/iframe_api_reference.html)
--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
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