views:

76

answers:

1

I have made a kind of Video Slider, where thumbnail of videos are displaying in horizontal view , and when clicking on that video image, that video stats need to play.

I am making an AJAX call to retrieve the URL and data related to selected video, and putting the URL inside the <object> </object> code.

It's actually working, but the problem is I am having different types of video source ('youtube','vimeo' etc), and there is some delay in AJAX response and displaying of Video Object.

Any idea about How could I know that the Video object is loaded or not so that I can put a loading message for that time period.

+1  A: 

I'm not sure about vimeo, but the YouTube player has a javascript api, and when you enable it, the player will call a javascript function "onYouTubePlayerReady" when the player is loaded and ready.

So just listen for that, and you'll know when the player is loaded and ready.

Here's the docs:

http://code.google.com/apis/youtube/js_api_reference.html

I think vimeo may have something similar.

Geoff