[Pkg-javascript-commits] [jarisplayer] 27/80: removed poster from player code

Jonas Smedegaard dr at jones.dk
Tue May 10 08:45:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository jarisplayer.

commit 2197e07ad783b4c47393fa5f805db092f270df5c
Author: jgmylm <jgmylm at edf201c3-a14d-0410-a11e-aa85364efa9f>
Date:   Sat Mar 13 20:09:45 2010 +0000

    removed poster from player code
    
    git-svn-id: https://jaris.svn.sourceforge.net/svnroot/jaris/trunk@27 edf201c3-a14d-0410-a11e-aa85364efa9f
---
 bin/JarisFLVPlayer.swf      | Bin 20641 -> 20640 bytes
 changes.txt                 |   2 ++
 src/jaris/Main.hx           |  12 ++++++------
 src/jaris/display/Poster.hx |  18 ++++++++++++++++++
 src/jaris/player/Player.hx  |  33 +++------------------------------
 5 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/bin/JarisFLVPlayer.swf b/bin/JarisFLVPlayer.swf
index 437e2c6..7e1b949 100644
Binary files a/bin/JarisFLVPlayer.swf and b/bin/JarisFLVPlayer.swf differ
diff --git a/changes.txt b/changes.txt
index 59cbe47..fd44158 100644
--- a/changes.txt
+++ b/changes.txt
@@ -2,6 +2,8 @@
 
 	* Added: display current aspect ratio label on aspect ratio toggle
 	* Improved readability of text
+	* only attach netstream to video object if input type is video
+	* remove poster from player code
 
 Jaris FLV Player v2.0.5 beta - 03/12/2010
 
diff --git a/src/jaris/Main.hx b/src/jaris/Main.hx
index 4cdee91..f4090e8 100644
--- a/src/jaris/Main.hx
+++ b/src/jaris/Main.hx
@@ -57,11 +57,6 @@ class Main
 		//Reads flash vars
 		var parameters:Dynamic<String> = flash.Lib.current.loaderInfo.parameters;
 		
-		//Draw preview image
-		var poster:String = parameters.poster != null ? parameters.poster : "";
-		var posterImage = new Poster(poster);
-		movieClip.addChild(posterImage);
-		
 		//Initialize and draw player object
 		var player:Player = new Player();
 		if (Capabilities.playerType == "PlugIn" || Capabilities.playerType == "ActiveX")
@@ -84,7 +79,6 @@ class Main
 				player.setSource(parameters.source);
 			}
 			
-			player.setPoster(posterImage);
 			player.setHardwareScaling(parameters.hardwarescaling=="true"?true:false);
 		}
 		else
@@ -94,6 +88,12 @@ class Main
 			//player.load("http://jaris.sourceforge.net/files/audio.mp3", InputType.AUDIO, StreamType.FILE);
 		}
 		
+		//Draw preview image
+		var poster:String = parameters.poster != null ? parameters.poster : "";
+		var posterImage = new Poster(poster);
+		posterImage.setPlayer(player);
+		movieClip.addChild(posterImage);
+		
 		//Modify Context Menu
 		var menu:Menu = new Menu(player);
 		
diff --git a/src/jaris/display/Poster.hx b/src/jaris/display/Poster.hx
index 087876c..915b942 100644
--- a/src/jaris/display/Poster.hx
+++ b/src/jaris/display/Poster.hx
@@ -31,6 +31,9 @@ import flash.events.Event;
 import flash.events.IOErrorEvent;
 import flash.Lib;
 import flash.net.URLRequest;
+import jaris.events.PlayerEvents;
+import jaris.player.InputType;
+import jaris.player.Player;
 
 /**
  * To display an png, jpg or gif as preview of video content
@@ -46,6 +49,7 @@ class Poster extends Sprite
 	private var _height:Float;
 	private var _loading:Bool;
 	private var _loaderStatus:jaris.display.Loader;
+	private var _player:Player;
 	
 	public function new(source:String)
 	{
@@ -114,6 +118,14 @@ class Poster extends Sprite
 		resizeImage();
 	}
 	
+	private function onPlayerMediaInitialized(event:PlayerEvents)
+	{
+		if (_player.getType() == InputType.VIDEO)
+		{
+			this.visible = false;
+		}
+	}
+	
 	/**
 	 * Resizes the poster image to take all the stage
 	 */
