[Pkg-javascript-commits] [jarisplayer] 23/80: Added: display current aspect ratio label on aspect ratio toggle

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 fd14433267d4bfa6ade1058440dbc9d6b440a797
Author: jgmylm <jgmylm at edf201c3-a14d-0410-a11e-aa85364efa9f>
Date:   Sat Mar 13 06:25:36 2010 +0000

    Added: display current aspect ratio label on aspect ratio toggle
    
    git-svn-id: https://jaris.svn.sourceforge.net/svnroot/jaris/trunk@23 edf201c3-a14d-0410-a11e-aa85364efa9f
---
 bin/JarisFLVPlayer.swf                | Bin 20121 -> 20559 bytes
 changes.txt                           |   6 ++-
 src/jaris/player/Player.hx            |   3 +-
 src/jaris/player/controls/Controls.hx |  85 +++++++++++++++++++++++++++++++++-
 4 files changed, 91 insertions(+), 3 deletions(-)

diff --git a/bin/JarisFLVPlayer.swf b/bin/JarisFLVPlayer.swf
index 3b91788..e9db0e3 100644
Binary files a/bin/JarisFLVPlayer.swf and b/bin/JarisFLVPlayer.swf differ
diff --git a/changes.txt b/changes.txt
index 48659f1..d24a7ec 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,8 @@
-Jaris FLV Player v2.0.5 beta - 03/12/2010
+Jaris FLV Player v2.0.6 beta - 03/13/2010
+
+	* Added: display current aspect ratio label on aspect ratio toggle
+
+Jaris FLV Player v2.0.5 beta - 03/12/2010
 
 	* Improved aspect ratio toogle when video aspect ratio is already on the aspect ratios list
 	* Fixed context menu aspect ratio rotation
diff --git a/src/jaris/player/Player.hx b/src/jaris/player/Player.hx
index b312034..0436239 100644
--- a/src/jaris/player/Player.hx
+++ b/src/jaris/player/Player.hx
@@ -311,7 +311,6 @@ class Player extends EventDispatcher
 		{
 			case Keyboard.TAB:
 				toggleAspectRatio();
-				callEvents(PlayerEvents.ASPECT_RATIO);
 			
 			case F_KEY:
 				toggleFullscreen();
@@ -1066,6 +1065,8 @@ class Player extends EventDispatcher
 		
 		resizeAndCenterPlayer();
 		
+		callEvents(PlayerEvents.ASPECT_RATIO);
+		
 		return _aspectRatio;
 	}
 	
diff --git a/src/jaris/player/controls/Controls.hx b/src/jaris/player/controls/Controls.hx
index 7a701d0..51f4352 100644
--- a/src/jaris/player/controls/Controls.hx
+++ b/src/jaris/player/controls/Controls.hx
@@ -32,8 +32,10 @@ import flash.events.MouseEvent;
 import flash.display.MovieClip;
 import flash.net.NetStream;
 import flash.geom.Rectangle;
+import flash.text.AntiAliasType;
 import flash.text.TextField;
 import flash.text.TextFieldAutoSize;
+import flash.text.TextFormat;
 import flash.utils.Timer;
 import jaris.animation.Animation;
 import jaris.display.Loader;
