hey.. sorry I haven't posted the code yet. but it sounds like you got
yours figured out. thats good.
here is the code: 2 classes
/**
* @author Aaron Smith
* @version
**/
//video stuff needed
import com.iqtv.vw.gticonfig.video.*;
//events
import mx.utils.Delegate;
import mx.events.EventDispatcher;
import clib.*;
class net.smithaaronlee.MultipleFLVVideoPlayer extends MovieClip
{
//video streaming
private var _connection:NetConnection;
private var _nStream:NetStream;
private var _vidClips:Array;
private var _video:Video;
private var streamClips:Array;
private var preloadedClips:Array;
private var totalBytes:Number = 0;
private var loadedBytes:Number = 0;
private var totalPlayedTime:Number = 0;
private var playheadTime:Number = 0;
private var durations:Array;
private var currentStream:MultipleFLVVideoPlayerClip;
private var progressInt:Number;
private var isPlaying:Boolean = false;
private var clipToLoop:Number = 0;
private var loopClip:Boolean = false;
private var _autoStart:Boolean = false;
//event methods
private var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;
//constructor
public function MultipleFLVVideoPlayer( videoClips:Array, vid:Video )
{
super();
//initialized the event dispatcher
EventDispatcher.initialize(this);
//init vars
_vidClips = [];
streamClips = [];
preloadedClips = [];
durations = [];
_vidClips = videoClips;
_video = vid;
_connection = new NetConnection();
_connection.connect( null );
//initialize
init();
}
//initialize this player
public function init():Void
{
startPreloading();
}
//register the video component to use
public function registerVideo( vid:Video ):Void
{
_video = vid;
}
//set the stream clips
public function setClips( clips:Array ):Void
{
_vidClips = clips;
}
//start preloading video
private function startPreloading():Void
{
//stop preloading first, the start again.
stopPreloading();
//create new VideoPlayerFLVCLips for each video
//add each video to the streamclips array
for( var i:Number = 0; i < _vidClips.length; i++ )
{
streamClips[i] = new MultipleFLVVideoPlayerClip(
_connection, _video, _vidClips[i] );
streamClips[i].streamIndex = i;
addListenersToStream( i );
}
//start the preloading sequence with the first clip ( onMeta it
will keep preloading next clips);
streamClips[0].startPreloading();
startProgessUpdate();
}
//stop all preloading
public function stopPreloading():Void
{
currentStream.pause();
for( var i:Number = 0; i < streamClips.length; i++ )
{
streamClips[ i ].stopPreloading();
}
clearInterval( progressInt );
}
//play video
public function play():Void
{
StaticLogger.getInstance().Trace( 'PLAY' )
if( isPlaying )
{
//toggle the play / pause
pause();
}
else
{
isPlaying = true;
//reset current play info
playheadTime = 0;
totalPlayedTime = 0;
//play the video ( all video sequenced together ). start at
first video
if( currentStream.loopClip == true )
{
currentStream.pause();
}
currentStream = streamClips[ 0 ];
currentStream.play();
}
}
//pause the curent stream
public function pause():Void
{
currentStream.pause();
}
//replay the video
public function replay():Void
{
//set isPlaying swithc to false so it starts the stream over in
the play() method
isPlaying = false;
play();
}
//loop the last clip in the sequence
public function set loopLastClip( bool:Boolean ):Void
{
streamClips[ streamClips.length - 1 ].loopClip = bool;
}
//auto start options
public function set autoStart( bool:Boolean ):Void
{
_autoStart = bool;
}
//interval for checking the progress
private function startProgessUpdate():Void
{
progressInt = setInterval( Delegate.create(this, checkProgress
), 10 );
}
//the actual update of progress
private function checkProgress():Void
{
//clear out the current load information
var amountLoaded:Number = 0;
var totalBytes:Number = 0;
var amountLoaded:Number = 0;
var totalDuration:Number = 0;
//get totals for bytes loaded and totalbytes for all clips
for( var i:Number = 0; i < streamClips.length; i++ )
{
amountLoaded += streamClips[i].getStream().bytesLoaded;
totalBytes += streamClips[i].getStream().bytesTotal;
}
///StaticLogger.getInstance().Trace(amountLoaded);
//StaticLogger.getInstance().Trace(totalBytes);
//StaticLogger.getInstance().Trace(totalBytes * 0.7 );
//if auto start. play
if( amountLoaded >= ( totalBytes * 0.7 ) && _autoStart == true
&& totalBytes > 3 )
{
if( !isPlaying )
{
StaticLogger.getInstance().Trace( 'AUTO PLAY ')
StaticLogger.getInstance().Trace('in side ');
play();
dispatchEvent( { type:'autoStart', target:this } );
}
}
//use a for in in case the index's are out of order
for( var k in durations )
{
totalDuration += durations[k];
}
//the playhead time for all video
playheadTime = currentStream.getStream().time + totalPlayedTime;
//tell someone of the progress
dispatchEvent( { type:'progress', target:this,
bytesLoaded:amountLoaded, bytesTotal:totalBytes,
totalDuration:totalDuration, playheadTime:playheadTime } );
}
//reset all the time stuff
public function reset():Void
{
playheadTime = 0;
}
//add all these crazy listeners to an individual VidoPlayerFLVClip
private function addListenersToStream( streamIndex:Number ):Void
{
streamClips[streamIndex].addEventListener( 'streamNotFound',
Delegate.create( this, handleStreamNotFound ) );
streamClips[streamIndex].addEventListener( 'metaData',
Delegate.create( this, handleMetaData ) );
streamClips[streamIndex].addEventListener( 'streamStart',
Delegate.create( this, handleStreamStart ) );
streamClips[streamIndex].addEventListener( 'streamStop',
Delegate.create( this, handleStreamStop ) );
streamClips[streamIndex].addEventListener( 'bufferFull',
Delegate.create( this, handleBufferFull ) );
streamClips[streamIndex].addEventListener( 'bufferEmpty',
Delegate.create( this, handleBufferEmpty ) );
streamClips[streamIndex].addEventListener( 'bufferFlush',
Delegate.create( this, handleBufferFlush ) );
streamClips[streamIndex].addEventListener( 'seekComplete',
Delegate.create(this, handleSeekComplete ) );
}
//remove listeners from single stream
private function removeListenersFromStream( streamIndex:Number ):Void
{
//streamClips[streamIndex].removeEventListener(
'startPreloading', this );
//streamClips[streamIndex].removeEventListener(
'stopPreloading', this );
streamClips[streamIndex].removeEventListener( 'streamNotFound',
this );
streamClips[streamIndex].removeEventListener( 'streamStart', this );
streamClips[streamIndex].removeEventListener( 'streamStop', this );
streamClips[streamIndex].removeEventListener( 'bufferFull', this );
streamClips[streamIndex].removeEventListener( 'bufferEmpty', this );
streamClips[streamIndex].removeEventListener( 'bufferFlush', this );
streamClips[streamIndex].removeEventListener( 'seekComplete',
this );
}
/*
*EVENT HANDLERS FOR STREAMS
*/
//handle stream not found
private function handleStreamNotFound( eventObj:Object ):Void
{
StaticLogger.getInstance().Trace('STREAM NOT FOUND');
dispatchEvent({type:'streamNotFound', target:this,
streamIndex:eventObj.streamIndex } );
}
//cut an flv out of the sequence
public function spliceClip( streamIndex ):Void
{
streamClips.splice( streamIndex, 1 );
}
//handle meta data ( specificaclly the duration property );
private function handleMetaData( eventObj:Object ):Void
{
durations[ eventObj.streamIndex ] = eventObj.duration;
if( !preloadedClips[ eventObj.streamIndex ] )
{
preloadedClips[ eventObj.streamIndex ] = streamClips[
eventObj.streamIndex ];
streamClips[ eventObj.streamIndex + 1 ].startPreloading();
}
}
//handle stream start
private function handleStreamStart( eventObj:Object ):Void
{
dispatchEvent( { type:'streamStart', target:this } );
}
//handle stream stop
private function handleStreamStop( eventObj:Object ):Void
{
//if last clip and done.. dispatch complete
if( currentStream.streamIndex == streamClips.length - 1 )
{
dispatchEvent( { type:'finish', target:this } );
}
totalPlayedTime += currentStream.getStream().time;
//increment to the next stream in the sequence
currentStream = streamClips[ currentStream.streamIndex + 1 ];
currentStream.play();
//if loop clips
if( eventObj.loopClip )
{
reset();
currentStream = streamClips[ streamClips.length - 1 ];
currentStream.play();
}
}
//handle buffer full
private function handleBufferFull( eventObj:Object ):Void
{
if( eventObj.streamIndex == currentStream.streamIndex );
dispatchEvent( { type:'bufferFull', target:this } );
}
//handle buffer empty
private function handleBufferEmpty( eventObj:Object ):Void
{
if( eventObj.streamIndex == currentStream.streamIndex )
dispatchEvent( { type:'bufferEmpty', target:this } );
}
//handle buffer flush
private function handleBufferFlush( eventObj:Object ):Void
{
dispatchEvent( { type:'bufferFlush', target:this,
streamIndex:eventObj.streamIndex } );
}
//handle seek complete
private function handleSeekComplete( eventObj:Object ):Void
{
dispatchEvent( { type:'seekComplete', target:this,
streamIndex:eventObj.streamIndex } );
}
}
----------------------------------------------
/**
* @author Aaron Smith
* @version
**/
//events
import mx.utils.Delegate;
import mx.events.EventDispatcher;
class net.smithaaronlee.MultipleFLVVideoPlayerClip extends EventDispatcher
{
private var _connection:NetConnection;
private var _nstream:NetStream;
private var _video:Video;
private var flvurl:String;
private var meta:Object;
private var clipDuration:Number;
private var paused:Boolean;
private var target:MovieClip;
private var _loopClip:Boolean;
//this VideoPlayerFLVClips index in the sequence
private var _streamIndex:Number;
//constructor
public function MultipleFLVVideoPlayerClip(
connection:NetConnection, video:Video, flvurl:String )
{
_connection = connection;
_video = video;
_nstream = new NetStream( _connection );
this.flvurl = flvurl;
this.target = target;
//set up handlers
_nstream.onStatus = Delegate.create( this, onStatus );
_nstream['onMetaData'] = Delegate.create(this, onMetaData );
_nstream.setBufferTime(5);
//var inits
meta = new Object();
}
//preload video
public function startPreloading():Void
{
//to preload just start plaing the stream ( without attching to
video component )
//then pause it, it still keeps downloading the video. then to
play it again just seek to 0 and use pause()
_nstream.play( flvurl );
_nstream.pause();
dispatchEvent( { type:'startPreloading', target:this,
streamIndex:_streamIndex } );
}
//stop preloading
public function stopPreloading():Void
{
_nstream.close();
dispatchEvent( { type:'stopPreloading', target:this,
streamIndex:_streamIndex } );
}
//play this stream
public function play():Void
{
_video.attachVideo( _nstream );
_nstream.seek( 0 );
_nstream.pause();
_nstream.play( flvurl );
}
//pause
public function pause():Void
{
_nstream.pause();
}
//on status change
private function onStatus( eventObj:Object ):Void
{
switch( eventObj.code )
{
case "NetStream.Play.StreamNotFound":
streamNotFound();
break;
case "NetStream.Play.Start":
streamStart();
break;
case "NetStream.Play.Stop":
streamStopped();
break;
case "NetStream.Seek.Notify":
seekComplete();
break;
case "NetStream.Buffer.Full":
bufferFull();
break;
case "NetStream.Buffer.Flush":
bufferFlush();
break;
case "NetStream.Buffer.Empty":
bufferEmpty();
break;
}
}
//handle when get metaData
private function onMetaData( eventObj:Object ):Void
{
meta = eventObj;
clipDuration = meta.duration;
dispatchEvent( { type:'metaData', target:this,
duration:clipDuration, meta:meta, streamIndex:streamIndex } );
}
//get this streams meta data
public function getMetaData():Object
{
return meta;
}
/*
* onStatus Message methods
*/
//when stream not found
private function streamNotFound():Void
{
dispatchEvent( { type:'streamNotFound', target:this,
streamIndex:_streamIndex } );
stopPreloading();
}
//when buffer is full and will begin to play
private function bufferFull():Void
{
dispatchEvent( { type:'bufferFull', target:this,
streamIndex:_streamIndex } );
}
//when buffer is empty
private function bufferEmpty():Void
{
dispatchEvent( { type:'bufferEmpty', target:this,
streamIndex:_streamIndex } );
}
//when stream has started
private function streamStart():Void
{
dispatchEvent( { type:'streamStart', target:this,
streamIndex:_streamIndex } );
}
//when stream has stopped
private function streamStopped():Void
{
dispatchEvent( { type:'streamStop', target:this,
streamIndex:_streamIndex, loopClip:_loopClip } );
}
//when buffer is about to be flushed
private function bufferFlush():Void
{
dispatchEvent( { type:'bufferFlush', target:this,
streamIndex:_streamIndex } );
}
//when seeking is complete
private function seekComplete():Void
{
dispatchEvent( { type:'seekComplete', target:this,
streamIndex:_streamIndex } );
}
//set this clips index
public function set streamIndex( int:Number ):Void
{
this._streamIndex = int;
}
//get this clips index
public function get streamIndex():Number
{
return _streamIndex;
}
public function get loopClip():Boolean
{
return _loopClip;
}
public function set loopClip( loop:Boolean ):Void
{
trace('setLoopClip true');
_loopClip = loop;
}
//get this netstream object
public function getStream():NetStream
{
return _nstream;
}
}
------------------------------
thats my code as of right now. the code isn't up to par. being in the
middle of stuff. but once I get done with a deadline i'll update it and
make it available. how you use it is create a new instance of
MultipleFLVVide0Player() : ex: var mfvlp:MultipleFLVVideoPlayer = new
MultipleFLVVideoPlayer( ['1.flv','2.flv'] , videoObject );
then you just tap into the events it dispatches.. use those for all of
your controls and bars and what not.. like I said.. i need to update
this majorly so I can realease. it.. but.. it works great. Also not if
you try to use this. you can take out any StaticLogger references or any
clib.* imports...
Aaron
Wouter Steidl wrote:
I finished a project with quite some FLVs myself this week (around 45
different 1 to 3 MB FLVs) and used the activeVideoPlayerIndex technique...
I throw an array of videos in my VideoLoader class and it starts preloading
the 1st one...when that is done loading it adds 1 to the
activeVideoPlayerIndex and preloads the next one in the array...etc.etc.
Works great! Curious to see your code Aaron!
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of jim
Sent: Wednesday, May 17, 2006 1:30 PM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] Multiple FLVPlayback problem
That's great arron, I actually started looking into this metod yesterday
myself after seeing the activePlayer index in the FLVPlayback component. I
was thinking that extending the component would be best.
Well, I will be very greatful for your help/class.
Cheers
Jim
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of aaron smith
Sent: 16 May 2006 23:55
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Multiple FLVPlayback problem
one other thing, you might want to split up your video even more.. like
6 - 10 clips. that way they're way smaller files.. seeking and loading
wouldn't be a problem then.
aaron smith wrote:
I'm also working on a project that requires multiple flv's also. What
I did was create a very basic multiple flv player. then with that you
listen to whatever events you want to tap into. say for some video
controls and what not. I will share it with you later tonight. I need
to refactor it a bit and add a little more functionality.. but it
works great!
I need to build in seeking capabilities and cuepoint capabilities..
other than that. it all works great. I am using with 2 - 5 MB files.
of about 2 or 3 files.. so total up those files and generally its
about 10 - 15 megs..
as far as preloading the flvs. what you need to do is start playing
the first one. then when you get a metadata event for that one. start
playing the second one, once you get metadeta for that one. add it to
total time and pause it.. it will still continue to download the flv
though... so basically you need to wait till one has metadeta.. then
start the next one. or you could come up with some other way of doing
this. but thats how I had to do it without killing the player because
of all the video loading. this way works great locally. over the net
it also works great but my files are considerablly smaller.
like I said. i'll share this with you later tonight.. I also am
planning on releasing it for public use. I just need to get it ready
for release.
smith
Jim Tann wrote:
Originally posted on OSFlash.org list, sorry to double post, sent to
wrong list.
Hi all,
I am working on several projects that have very large videos (1-2
hours) that need to be delivered on CD-Rom & Intranet. After trying
to use one large video file I realized there is a large problem when
seeking to any point in the video in that It has to buffer itself up
to the point you wish to play & on these large videos that can take quite
some time.
This led me to chop the video up into 2 min chunks & write a
segmented video player so they play as one video. This is working
great on most machines but on the occasional Windows 98 machine it is
crashing when initially grabbing the flv's.
I think the problem is that when initializing the component it is
trying to load all the flv's at once.
Does anyone have any insight into this? Is there another segmented
video player about?
Here is the class:
/***************************************
* @author - James Tann
* * FILE :: SegmentedFLVPlayback.as
* PACKAGE :: com.codesortium.video.SegmentedFLVPlayback
* AUTHOR :: James Tann
* AUTHOR SITE :: http://www.avtgroup.com
* CREATED :: 10/04/2006
* DESCRIPTION :: ****************************************/
// ** AUTO-UI IMPORT STATEMENTS **
// ** END AUTO-UI IMPORT STATEMENTS ** import mx.video.FLVPlayback;
import mx.utils.Delegate; import mx.events.EventDispatcher;
class com.codesortium.video.SegmentedFLVPlayback extends MovieClip {
// Constants:
public static var CLASS_REF :Function =
com.codesortium.video.SegmentedFLVPlayback;
public static var LINKAGE_ID :String =
"SegmentedFLVPlayback";
public static var SymbolLinked :Boolean =
Object.registerClass(LINKAGE_ID, CLASS_REF);
// Public Properties:
public var addEventListener :Function;
public var removeEventListener :Function;
public var autoPlay :Boolean
= false;
public var bufferTime :Number
= 0.1;
public var playheadTime :Number
= 0;
public var playheadUpdateInterval :Number = 250;
public var progressInterval :Number
= 250;
public var state :String
= "";
public var totalTime :Number
= 0;
public var stateResponsive :Boolean
= false;
public var buffering :Boolean
= false;
// Private Properties:
private var dispatchEvent :Function;
private var _arrFLVPlayback :Array;
private var _activeFlvPlayback :FLVPlayback;
private var _totalLength :Number
= 0;
private var _position :Number
= 0;
private var _volume :Number
= 100;
private var _arrCuePoints :Array;
// UI Elements:
// ** AUTO-UI ELEMENTS **
private var mcBackground:MovieClip; // ** END AUTO-UI ELEMENTS **
// Initialization:
private function SegmentedFLVPlayback() {
EventDispatcher.initialize(this);
_arrFLVPlayback = new Array();
_arrCuePoints = new Array();
}
private function onLoad():Void { configUI(); }
// Public Methods:
public function toString() : String {
return "com.codesortium.video.SegmentedFLVPlayback";
}
public function get width():Number{
return _width;
}
public function set width(intSet:Number):Void{
_width = intSet;
}
public function get height():Number{
return _height;
}
public function set height(intSet:Number):Void{
_height = intSet;
}
public function get length():Number{
return _totalLength;
}
public function get playing():Boolean{
return _activeFlvPlayback.playing;
}
public function get volume():Number{
return _volume;
}
public function set volume(intSet:Number):Void{
_volume = intSet;
for(var i:Number=0; i<_arrFLVPlayback.length; i++){
FLVPlayback(_arrFLVPlayback[i]).volume = _volume;
}
}
public function addFLV(strURI:String):Void{
var newFLVPlayback :FLVPlayback;
newFLVPlayback =
FLVPlayback(this.attachMovie("FLVPlayback","FLVPlayback" +
_arrFLVPlayback.length, this.getNextHighestDepth()));
newFLVPlayback.addEventListener("metadataReceived",
Delegate.create(this, onMetadata));
newFLVPlayback.addEventListener("ready",
Delegate.create(this, onReady));
newFLVPlayback.addEventListener("playheadUpdate",
Delegate.create(this, onPlayheadUpdate));
newFLVPlayback.addEventListener("stateChange",
Delegate.create(this, onStateChange));
newFLVPlayback.addEventListener("complete",
Delegate.create(this, onComplete));
newFLVPlayback.maintainAspectRatio = false;
newFLVPlayback.autoPlay
= false;
newFLVPlayback.bufferTime
= bufferTime;
newFLVPlayback.playheadUpdateInterval =
playheadUpdateInterval;
newFLVPlayback.progressInterval =
progressInterval;
if(_arrFLVPlayback.length != 0){
newFLVPlayback._visible = false;
}else{
_activeFlvPlayback =
newFLVPlayback;
_activeFlvPlayback.autoPlay = autoPlay;
}
newFLVPlayback.contentPath
= strURI;
_arrFLVPlayback.push(newFLVPlayback);
}
public function pause():Void{
_activeFlvPlayback.pause();
}
public function play():Void{
_activeFlvPlayback.play();
}
public function stop():Void{
_activeFlvPlayback.stop();
seek(0);
}
public function seek(time:Number):Void{
var blnSet :Boolean = false;
var intLength :Number = 0;
var blnPlaying :Boolean =
_activeFlvPlayback.playing;
buffering = true;
dispatchEvent({type:"seeking", target:this});
for(var i:Number=0; i<_arrFLVPlayback.length; i++){
if(!blnSet){
var flvCurrent :FLVPlayback =
_arrFLVPlayback[i];
if(time < (intLength + flvCurrent.totalTime)){
if(flvCurrent !=
_activeFlvPlayback){
_activeFlvPlayback.stop();
_activeFlvPlayback = flvCurrent;
_activeFlvPlayback.seek(time - intLength);
if(blnPlaying){
_activeFlvPlayback.play();
}
}else{
flvCurrent.seek(time - intLength);
}
blnSet = true;
}else{
intLength +=
flvCurrent.totalTime;
}
}
}
}
public function addCuePoint(intNew:Number):Void{
var blnAdd :Boolean = true;
for(var i:Number=0; i<_arrCuePoints.length; i++){
if(_arrCuePoints[i] == intNew){
blnAdd = false;
}
}
if(blnAdd){
_arrCuePoints.push(intNew);
_arrCuePoints.sort(Array.NUMERIC);
}
}
public function removeCuePoint(intRemove:Number):Void{
var blnAdd :Boolean = true;
for(var i:Number=0; i<_arrCuePoints.length; i++){
if(_arrCuePoints[i] == intRemove){
_arrCuePoints.splice(i,1);
_arrCuePoints.sort(Array.NUMERIC);
break;
}
}
}
public function seekToNextCuePoint():Void{
for(var i:Number=0; i<_arrCuePoints.length; i++){
if((_arrCuePoints[i] < playheadTime)){
if(_arrCuePoints[i+1] != null){
if(_arrCuePoints[i+1] > playheadTime){
seek(_arrCuePoints[i+1]);
}
}
}
}
}
public function seekToLastCuePoint():Void{
for(var i:Number=0; i<_arrCuePoints.length; i++){
if((_arrCuePoints[i] < playheadTime)){
if(_arrCuePoints[i+1] != null){
if(_arrCuePoints[i+1] > playheadTime){
if(((_arrCuePoints[i] +
2) > playheadTime) && (_arrCuePoints[i-1] != null)){
seek(_arrCuePoints[i-1]);
}else{
seek(_arrCuePoints[i]);
}
}
}
}
}
}
// Semi-Private Methods:
// Private Methods:
private function configUI():Void {
}
private function seekPercent(time:Number):Void{
seek((totalTime/100)*time);
}
private function onMetadata(event:Object,
delegate:Function):Void{
totalTime += event.info.duration;
_totalLength += (event.info.duration * 1000);
dispatchEvent({type:"metadata", target:this});
event.target.removeEventListener("metadata", delegate);
}
private function onReady(event:Object, delegate:Function):Void{
FLVPlayback(event.target).volume = _volume;
stateResponsive = true;
dispatchEvent({type:"ready", target:this});
event.target.removeEventListener("ready", delegate);
}
private function onPlayheadUpdate(event:Object,
delegate:Function):Void{
var blnSet :Boolean = false;
var intLength :Number = 0;
for(var i:Number=0; i<_arrFLVPlayback.length; i++){
var flvCurrent :FLVPlayback =
_arrFLVPlayback[i];
var blnIsCurrent :Boolean
= (flvCurrent == _activeFlvPlayback);
flvCurrent._visible = blnIsCurrent;
if(!blnSet){
if(blnIsCurrent){
intLength += playheadTime
+ (event.playheadTime - playheadTime);
blnSet = true;
}else{
intLength +=
flvCurrent.totalTime;
}
}
}
playheadTime = intLength;
dispatchEvent({type:"playheadUpdate", target:this,
playheadTime:playheadTime});
}
private function onStateChange(event:Object,
delegate:Function):Void{
if(event.target == _activeFlvPlayback){
var objEvent :Object = new Object();
objEvent.target = this;
objEvent.type = "stateChange";
objEvent.state = event.state;
objEvent.playheadTime = playheadTime;
dispatchEvent(objEvent);
switch(event.state){
case "buffering":
buffering = true;
dispatchEvent({type:"buffering", target:this});
break;
case "playing":
buffering = false;
dispatchEvent({type:"playing", target:this});
break;
case "stopped":
buffering = false;
dispatchEvent({type:"stopped", target:this});
break;
case "paused":
buffering = false;
dispatchEvent({type:"paused", target:this});
break;
}
}
}
private function onComplete(event:Object,
delegate:Function):Void{
var blnSet :Boolean = false;
if(_arrFLVPlayback.length > 1){
for(var i:Number=0; i<_arrFLVPlayback.length;
i++){
if(!blnSet){
if(_arrFLVPlayback[i] == _activeFlvPlayback){
blnSet
= true;
_activeFlvPlayback._visible = false;
if(i ==
(_arrFLVPlayback.length-1)){
_activeFlvPlayback = _arrFLVPlayback[0];
_activeFlvPlayback._visible = true;
dispatchEvent({type:"complete", target:this});
}else{
_activeFlvPlayback = _arrFLVPlayback[i+1];
_activeFlvPlayback._visible = true;
_activeFlvPlayback.play();
}
}
}
}
}
}
}
Cheers
Jim
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com