Tuesday, April 12, 2011

[YouTube-API] Re: Swapping YT videos via javascript timer

Hello,

I just downloaded your code and tried it in Chrome and Firefox 4, and
everything worked as expected—the video switched once the timer
reached 0. Which browsers were you seeing the failures with? Are there
any other steps needed to reproduce?

Cheers,
-Jeff Posnick, YouTube API Team
~ YouTube is hiring! ~ http://google.com/jobs/workyoutube ~


On Apr 4, 5:43 pm, Wolfkin <wolf...@gmail.com> wrote:
> css - jquery.countdown.csshttp://pastebin.com/EZAFZSFG
> js - jquery.countdown.jshttp://pastebin.com/hswM50zx
> html - index.htmlhttp://pastebin.com/G2XYT514
>
> My goal is to have a YT video switch on two conditions
> 1) if the page is loaded before the timer hits zero. When the timer reaches
> zero -switch-
> 2) if the page is loaded AFTER the timer hits zero then immediately -switch-
>
> var expire_date = '+10s'; // new Date(2011, 4-1, 4, 17, 13); // expiration
> time: new Date(Year, Month, Day, Hour, Min, Sec)
>
> This line (html) controls when the timer expires. Right now it's set to 10
> seconds from page load. At this setting everything works perfectly. If you
> change it to use the date variable instead then it works partially. As long
> as the date is in front of you it works. If the date has passed nothing
> happens to the video.
>
> I've tried this from every angle and I seem to have narrowed my problem down
> to the YT code I have. In the html if you switch some code around line 49:
>
> function change_video() {
>
> // ytid = next_vid;
>
> // player.cueVideoById(ytid);
>
> alert('We have lift off!');
>
> }
>
> If you comment out these lines of code then again everything works as fine..
> only the action is just an alert and not anything to do with the video. The
> alert bings when the timer hits zero. the alert bings if the timer has
> already passed. Everything works fine on my site <http://bit.ly/gEqd5k> unless
> someone reloads or arrives late. They're watching the old video until I get
> in there and manually update.
>
> Ref:http://keith-wood.name/countdown.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