I took a look at your JavaScript, and all it's doing is inserting the
current time whenever the play event is fired. It will only do that
once per transition into the playing state, not continuously—is that
what you're confused about? If you want something that will
continuously update the current time of the video, you'll need to use
a setInterval() to periodically invoke you code (and you should only
have that interval active when the state is PLAYING).
Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev
On Feb 27, 2:36 pm, Bash Grep <bashg...@gmail.com> wrote:
> Here is an example:http://jsbin.com/avazaf
>
> Expected behavior:
> while the video is playing the current time stamp to the right should
> update.
>
> Actual behavior:
> current time stamp only gets updated a few times after clicking play/pause
> button.
>
>
>
>
>
>
>
> On Fri, Feb 24, 2012 at 4:52 PM, Jeffrey Posnick <je...@google.com> wrote:
> > Hello,
>
> > 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.
--
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