Advanced Flash Components
Search!
Search!
Home >  Forum
  SearchSearch   
Switching FLV via javascript?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> FLV Player
View previous topic :: View next topic  
Author Message
jsrobinson
AFC Member


Joined: 12 Sep 2007
Posts: 4

PostPosted: Wed Sep 12, 2007 9:05 pm    Post subject: Switching FLV via javascript? Reply with quote

I read this post:

http://www.afcomponents.com/forum/viewtopic.php?t=1426

If I add this code to the player, how do I then send the FLV player a new FLV file to play via javascript?

Also, can I drop the following code

Code:
function playerCompleteHandler(evnt:Object) {
    // go to the next scene
}
myPlayer.addEventListener("complete", playerCompleteHandler);


into the same area as the other functions in the flv_player_embed.fla?

Flash Newbie here, but love the player (especially the embedded version with the FlashParams!) and it's teaching me a lot about Flash in the process

Thank you! Very Happy
Back to top
View user's profile Send private message
andreit
AFC Team


Joined: 20 Aug 2005
Posts: 2016

PostPosted: Fri Sep 14, 2007 6:15 am    Post subject: Playing new movie at the end Reply with quote

From what I gather you would like to load the second video right after the first finishes playing. In the embeddable FLV Player example we pass all of our date through FlashVars. What you need to do is pass an additional FLV File.
Code:
<param name="FlashVars" value="..........&newMovie=file.flv" />

From now on the newMovie variable will be available inside flash and you can reference it inside the playerCompleteHandler function.
Code:
function playerCompleteHandler(evnt:Object) {
    evnt.target.content = {path:newMovie}
}
myPlayer.addEventListener("complete", playerCompleteHandler);
Back to top
View user's profile Send private message Visit poster's website
jsrobinson
AFC Member


Joined: 12 Sep 2007
Posts: 4

PostPosted: Sat Sep 15, 2007 8:59 pm    Post subject: Getting close... Reply with quote

This gets me most of where I need to be.

I set the autoplay to true, and it works, but the play button is showing up.

Why isn't this working?

Code:
//-------------------------------------------------
//   Get Next Video To Play after Intro
//-------------------------------------------------
function playerCompleteHandler(evnt:Object) {
   myPlayer.autoPlay = true;
    evnt.target.content = {path:newMovie};
   hidePlayButton();
}

myPlayer.addEventListener("complete", playerCompleteHandler);


Thank you for the great support!
Back to top
View user's profile Send private message
jsrobinson
AFC Member


Joined: 12 Sep 2007
Posts: 4

PostPosted: Sat Sep 15, 2007 9:01 pm    Post subject: more... Reply with quote

is there a way to have HTML/Javascript on the page tell the player what FLV to play?

I can load the intro, then play the followup clip, but once that is done, I would like to allow the user to select a different FLV from a list to play. The playlist is HTML (if you couldn't guess already).
Back to top
View user's profile Send private message
jsrobinson
AFC Member


Joined: 12 Sep 2007
Posts: 4

PostPosted: Sat Sep 15, 2007 10:48 pm    Post subject: trying to answer my own questions... Reply with quote

I can get the play button to go away, but it seems to take a couple of seconds after the 2nd video has started to play. Here is the AS code:

Code:
function playerCompleteHandler(evnt:Object) {
   evnt.target.content = {path:newMovie};
   evnt.target.play();
}

myPlayer.addEventListener("complete", playerCompleteHandler);


the evnt.target.play() triggers the hidePlayButton function, but as I said, this takes place well after the movie starts playing. The playing of the first movie does not exhibit this behavior.

any ideas?

Thanks!
Back to top
View user's profile Send private message
wigz
AFC Team


Joined: 27 Mar 2007
Posts: 570

PostPosted: Tue Sep 18, 2007 6:28 pm    Post subject: Reply with quote

jsrobinson,

The player enters the buffering state before it plays, so maybe you could attach your hidePlayButton to the "buffering" event. Thanks!

~Wigz
Back to top
View user's profile Send private message Visit poster's website
barcajunior
AFC Member


Joined: 11 Jan 2008
Posts: 1

PostPosted: Fri Jan 11, 2008 4:28 pm    Post subject: Reply with quote

Quote:
//-------------------------------------------------
// Get Next Video To Play after Intro
//-------------------------------------------------
function playerCompleteHandler(evnt:Object) {
myPlayer.autoPlay = true;
evnt.target.content = {path:newMovie};
hidePlayButton();
}

myPlayer.addEventListener("complete", playerCompleteHandler);


The code is very useful.
473nm DPSS Lasers
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> FLV Player All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group