[Pkg-javascript-commits] [jarisplayer] 33/80: No player uses SharedObject class to store and retrieve current volume and aspecratio of the user.

Jonas Smedegaard dr at jones.dk
Tue May 10 08:45:33 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 e1a0ad8d2b2cabf956da01d1f7858c340b5afe4a
Author: jgmylm <jgmylm at edf201c3-a14d-0410-a11e-aa85364efa9f>
Date:   Fri Nov 5 20:46:58 2010 +0000

    No player uses SharedObject class to store and retrieve current volume and aspecratio of the user.
    
    git-svn-id: https://jaris.svn.sourceforge.net/svnroot/jaris/trunk@33 edf201c3-a14d-0410-a11e-aa85364efa9f
---
 bin/JarisFLVPlayer.swf           | Bin 21297 -> 21679 bytes
 changes.txt                      |   8 ++-
 src/jaris/Main.hx                |  18 ++++++-
 src/jaris/Version.hx             |   6 +--
 src/jaris/player/Player.hx       |  71 +++++++++++++++++++------
 src/jaris/player/UserSettings.hx | 112 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 194 insertions(+), 21 deletions(-)

diff --git a/bin/JarisFLVPlayer.swf b/bin/JarisFLVPlayer.swf
index 6bcb2d1..98e7f10 100644
Binary files a/bin/JarisFLVPlayer.swf and b/bin/JarisFLVPlayer.swf differ
diff --git a/changes.txt b/changes.txt
index 97586fb..d92a32f 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,10 @@
-Jaris FLV Player v2.0.10 beta - 29/09/2010
+Jaris FLV Player v2.0.11 beta - 03/10/2010
+
+	* Removed togglePlay of onFullscreen event since it seems that new flash versions doesnt emits 
+	  the space keydown anymore that affected playback on fullcreen switching.
+	* Added class to store user settings as volume and aspect ratio to load them next time player is load.
+	
+Jaris FLV Player v2.0.10 beta - 29/09/2010
 
 	* Added flashvar aspectratio option to initially tell on wich aspect ratio to play the video
 
diff --git a/src/jaris/Main.hx b/src/jaris/Main.hx
index 99a2be9..1f22a97 100644
--- a/src/jaris/Main.hx
+++ b/src/jaris/Main.hx
@@ -37,6 +37,7 @@ import jaris.player.InputType;
 import jaris.player.Player;
 import jaris.player.StreamType;
 import jaris.player.AspectRatio;
+import jaris.player.UserSettings;
 
 /**
  * Main jaris player starting point
@@ -55,6 +56,9 @@ class Main
 		stage.scaleMode = StageScaleMode.NO_SCALE;
 		stage.align = StageAlign.TOP_LEFT;
 		
+		//Retrieve user settings
+		var userSettings:UserSettings = new UserSettings();
+		
 		//Reads flash vars
 		var parameters:Dynamic<String> = flash.Lib.current.loaderInfo.parameters;
 		
@@ -68,7 +72,7 @@ class Main
 			var server:String = parameters.server != "" && parameters.server != null? parameters.server : "";
 			var aspectRatio:String = parameters.aspectratio != "" && parameters.aspectratio != null? parameters.aspectratio : "";
 			
-			if (aspectRatio != "")
+			if (aspectRatio != "" && !userSettings.isSet("aspectratio"))
 			{
 				switch(aspectRatio)
 				{
@@ -90,10 +94,15 @@ class Main
 						player.setAspectRatio(AspectRatio._16_10);
 				}
 			}
+			else if(userSettings.isSet("aspectratio"))
+			{
+				player.setAspectRatio(userSettings.getAspectRatio());
+			}
 			
 			player.setType(type);
 			player.setStreamType(streamType);
 			player.setServer(server);
+			player.setVolume(userSettings.getVolume());
 			
 			if (autoStart)
 			{
@@ -109,6 +118,13 @@ class Main
 		else
 		{
 			//For development purposes
+			if(userSettings.isSet("aspectratio"))
+			{
+				player.setAspectRatio(userSettings.getAspectRatio());
+			}
+			
+			player.setVolume(userSettings.getVolume());
+			
 			player.load("http://jaris.sourceforge.net/files/jaris-intro.flv", InputType.VIDEO, StreamType.FILE);
 			//player.load("http://jaris.sourceforge.net/files/audio.mp3", InputType.AUDIO, StreamType.FILE);
 		}
diff --git a/src/jaris/Version.hx b/src/jaris/Version.hx
index f63e8a3..90ce59d 100644
--- a/src/jaris/Version.hx
+++ b/src/jaris/Version.hx
@@ -27,9 +27,9 @@ package jaris;
  */
 class Version 
 {
-	public static var NUMBER:String = "2.0.10";
+	public static var NUMBER:String = "2.0.11";
 	public static var STATUS:String = "beta";
-	public static var DATE:String = "30";
-	public static var MONTH:String = "09";
+	public static var DATE:String = "05";
+	public static var MONTH:String = "10";
 	public static var YEAR:String = "2010";
 }