@@ -134,4 +146,10 @@ class Poster extends Sprite
 		return _loading;
 	}
 	
+	public function setPlayer(player:Player):Void
+	{
+		_player = player;
+		_player.addEventListener(PlayerEvents.MEDIA_INITIALIZED, onPlayerMediaInitialized);
+	}
+	
 }
\ No newline at end of file
diff --git a/src/jaris/player/Player.hx b/src/jaris/player/Player.hx
index 0436239..c92764b 100644
--- a/src/jaris/player/Player.hx
+++ b/src/jaris/player/Player.hx
@@ -52,7 +52,6 @@ import flash.system.Security;
 import flash.ui.Keyboard;
 import flash.ui.Mouse;
 import flash.utils.Timer;
-import jaris.display.Poster;
 import jaris.events.PlayerEvents;
 import jaris.utils.Utils;
 
@@ -97,7 +96,6 @@ class Player extends EventDispatcher
 	private var _firstLoad:Bool;
 	private var _stopped:Bool;
 	private var _useHardWareScaling:Bool;
-	private var _poster:Poster;
 	private var _youtubeLoader:Loader;
 	//}
 	
@@ -246,7 +244,7 @@ class Player extends EventDispatcher
 					_stream.bufferTime = 10;
 					_stream.play(Utils.rtmpSourceParser(_mediaSource), true);
 					_stream.client = this;
-					_video.attachNetStream(_stream);
+					if(_type == InputType.VIDEO) {_video.attachNetStream(_stream); }
 				}
 				callEvents(PlayerEvents.CONNECTION_SUCCESS);
 
@@ -341,7 +339,6 @@ class Player extends EventDispatcher
 				
 			case X_KEY:
 				stopAndClose();
-				callEvents(PlayerEvents.STOP_CLOSE);
 		}
 	}
 	
@@ -425,11 +422,6 @@ class Player extends EventDispatcher
 		{
 			_isPlaying = true;
 			
-			if (_poster != null)
-			{
-				_poster.visible = false;
-			}
-			
 			_firstLoad = false;
 			if (data.width)
 			{
@@ -513,12 +505,6 @@ class Player extends EventDispatcher
 
 			_isPlaying = true;
 			
-			if (_poster != null)
-			{
-				_videoWidth = _poster.width;
-				_videoHeight = _poster.height;
-			}
-			
 			_firstLoad = false;
 			
 			_mediaLoaded = true;
@@ -617,11 +603,6 @@ class Player extends EventDispatcher
 				
 					_firstLoad = false;
 					
-					if (_poster != null)
-					{
-						_poster.visible = false;
-					}
-					
 					_mediaLoaded = true;
 					_mediaDuration = Reflect.field(_youtubeLoader.content, "getDuration")();
 					trace(_mediaDuration);
@@ -870,7 +851,6 @@ class Player extends EventDispatcher
 			_isPlaying = false;
 			_stopped = true;
 			_startTime = 0;
-			_poster.visible = true;
 			
 			if (_streamType == StreamType.YOUTUBE)
 			{
@@ -886,6 +866,8 @@ class Player extends EventDispatcher
 				_sound.close();
 			}
 		}
+		
+		callEvents(PlayerEvents.STOP_CLOSE);
 	}
 	
 	/**
@@ -1384,15 +1366,6 @@ class Player extends EventDispatcher
 	{
 		_server = server;
 	}
-	 
-	/**
-	 * To set a reference to a poster image that should be disabled when media is loaded and ready to play
-	 * @param	poster
-	 */
-	public function setPoster(poster:Poster)
-	{
-		_poster = poster;
-	}
 	
 	/**
 	 * To set the video source in case we dont want to start downloading at first so when use tooglePlay the

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/jarisplayer.git



More information about the Pkg-javascript-commits mailing list