@@ -67,6 +69,7 @@ class Controls extends MovieClip {
 	private var _controlColor:UInt;
 	private var _hoverColor:UInt;
 	private var _hideControlsTimer:Timer;
+	private var _hideAspectRatioLabelTimer:Timer;
 	private var _currentPlayTimeLabel:TextField;
 	private var _totalPlayTimeLabel:TextField;
 	private var _seekPlayTimeLabel:TextField;
@@ -82,6 +85,8 @@ class Controls extends MovieClip {
 	private var _volumeTrack:Sprite;
 	private var _volumeSlider:Sprite;
 	private var _loader:Loader;
+	private var _aspectRatioLabelContainer:Sprite;
+	private var _aspectRatioLabel:TextField;
 	//}
 	
 	
@@ -100,6 +105,7 @@ class Controls extends MovieClip {
 		_hoverColor = 0x67A8C1;
 		_percentLoaded = 0.0;
 		_hideControlsTimer = new Timer(500);
+		_hideAspectRatioLabelTimer = new Timer(500);
 		_controlsVisible = false;
 		//}
 		
@@ -175,6 +181,17 @@ class Controls extends MovieClip {
 		_controlsBar.addChild(_volumeTrack); 
 		//}
 		
+		//{Aspect ratio label
+		_aspectRatioLabelContainer = new Sprite();
+		addChild(_aspectRatioLabelContainer);
+		
+		_aspectRatioLabel = new TextField();
+		_aspectRatioLabel.autoSize = TextFieldAutoSize.CENTER;
+		_aspectRatioLabel.text = "original";
+		_aspectRatioLabel.tabEnabled = false;
+		_aspectRatioLabelContainer.addChild(_aspectRatioLabel);
+		//}
+		
 		redrawControls();
 		
 		//{Loader bar
@@ -217,6 +234,7 @@ class Controls extends MovieClip {
 		_player.addEventListener(PlayerEvents.PLAY_PAUSE, onPlayerPlayPause);
 		_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayerPlaybackFinished);
 		_player.addEventListener(PlayerEvents.CONNECTION_FAILED, onPlayerStreamNotFound);
+		_player.addEventListener(PlayerEvents.ASPECT_RATIO, onPlayerAspectRatio);
 		
 		_stage.addEventListener(MouseEvent.MOUSE_UP, onThumbMouseUp);
 		_stage.addEventListener(MouseEvent.MOUSE_OUT, onThumbMouseUp);
@@ -224,6 +242,7 @@ class Controls extends MovieClip {
 		_stage.addEventListener(Event.RESIZE, onStageResize);
 		
 		_hideControlsTimer.addEventListener(TimerEvent.TIMER, hideControlsTimer);
+		_hideAspectRatioLabelTimer.addEventListener(TimerEvent.TIMER, hideAspectRatioLabelTimer);
 		
 		_hideControlsTimer.start();
 		//}
@@ -258,6 +277,20 @@ class Controls extends MovieClip {
 			}
 		}
 	}
+	
+	/**
+	 * Hides aspect ratio label
+	 * @param	event
+	 */
+	private function hideAspectRatioLabelTimer(event:TimerEvent):Void
+	{	
+		//wait till fade in effect finish
+		if (_aspectRatioLabelContainer.alpha >= 1)
+		{
+			Animation.fadeOut(_aspectRatioLabelContainer, 300);
+			_hideAspectRatioLabelTimer.stop();
+		}
+	}
 	//}
 	
 	
@@ -400,6 +433,26 @@ class Controls extends MovieClip {
 	{
 		_loader.hide();
 	}
+	
+	/**
+	 * Show the selected aspect ratio
+	 * @param	event
+	 */
+	private function onPlayerAspectRatio(event:PlayerEvents):Void
+	{
+		_hideAspectRatioLabelTimer.stop();
+		_aspectRatioLabel.text = _player.getAspectRatioString();
+		drawAspectRatioLabel();
+		
+		while (_aspectRatioLabelContainer.visible)
+		{
+			//wait till fade out finishes
+		}
+		
+		Animation.fadeIn(_aspectRatioLabelContainer, 100);
+		
+		_hideAspectRatioLabelTimer.start();
+	}
 		
 	/**
 	 * Monitors playbeack when finishes tu update controls
@@ -579,6 +632,7 @@ class Controls extends MovieClip {
 	{	
 		drawSeekControls();
 		drawPlayingControls();
+		drawAspectRatioLabel();
 	}
 	
 	/**
@@ -737,12 +791,41 @@ class Controls extends MovieClip {
 		_volumeSlider.graphics.endFill();
 		
 	}
+	
+	private function drawAspectRatioLabel():Void
+	{
+		_aspectRatioLabelContainer.graphics.clear();
+		_aspectRatioLabelContainer.visible = false;
+		
+		//Update aspect ratio label
+		var textFormat:TextFormat = new TextFormat();
+		textFormat.font = "arial";
+		textFormat.bold = true;
+		textFormat.size = 40;
+		textFormat.color = _controlColor;
+		
+		_aspectRatioLabel.setTextFormat(textFormat);
+		_aspectRatioLabel.x = (_stage.stageWidth / 2) - (_aspectRatioLabel.width / 2);
+		_aspectRatioLabel.y = (_stage.stageHeight / 2) - (_aspectRatioLabel.height / 2);
+		_aspectRatioLabel.antiAliasType = AntiAliasType.NORMAL;
+		
+		//Draw aspect ratio label container
+		_aspectRatioLabelContainer.x = _aspectRatioLabel.x - 10;
+		_aspectRatioLabelContainer.y = _aspectRatioLabel.y - 10;
+		_aspectRatioLabelContainer.graphics.lineStyle(3, _controlColor);
+		_aspectRatioLabelContainer.graphics.beginFill(_brightColor, 1);
+		_aspectRatioLabelContainer.graphics.drawRoundRect(0, 0, _aspectRatioLabel.width + 20, _aspectRatioLabel.height + 20, 15, 15);
+		_aspectRatioLabelContainer.graphics.endFill();
+		
+		_aspectRatioLabel.x = 10;
+		_aspectRatioLabel.y = 10;
+	}
 	//}
 	
 	
 	//{Private Methods
 	/**
-	 * Hide de play controls bar
+	 * Hide the play controls bar
 	 */
 	private function hideControls():Void
 	{

-- 
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