\ No newline at end of file
diff --git a/src/jaris/player/Player.hx b/src/jaris/player/Player.hx
index a3aabba..29a12f4 100644
--- a/src/jaris/player/Player.hx
+++ b/src/jaris/player/Player.hx
@@ -55,6 +55,7 @@ import flash.utils.Timer;
 import jaris.events.PlayerEvents;
 import jaris.utils.Utils;
 import jaris.player.AspectRatio;
+import jaris.player.UserSettings;
 
 /**
  * Jaris main video player
@@ -98,6 +99,7 @@ class Player extends EventDispatcher
 	private var _stopped:Bool;
 	private var _useHardWareScaling:Bool;
 	private var _youtubeLoader:Loader;
+	private var _userSettings:UserSettings;
 	//}
 	
 	
@@ -128,6 +130,7 @@ class Player extends EventDispatcher
 		_server = "";
 		_currentAspectRatio = "original";
 		_aspectRatio = 0;
+		_userSettings = new UserSettings();
 		//}
 		
 		//{Initialize sound object
@@ -391,12 +394,6 @@ class Player extends EventDispatcher
 		{
 			_mouseVisible = true;
 			_hideMouseTimer.start();
-			
-			//If browser player resume playing
-			if ((Capabilities.playerType == "ActiveX" || Capabilities.playerType == "PlugIn"))
-			{
-				togglePlay();
-			}
 		}
 		
 		resizeAndCenterPlayer();
@@ -464,6 +461,9 @@ class Player extends EventDispatcher
 			callEvents(PlayerEvents.MEDIA_INITIALIZED);
 			
 			resizeAndCenterPlayer();
+			
+			//Retrieve the volume that user selected last time
+			setVolume(_userSettings.getVolume());
 		}
 	}
 	
@@ -523,6 +523,9 @@ class Player extends EventDispatcher
 			callEvents(PlayerEvents.MEDIA_INITIALIZED);
 			
 			resizeAndCenterPlayer();
+			
+			//Retrieve the volume that user selected last time
+			setVolume(_userSettings.getVolume());
 		}
 	}
 	
@@ -619,6 +622,9 @@ class Player extends EventDispatcher
 					callEvents(PlayerEvents.MEDIA_INITIALIZED);
 					
 					resizeAndCenterPlayer();
+					
+					//Retrieve the volume that user selected last time
+					setVolume(_userSettings.getVolume());
 				}
 				callEvents(PlayerEvents.NOT_BUFFERING);
 				
@@ -934,6 +940,8 @@ class Player extends EventDispatcher
 				{
 					_soundChannel.stop();
 				}
+				
+				setVolume(_userSettings.getVolume());
 			}
 		}
 		else if(_seekPoints.length > 0 && _streamType == StreamType.PSEUDOSTREAM)
@@ -992,6 +1000,8 @@ class Player extends EventDispatcher
 				{
 					_soundChannel.stop();
 				}
+				
+				setVolume(_userSettings.getVolume());
 			}
 		}
 		
@@ -1060,6 +1070,16 @@ class Player extends EventDispatcher
 		
 		callEvents(PlayerEvents.ASPECT_RATIO);
 		
+		//Store aspect ratio into user settings
+		if (_aspectRatio == _originalAspectRatio)
+		{
+			_userSettings.setAspectRatio(0.0);
+		}
+		else
+		{
+			_userSettings.setAspectRatio(_aspectRatio);
+		}
+		
 		return _aspectRatio;
 	}
 	
@@ -1088,6 +1108,7 @@ class Player extends EventDispatcher
 				{
 					_checkAudioTimer.start();
 					_soundChannel = _sound.play();
+					setVolume(_userSettings.getVolume());
 				}
 			}
 			else if (_mediaLoaded)
@@ -1124,6 +1145,8 @@ class Player extends EventDispatcher
 						{
 							_soundChannel = _sound.play(_soundChannel.position);
 						}
+						
+						setVolume(_userSettings.getVolume());
 					}
 				}
 			}
@@ -1249,6 +1272,7 @@ class Player extends EventDispatcher
 		else if (_type == InputType.AUDIO)
 		{
 			_soundChannel.soundTransform = soundTransform;
+			setVolume(_userSettings.getVolume());
 		}
 		
 		
@@ -1305,6 +1329,9 @@ class Player extends EventDispatcher
 			_volume = 1.0;
 		}
 		
+		//Store volume into user settings
+		_userSettings.setVolume(_volume);
+		
 		return _volume;
 	}
 	
@@ -1345,6 +1372,9 @@ class Player extends EventDispatcher
 			}
 		}
 		
+		//Store volume into user settings
+		_userSettings.setVolume(_volume);
+		
 		return _volume;
 	}
 	//}
@@ -1409,18 +1439,24 @@ class Player extends EventDispatcher
 		
 		soundTransform.volume = volume;
 		
-		if (_streamType == StreamType.YOUTUBE)
-		{
-			Reflect.field(_youtubeLoader.content, "setVolume")(soundTransform.volume * 100);
-		}
-		else if (_type == InputType.VIDEO || _streamType == StreamType.RTMP)
-		{
-			_stream.soundTransform = soundTransform;
-		}
-		else if (_type == InputType.AUDIO)
+		if (!_firstLoad) //To prevent errors if objects aren't initialized
 		{
-			_soundChannel.soundTransform = soundTransform;
+			if (_streamType == StreamType.YOUTUBE)
+			{
+				Reflect.field(_youtubeLoader.content, "setVolume")(soundTransform.volume * 100);
+			}
+			else if (_type == InputType.VIDEO || _streamType == StreamType.RTMP)
+			{
+				_stream.soundTransform = soundTransform;
+			}
+			else if (_type == InputType.AUDIO)
+			{
+				_soundChannel.soundTransform = soundTransform;
+			}
 		}
+		
+		//Store volume into user settings
+		_userSettings.setVolume(_volume);
 	}
 	
 	/**
@@ -1462,6 +1498,9 @@ class Player extends EventDispatcher
 		}
 		
 		resizeAndCenterPlayer();
+		
+		//Store aspect ratio into user settings
+		_userSettings.setAspectRatio(_aspectRatio);
 	}
 	
 	/**
diff --git a/src/jaris/player/UserSettings.hx b/src/jaris/player/UserSettings.hx
new file mode 100644
index 0000000..cb3688c
--- /dev/null
+++ b/src/jaris/player/UserSettings.hx
@@ -0,0 +1,112 @@
+/**    
+ * @author Jefferson González
+ * @copyright 2010 Jefferson González
+ *
+ * @license 
+ * This file is part of Jaris FLV Player.
+ *
+ * Jaris FLV Player is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License or GNU LESSER GENERAL 
+ * PUBLIC LICENSE as published by the Free Software Foundation, either version 
+ * 3 of the License, or (at your option) any later version.
+ *
+ * Jaris FLV Player is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License and 
+ * GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player.  If not, 
+ * see <http://www.gnu.org/licenses/>.
+ */
+
+package jaris.player;
+
+import flash.net.SharedObject;
+
+
+/**
+ * To store and retrieve user settings so the player can load them next time it loads.
+ * In this way player can remember user selected aspect ratio and volume.
+ */
+class UserSettings 
+{
+	private var _settings:SharedObject;
+	
+	public function new() 
+	{
+		_settings = SharedObject.getLocal("JarisPlayerUserSettings");
+	}
+	
+	//{Methods
+	/**
+	 * Deletes all user settings
+	 */
+	public function deleteSettings():Void
+	{		
+		_settings.clear();
+	}
+	
+	/**
+	 * Checks if a user setting is available
+	 * @param	field The name of the setting
+	 * @return true if is set false otherwise
+	 */
+	public function isSet(field:String):Bool
+	{
+		return Reflect.hasField(_settings.data, field);
+	}
+	//}
+	
+	//{Properties Setters
+	/**
+	 * Stores the volume value
+	 * @param	level
+	 */
+	public function setVolume(level:Float):Void
+	{
+		_settings.data.volume = level;
+		_settings.flush();
+	}
+	
+	/**
+	 * Stores the aspect ratio value
+	 * @param	aspect
+	 */
+	public function setAspectRatio(aspectratio:Float):Void
+	{
+		_settings.data.aspectratio = aspectratio;
+		_settings.flush();
+	}
+	//}
+	
+	//{Properties Getters
+	/**
+	 * The last user selected volume value
+	 * @return Last user selected volume value or default if not set.
+	 */
+	public function getVolume():Float
+	{
+		if (!isSet("volume"))
+		{
+			return 1.0; //The maximum volume value
+		}
+		
+		return _settings.data.volume;
+	}
+	
+	/**
+	 * The last user selected aspect ratio value
+	 * @return Last user selected aspect ratio value or default if not set.
+	 */
+	public function getAspectRatio():Float
+	{
+		if (!isSet("aspectratio"))
+		{
+			return 0.0; //Equivalent to original
+		}
+		
+		return _settings.data.aspectratio;
+	}
+	//}
+}
\ No newline at end of file

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