I have the player working near perfectly using HTML5, my problem seems to occur when I switch over to Flash.

When the page loads, I am using jQuery to bind some functions onto some thumbnails to load other videos, as well as a play/pause event that changes and image to indicate that a video is playing. As I mentioned, all is working fine when it's using the video tag.

Seeing as how the player seems to output a different ID depending on what player it's using, I am using jQuery to calculate which ID exists, and thereby load the applicable player using _V_(detectedPlayerName).

When using Flash though, it seems that in 90% of cases the player element loads extremely late onto the page. Causing _V_ to spit out an error that it can't find the player ID, resulting in any commands being bound to the player failing. Even using _V_(detectedPlayerName).ready( ) doesn't seem to help, because the elements don't seem to be on the page yet.

My jQuery code binding code is supposed to only take place once the document is ready, so I am wondering if perhaps the module could be writing out the Flash code in it's own .ready, maybe after mine (if that's even possible?).

Any help would be appreciated.

Comments

Unfortunately, the Video.js module is just a wrapper around the player from http://videojs.com/. The question you're asking relates to the workings of the player and this module has no control over that. You may want to ask your question on http://videojs.com/. A quick 'n' dirty work around for your problem could be to use setTimeout() to wait a second before the player is loaded. You could also do some feature decection yourself to determine whether the flash or HTML5 player is loaded.

Thanks, it actually looks like I might have been loading the wrong ID into the _V_ class.

I set up a separate installation of Video.JS and when using flash it gets wrapped in a div using the same id as the player. The same thing is happening in the Drupal module, it's just a little harder to spot.

So I didn't actually need to detect the two different players. I have yet to test the rest of the events, etc I was adding, but it seems this should clear up the problem. _V_(divID) loads a lot faster than _V_(FlashObjectID), even though both work.

Status:Active» Closed (works as designed)

OK, good luck with your site!