Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Change video using javascript


Hi, how can i do ...Hi, how can i do to change the video using javascript and not reload the page...

for example if I have a pointer to my player:

player = document.getElementById('myPlayer'); //javascript line

how can I change the video to be played ?
Maybe something like this ?
player.file = "new_video.flv" ; //other javascript line

Please if you have some info let me know writing to javierpaz71@yahoo.com

Thanks a lot in advance,
Javier


4 Community Answers

JW Player

User  
0 rated :

See the JW FLV Player API documentation here: *http://developer.longtailvideo.com/trac/wiki/FlashAPI*

JW Player

User  
1 rated :

Javier, pudiste solucionarlo?

JW Player

User  
0 rated :

Here http://developer.longtailvideo.com/trac/wiki/Player4Api#Sendingevents

You can simple send load event to the player.
Like this:

player = document.getElementById('myPlayer');
player.sendEvent('LOAD', 'www.example.com/video.flv');

JW Player

User  
0 rated :

I'd like to take this a step further...

I have a pre-recorded "place" file that I'd like to play that shows our company logo and plays some music and loops over and over.

I'd like to use AJAX to check for the availability of a live stream via Flash Live Media Encoder and when the event turns on, send the URL of that live event to the player.

When the live event ends, I'd like for the place file to be played and then loop.

I have an idea of how to implement it but if somebody has already done this, that would be even better...credit where credit is due... :)

For an example, if anybody that reads this subscribes to some sports packages, they do this: they play the logo of the service with some music and then break into the live event when it happens and back into the logo when the event ends.

This question has received the maximum number of answers.