Report abuse


			
package
{
	import fl.video.FLVPlayback;
	import fl.video.flvplayback_internal;
	import fl.video.VideoPlayer;
	import flash.utils.Dictionary;

	public class FLVPlaybackUtils
	{
		// ********** begin public API **********
		
		// This will completely reset your FLVPlayback, destroying it first
		// and the setting it back up to be used again.
		public static function reset(vid: FLVPlayback) : void
		{
			destroy(vid);
			reSetup(vid);
		}
		
		// ********** end public API **********
		
		// I know I could have used use namespace flvplayback_internal, but I wanted
		// not to so that it showed what was that namespace and what wasn't
		
		private static function destroy(vid: FLVPlayback) : void
		{
			if (vid.playing)
				vid.stop();
			
			for each(var v: VideoPlayer in vid.flvplayback_internal::videoPlayers)
				v.close();
		}
		
		private static function reSetup(vid: FLVPlayback) : void
		{
			var vp:VideoPlayer = new VideoPlayer(0, 0);
			vp.setSize(vid.width, vid.height);
			vid.flvplayback_internal::videoPlayers = new Array();
			vid.flvplayback_internal::videoPlayers[0] = vp;
			
			vid.flvplayback_internal::_firstStreamShown = false;
			vid.flvplayback_internal::_firstStreamReady = false;
			vid.flvplayback_internal::videoPlayerStates = new Array();
			vid.flvplayback_internal::videoPlayerStateDict = new Dictionary(true);
			vid.flvplayback_internal::createVideoPlayer(0);
		}
	}
}

/*

Copyright under the MIT open-source license to Bryan Grezeszak,
therefore cannot be re-sold, etc. But you may use it in your projects,
as long as you leave the commenting, and credits.

This class by Bryan Grezeszak | madbunny.us | bryan@madbunny.us

buy my templates and components on FlashDen!
http://flashden.net/user/MBMedia/portfolio?ref=MBMedia

(\___/)
(='.'=) <------ Mad Bunny Skills
(")_(")

*/