I downloaded jwplayer.js from longtailvideo.com, and wrote a script that uses the jwplayer javascript API. My script creates a player instance, and then uses the javascript API to interact with that player instance. Here is how I create the player instance:
var playerobj = $jw(myDivID).setup(params);
This was done in a non-Drupal environment.
I would now like to move this into Drupal, and I am not sure how to proceed. Do you recommend that I use the jwplayer module? Does it support the same javascript API? If so, could you please tell me how I can create a player in such a way that I can access it programmatically through the javascript API?
Or do you recommend that I simply use the same scripts I had been using, pre-drupal, and not bother with the jwplayer module?
Thanks very much.
Comments
Comment #1
JW Player commentedIt is possible to use the Javascript API, however you may run into some issues as the player ids are dynamically generated. If you only need to use the player a few times I would recommend just doing it manually for now.
Thanks.
Comment #2
kobnim commentedJust to clarify:
Are you saying that if I use jwplayer.module to create a player instance, then jwplayer.module generates its own player ID? If so, is there any way to let jwplayer.module create the player instance, and then somehow query the player to get the assigned id? Could I then use the Javascript API to send events to the player?
I am not sure what you mean by "doing it manually"? Do you mean: don't use jwplayer.module. Instead, use the javascript API to create the player, eg
var playerobj = $jw(myDivID).setup(params);Thanks very much.
Comment #3
JW Player commented@kobnim,
The module currently assigns a sequential id to each player div generated on the page. In order to query the player you would need the id. If the content is constant than you would probably be fine assuming what the id of each player is.
By manual, I mean doing exactly what you have described there.
Thanks.