メインコンテンツ | メニュー

Main Contents

October 3, 2007

Playing YouTube videos continuously in your flash application

Although YouTube (Google Code) provides fantastic APIs for developing your own YouTube-based applications, somehow a very simple API does not exist: detecting the end of video event.


I don't even know if YouTube videos dispatches the end-of-video event at all, but according to the discussions in the forum, it seems that it does not exist anyway. I have struggled with this problem for about a month or so.


At this moment, duration information in the meta-data of a video is the only solution (let me know if there is another way):


1. List video IDs that you want to play continuously
2. Play the first video and set a Timer object with its duration
3. When the Timer object reaches the time, it dispatches the "timer" event
4. Then the timer event handler call the function that plays the next video
5. Repeat 2-4 until the end of the list

... it is just simple, however, it took a month for me to reach this conclusion. Because of the confidentiality of the project, I cannot distribute the code, but perhaps someday I might write a pseudo-code for this in a paper.

Now I can get on to the next step!!!! Well, I have to finish off a paper for CHI2008: interactivity, though.



Copyright © here.