PDA

View Full Version : stop flvplayback component from downloading the stream!


calipoop
01-09-2007, 11:28 PM
It seems like it should be very simple...

I'm using flvplayback component for progressive download of a movie. After clicking a close button, I want that movie component to essentially dissapear! Stop playing, and stop downloading the stream.

my_flvplayer.closeVideoPlayer(0) doesn't work, it says it can't close the default flvplayer. great... I'm not a newb, why is this such a pain in the arse.

calipoop
01-09-2007, 11:54 PM
for anyone that cares, I think I figured it out... but if you're reading this and think I've made an error, please let me know.

Drag your initial flvplayback component onto the stage. Do not set the contentpath and set autoplay to false. This is your "default player" which cannot be deleted according to Flash documentation.

Next, you need to set the flvplayback index to a number greater than zero. At this point, you set the contentpath and play your video. Your code will probably look something like this:
my_flvplayer.activeVideoPlayerIndex = 1;
my_flvplayer.visibleVideoPlayerIndex = 1;
my_flvplayer.contentPath = "http://your_progressive_playstream_video.flv";
my_flvplayer.play();

You can then close this video by using code like this:
my_flvplayer.closeVideoPlayer(1);

It looks like it works for me.

tdunlop
10-09-2009, 08:04 AM
Thanks! This helped a lot. I had to add a FLVPlayback component, then delete it from the stage, and then in the actions panel, I had to addChild(my_flvplayer) to get it appear on the screen. I'm now going to see if it'll allow my to skin it in the actionscript.

Here's my code:

import fl.video.FLVPlayback;

//instantiate the video player
var myVid:FLVPlayback= new FLVPlayback();
var _vidPlaying:Boolean=false;
myVid.x=61;
myVid.y=263;
myVid.width=450;
myVid.height=337.5;
myVid.source="videos/Clip1.mp4";
myVid.activeVideoPlayerIndex=1;
myVid.visibleVideoPlayerIndex=1;
addChild(myVid);

and then whenever anyone navigated away from the video page using the navigation menu, I had this listener going on the navigation menu.


navBar_mc.addEventListener(MouseEvent.CLICK, stopVid, false, 0, true);


function stopVid(evt:Event):void {
if (_vidPlaying==true)
{myVid.closeVideoPlayer(1);
_vidPlaying=false;
trace("Video is stopped.");
}else{
trace("No Video is playing");
}
}

TrondH
11-11-2009, 08:30 PM
Another way is to get access to the VideoPlayer and call the close method.

var VP:VideoPlayer = my_flvplayer.getVideoPlayer(0);
VP.close();