[Pkg-javascript-commits] [jarisplayer] 37/80: New player controls theme thanks to Istvan Petres from http://jcore.net
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 2f6a9a936f282ff1235d14e7ada86c380c2885d8
Author: jgmylm <jgmylm at edf201c3-a14d-0410-a11e-aa85364efa9f>
Date: Sat Aug 27 17:53:09 2011 +0000
New player controls theme thanks to Istvan Petres from http://jcore.net
git-svn-id: https://jaris.svn.sourceforge.net/svnroot/jaris/trunk@37 edf201c3-a14d-0410-a11e-aa85364efa9f
---
Jaris FLV Player.hxproj | 11 +-
bin/JarisFLVPlayer.swf | Bin 23529 -> 26245 bytes
bin/index.html | 32 ++
changes.txt | 12 +-
documentation.txt | 12 +
src/jaris/Main.hx | 24 +-
src/jaris/Version.hx | 4 +-
src/jaris/player/Player.hx | 16 +-
src/jaris/player/controls/Controls.hx | 3 +-
src/jaris/player/newcontrols/AspectRatioIcon.hx | 130 ++++++++
src/jaris/player/newcontrols/FullscreenIcon.hx | 130 ++++++++
src/jaris/player/newcontrols/Loader.hx | 195 ++++++++++++
.../Controls.hx => newcontrols/NewControls.hx} | 344 +++++++++++----------
src/jaris/player/newcontrols/PauseIcon.hx | 127 ++++++++
src/jaris/player/newcontrols/PlayIcon.hx | 122 ++++++++
src/jaris/player/newcontrols/VolumeIcon.hx | 125 ++++++++
16 files changed, 1118 insertions(+), 169 deletions(-)
diff --git a/Jaris FLV Player.hxproj b/Jaris FLV Player.hxproj
index 5891723..f71a96a 100644
--- a/Jaris FLV Player.hxproj
+++ b/Jaris FLV Player.hxproj
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
-<project>
+<project version="2">
<!-- Output SWF options -->
<output>
- <movie disabled="False" />
+ <movie outputType="Application" />
<movie input="" />
<movie path="bin\JarisFLVPlayer.swf" />
<movie fps="30" />
<movie width="800" />
<movie height="600" />
<movie version="10" />
+ <movie minorVersion="0" />
+ <movie platform="Flash Player" />
<movie background="#FFFFFF" />
</output>
<!-- Other classes to be compiled into your SWF -->
@@ -20,8 +22,7 @@
<option directives="" />
<option flashStrict="False" />
<option mainClass="jaris.Main" />
- <option override="False" />
- <option verbose="False" />
+ <option enabledebug="False" />
<option additional="" />
</build>
<!-- haxelib libraries -->
@@ -49,4 +50,6 @@
<option showHiddenPaths="True" />
<option testMovie="Default" />
</options>
+ <!-- Plugin storage -->
+ <storage />
</project>
\ No newline at end of file
diff --git a/bin/JarisFLVPlayer.swf b/bin/JarisFLVPlayer.swf
index f087b2c..467f2eb 100644
Binary files a/bin/JarisFLVPlayer.swf and b/bin/JarisFLVPlayer.swf differ
diff --git a/bin/index.html b/bin/index.html
index fbfd03e..0b4dede 100644
--- a/bin/index.html
+++ b/bin/index.html
@@ -28,6 +28,26 @@
controlcolor: "FFFFFF",
hovercolor: "67A8C1"
};
+ var flashvarsVideoNewControls = {
+ source: "http://jaris.sourceforge.net/files/jaris-intro.flv",
+ type: "video",
+ streamtype: "file",
+ server: "",//Used for rtmp streams
+ duration: "52",
+ poster: "http://jaris.sourceforge.net/images/poster.png",
+ autostart: "false",
+ logo: "http://jaris.sourceforge.net/images/logo.png",
+ logoposition: "top left",
+ logoalpha: "30",
+ logowidth: "130",
+ logolink: "http://jaris.sourceforge.net",
+ hardwarescaling: "false",
+ darkcolor: "000000",
+ brightcolor: "4c4c4c",
+ controlcolor: "FFFFFF",
+ hovercolor: "67A8C1",
+ controltype: 1
+ };
var flashvarsAudio = {
source: "http://jaris.sourceforge.net/files/audio.mp3",
type: "audio",
@@ -60,6 +80,7 @@
id:"JarisFLVPlayer"
};
swfobject.embedSWF("JarisFLVPlayer.swf", "altContentOne", "576px", "360px", "10.0.0", "expressInstall.swf", flashvarsVideo, params, attributes);
+ swfobject.embedSWF("JarisFLVPlayer.swf", "altContentOneNewControls", "576px", "360px", "10.0.0", "expressInstall.swf", flashvarsVideoNewControls, params, attributes);
swfobject.embedSWF("JarisFLVPlayer.swf", "altContentTwo", "576px", "360px", "10.0.0", "expressInstall.swf", flashvarsAudio, params, attributes);
</script>
<style>
@@ -81,6 +102,17 @@
<br /><br />
+ <h1>Video Example with New Controls</h1>
+ <div id="altContentOneNewControls">
+ <h1>Jaris FLV Player</h1>
+ <p>Alternative content</p>
+ <p><a href="http://www.adobe.com/go/getflashplayer"><img
+ src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
+ alt="Get Adobe Flash player" /></a></p>
+ </div>
+
+ <br /><br />
+
<h1>Audio Example</h1>
<div id="altContentTwo">
<h1>Jaris FLV Player</h1>
diff --git a/changes.txt b/changes.txt
index d1d1935..5495104 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,14 @@
-Jaris FLV Player v2.0.14 beta - 20/05/2011
+Jaris FLV Player v2.0.15 beta - 27/08/2011
+
+ * New player controls
+ * New flashvar controltype (0=old, 1=new) to indicate the which controls to use
+ * New flashvar controlsize for new controls only
+ * New flashvar seekcolor for new controls only
+ * New flashvar buffertime to change the default 10 seconds buffer time for local/pseudo streaming
+ * Bugfix on loader bar
+ * All this changes thanks to Istvan Petres from http://jcore.net
+
+Jaris FLV Player v2.0.14 beta - 20/05/2011
* Removed some trace calls on youtube playback.
diff --git a/documentation.txt b/documentation.txt
index 1c49b69..dfa8f53 100644
--- a/documentation.txt
+++ b/documentation.txt
@@ -89,6 +89,15 @@ Here is the list of variables that you can pass to the player.
* controls:
To disable the displaying of controls, values: false to hide otherwise defaults to show
+
+ * controltype
+ Choose which controls to displa. 0 = old controls, 1 = new controls
+
+ * controlsize
+ Changes the height of the new controllers, the default value is 40
+
+ * seekcolor
+ Change the seekbar color (new controls only)
* darkcolor:
The darker color of player controls in html hexadecimal format
@@ -110,6 +119,9 @@ Here is the list of variables that you can pass to the player.
* loop:
As the variable says this keeps looping the video. Set to any value to enable.
+
+ * buffertime
+ To change the default 10 seconds buffer time for local/pseudo streaming
==================
Keyboard Shortcuts
diff --git a/src/jaris/Main.hx b/src/jaris/Main.hx
index af2f269..525ab87 100644
--- a/src/jaris/Main.hx
+++ b/src/jaris/Main.hx
@@ -33,6 +33,7 @@ import jaris.display.Logo;
import jaris.display.Menu;
import jaris.display.Poster;
import jaris.player.controls.Controls;
+import jaris.player.newcontrols.NewControls;
import jaris.player.JsApi;
import jaris.player.InputType;
import jaris.player.Player;
@@ -73,6 +74,7 @@ class Main
var streamType:String = parameters.streamtype != "" && parameters.streamtype != null? parameters.streamtype : StreamType.FILE;
var server:String = parameters.server != "" && parameters.server != null? parameters.server : "";
var aspectRatio:String = parameters.aspectratio != "" && parameters.aspectratio != null? parameters.aspectratio : "";
+ var bufferTime:Float = parameters.buffertime != "" && parameters.buffertime != null? Std.parseFloat(parameters.buffertime) : 0;
if (aspectRatio != "" && !userSettings.isSet("aspectratio"))
{
@@ -105,6 +107,7 @@ class Main
player.setStreamType(streamType);
player.setServer(server);
player.setVolume(userSettings.getVolume());
+ player.setBufferTime(bufferTime);
if (autoStart)
{
@@ -161,17 +164,28 @@ class Main
if (parameters.controls != "false")
{
var duration:String = parameters.duration != "" && parameters.duration != null? parameters.duration : "0";
- var controls:Controls = new Controls(player);
+ var controlType:Int = parameters.controltype != "" && parameters.controltype != null? Std.parseInt(parameters.controltype) : 0;
+ var controlSize:Int = parameters.controlsize != "" && parameters.controlsize != null? Std.parseInt(parameters.controlsize) : 0;
- var controlColors:Array <String> = ["", "", "", ""];
+ var controlColors:Array <String> = ["", "", "", "", ""];
controlColors[0] = parameters.darkcolor != null ? parameters.darkcolor : "";
controlColors[1] = parameters.brightcolor != null ? parameters.brightcolor : "";
controlColors[2] = parameters.controlcolor != null ? parameters.controlcolor : "";
controlColors[3] = parameters.hovercolor != null ? parameters.hovercolor : "";
+ controlColors[4] = parameters.seekcolor != null ? parameters.seekcolor : "";
- controls.setDurationLabel(duration);
- controls.setControlColors(controlColors);
- movieClip.addChild(controls);
+ if (controlType == 1) {
+ var controls:NewControls = new NewControls(player);
+ controls.setDurationLabel(duration);
+ controls.setControlColors(controlColors);
+ controls.setControlSize(controlSize);
+ movieClip.addChild(controls);
+ } else {
+ var controls:Controls = new Controls(player);
+ controls.setDurationLabel(duration);
+ controls.setControlColors(controlColors);
+ movieClip.addChild(controls);
+ }
}
//Loop the video
diff --git a/src/jaris/Version.hx b/src/jaris/Version.hx
index 81799ef..b3b852d 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.13";
+ public static var NUMBER:String = "2.0.15";
public static var STATUS:String = "beta";
public static var DATE:String = "27";
- public static var MONTH:String = "01";
+ public static var MONTH:String = "08";
public static var YEAR:String = "2011";
}
\ No newline at end of file
diff --git a/src/jaris/player/Player.hx b/src/jaris/player/Player.hx
index b54cb50..144dd8d 100644
--- a/src/jaris/player/Player.hx
+++ b/src/jaris/player/Player.hx
@@ -70,6 +70,7 @@ class Player extends EventDispatcher
private var _fullscreen:Bool;
private var _soundMuted:Bool;
private var _volume:Float;
+ private var _bufferTime:Float;
private var _mouseVisible:Bool;
private var _mediaLoaded:Bool;
private var _hideMouseTimer:Timer;
@@ -116,6 +117,7 @@ class Player extends EventDispatcher
_mouseVisible = true;
_soundMuted = false;
_volume = 1.0;
+ _bufferTime = 10;
_fullscreen = false;
_mediaLoaded = false;
_hideMouseTimer = new Timer(1500);
@@ -856,7 +858,7 @@ class Player extends EventDispatcher
_connection.connect(null);
_stream = new NetStream(_connection);
_stream.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
- _stream.bufferTime = 10;
+ _stream.bufferTime = _bufferTime;
_stream.play(source);
_stream.client = this;
_video.attachNetStream(_stream);
@@ -1490,6 +1492,18 @@ class Player extends EventDispatcher
}
/**
+ * Changes the buffer time for local and pseudo streaming
+ * @param time in seconds
+ */
+ public function setBufferTime(time:Float):Void
+ {
+ if (time > 0)
+ {
+ _bufferTime = time;
+ }
+ }
+
+ /**
* Changes the aspec ratio of current playing media and resizes video player
* @param aspectRatio new aspect ratio value
*/
diff --git a/src/jaris/player/controls/Controls.hx b/src/jaris/player/controls/Controls.hx
index bd05525..4311fca 100644
--- a/src/jaris/player/controls/Controls.hx
+++ b/src/jaris/player/controls/Controls.hx
@@ -662,7 +662,8 @@ class Controls extends MovieClip {
}
var position:Float = _player.getStartTime() / _player.getDuration();
- var startPosition:Float = (position * _track.width) + _track.x;
+ //var startPosition:Float = (position * _track.width) + _track.x; //Old way
+ var startPosition:Float = (position > 0?(position * _track.width):0) + _track.x;
_trackDownloaded.graphics.clear();
_trackDownloaded.graphics.lineStyle();
diff --git a/src/jaris/player/newcontrols/AspectRatioIcon.hx b/src/jaris/player/newcontrols/AspectRatioIcon.hx
new file mode 100755
index 0000000..10f91f4
--- /dev/null
+++ b/src/jaris/player/newcontrols/AspectRatioIcon.hx
@@ -0,0 +1,130 @@
+/**
+ * @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.newcontrols;
+import flash.display.Sprite;
+import flash.events.MouseEvent;
+import flash.geom.Matrix;
+import jaris.utils.Utils;
+import flash.display.GradientType;
+
+class AspectRatioIcon extends Sprite
+{
+ private var _width:Float;
+ private var _height:Float;
+ private var _normalColor:UInt;
+ private var _hoverColor:UInt;
+
+ public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
+ {
+ super();
+
+ this.x = x;
+ this.y = y;
+ this.buttonMode = true;
+ this.useHandCursor = true;
+ this.tabEnabled = false;
+
+ _width = width;
+ _height = height;
+ _normalColor = normalColor;
+ _hoverColor = hoverColor;
+
+ addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
+ addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
+
+ draw(_normalColor);
+ }
+
+ private function onMouseOver(event:MouseEvent):Void
+ {
+ draw(_hoverColor);
+ }
+
+ private function onMouseOut(event:MouseEvent):Void
+ {
+ draw(_normalColor);
+ }
+
+ //{Private Methods
+ private function draw(color:UInt):Void
+ {
+ graphics.clear();
+
+ graphics.lineStyle(0, color, 0.0);
+ graphics.beginFill(color, 0);
+ graphics.drawRect(0, 0, _width, _height);
+ graphics.endFill();
+
+ var matrix:Matrix = new Matrix( );
+ matrix.createGradientBox(_width, _height, Utils.degreesToRadians(-90), _width, 0);
+ var colors:Array<UInt> = [color, color];
+ var alphas:Array<Float> = [0.75, 1];
+ var ratios:Array<UInt> = [0, 255];
+
+ var innerWidth:Float = (70 / 100) * width;
+ var innerHeight:Float = (40 / 100) * height;
+ var innerX:Float = (width / 2) - (innerWidth / 2) + 1 ;
+ var innerY:Float = (height / 2) - (innerHeight / 2) + 1;
+
+ graphics.lineStyle();
+ graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ //graphics.beginFill(color, 1);
+ graphics.drawRect(0, 0, 1, _height+1);
+ graphics.drawRect(0, 0, _width+1, 1);
+ graphics.drawRect(_width+1, 0, 1, _height+1);
+ graphics.drawRect(0, _height+1, _width+1, 1);
+ graphics.drawRect(innerX, innerY, innerWidth, innerHeight);
+ graphics.endFill();
+ }
+ //}
+
+ //{Setters
+ public function setNormalColor(color:UInt):Void
+ {
+ _normalColor = color;
+ draw(_normalColor);
+ }
+
+ public function setHoverColor(color:UInt):Void
+ {
+ _hoverColor = color;
+ draw(_hoverColor);
+ }
+
+ public function setPosition(x:Float, y:Float):Void
+ {
+ this.x = x;
+ this.y = y;
+
+ draw(_normalColor);
+ }
+
+ public function setSize(width:Float, height:Float):Void
+ {
+ _width = width;
+ _height = height;
+
+ draw(_normalColor);
+ }
+ //}
+}
\ No newline at end of file
diff --git a/src/jaris/player/newcontrols/FullscreenIcon.hx b/src/jaris/player/newcontrols/FullscreenIcon.hx
new file mode 100755
index 0000000..1749b02
--- /dev/null
+++ b/src/jaris/player/newcontrols/FullscreenIcon.hx
@@ -0,0 +1,130 @@
+/**
+ * @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.newcontrols;
+import flash.display.Sprite;
+import flash.events.MouseEvent;
+import flash.geom.Matrix;
+import jaris.utils.Utils;
+import flash.display.GradientType;
+
+class FullscreenIcon extends Sprite
+{
+ private var _width:Float;
+ private var _height:Float;
+ private var _normalColor:UInt;
+ private var _hoverColor:UInt;
+
+ public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
+ {
+ super();
+
+ this.x = x;
+ this.y = y;
+ this.buttonMode = true;
+ this.useHandCursor = true;
+ this.tabEnabled = false;
+
+ _width = width;
+ _height = height;
+ _normalColor = normalColor;
+ _hoverColor = hoverColor;
+
+ addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
+ addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
+
+ draw(_normalColor);
+ }
+
+ private function onMouseOver(event:MouseEvent):Void
+ {
+ draw(_hoverColor);
+ }
+
+ private function onMouseOut(event:MouseEvent):Void
+ {
+ draw(_normalColor);
+ }
+
+ //{Private Methods
+ private function draw(color:UInt):Void
+ {
+ graphics.clear();
+
+ graphics.lineStyle(0, color, 0.0);
+ graphics.beginFill(color, 0);
+ graphics.drawRect(0, 0, _width, _height);
+ graphics.endFill();
+
+ var arrowWidth = Std.int(_width / 2 * 0.8);
+
+ var matrix:Matrix = new Matrix( );
+ matrix.createGradientBox(_width, _height, Utils.degreesToRadians(-90), _width, 0);
+ var colors:Array<UInt> = [color, color];
+ var alphas:Array<Float> = [0.75, 1];
+ var ratios:Array<UInt> = [0, 255];
+
+ graphics.lineStyle(0, color, 0, true);
+ graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ //graphics.beginFill(color, 0);
+ graphics.drawRect(0, 0, arrowWidth, 2);
+ graphics.drawRect(0, 2, 2, arrowWidth-2);
+ graphics.drawRect(_width-arrowWidth+1, 0, arrowWidth, 2);
+ graphics.drawRect(_width-1, 2, 2, arrowWidth-2);
+ graphics.drawRect(0, _height-arrowWidth+2, 2, arrowWidth);
+ graphics.drawRect(2, _height, arrowWidth-2, 2);
+ graphics.drawRect(_width-1, _height-arrowWidth+2, 2, arrowWidth-2);
+ graphics.drawRect(_width-arrowWidth+1, _height, arrowWidth, 2);
+ graphics.endFill();
+ }
+ //}
+
+ //{Setters
+ public function setNormalColor(color:UInt):Void
+ {
+ _normalColor = color;
+ draw(_normalColor);
+ }
+
+ public function setHoverColor(color:UInt):Void
+ {
+ _hoverColor = color;
+ draw(_hoverColor);
+ }
+
+ public function setPosition(x:Float, y:Float):Void
+ {
+ this.x = x;
+ this.y = y;
+
+ draw(_normalColor);
+ }
+
+ public function setSize(width:Float, height:Float):Void
+ {
+ _width = width;
+ _height = height;
+
+ draw(_normalColor);
+ }
+ //}
+}
\ No newline at end of file
diff --git a/src/jaris/player/newcontrols/Loader.hx b/src/jaris/player/newcontrols/Loader.hx
new file mode 100755
index 0000000..18fb2ac
--- /dev/null
+++ b/src/jaris/player/newcontrols/Loader.hx
@@ -0,0 +1,195 @@
+/**
+ * @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.newcontrols;
+
+import flash.display.MovieClip;
+import flash.display.Sprite;
+import flash.display.Stage;
+import flash.events.Event;
+import flash.Lib;
+import flash.geom.Matrix;
+import jaris.utils.Utils;
+import flash.display.GradientType;
+
+/**
+ * Draws a loading bar
+ */
+class Loader extends Sprite
+{
+ private var _stage:Stage;
+ private var _movieClip:MovieClip;
+ private var _background:Sprite;
+ private var _loaderTrack:Sprite;
+ private var _loaderThumb:Sprite;
+ private var _visible:Bool;
+ private var _darkColor:UInt;
+ private var _controlColor:UInt;
+ private var _seekColor:UInt;
+ private var _forward:Bool;
+
+ public function new()
+ {
+ super();
+
+ _stage = Lib.current.stage;
+ _movieClip = Lib.current;
+
+ _background = new Sprite();
+ addChild(_background);
+
+ _loaderTrack = new Sprite();
+ addChild(_loaderTrack);
+
+ _loaderThumb = new Sprite();
+ addChild(_loaderThumb);
+
+ _darkColor = 0x000000;
+ _controlColor = 0xFFFFFF;
+ _seekColor = 0x747474;
+
+ _forward = true;
+ _visible = true;
+
+ addEventListener(Event.ENTER_FRAME, onEnterFrame);
+ _stage.addEventListener(Event.RESIZE, onResize);
+
+ drawLoader();
+ }
+
+ /**
+ * Animation of a thumb moving on the track
+ * @param event
+ */
+ private function onEnterFrame(event:Event):Void
+ {
+ if (_visible)
+ {
+ if (_forward)
+ {
+ if ((_loaderThumb.x + _loaderThumb.width) >= (_loaderTrack.x + _loaderTrack.width))
+ {
+ _forward = false;
+ }
+ else
+ {
+ _loaderThumb.x += 10;
+ }
+ }
+ else
+ {
+ if (_loaderThumb.x <= _loaderTrack.x)
+ {
+ _forward = true;
+ }
+ else
+ {
+ _loaderThumb.x -= 10;
+ }
+ }
+ }
+ }
+
+ /**
+ * Redraws the loader to match new stage size
+ * @param event
+ */
+ private function onResize(event:Event):Void
+ {
+ drawLoader();
+ }
+
+ /**
+ * Draw loader graphics
+ */
+ private function drawLoader():Void
+ {
+ //Clear graphics
+ _background.graphics.clear();
+ _loaderTrack.graphics.clear();
+ _loaderThumb.graphics.clear();
+
+ //Draw background
+ var backgroundWidth:Float = (65 / 100) * _stage.stageWidth;
+ var backgroundHeight:Float = 30;
+ _background.x = (_stage.stageWidth / 2) - (backgroundWidth / 2);
+ _background.y = (_stage.stageHeight / 2) - (backgroundHeight / 2);
+ _background.graphics.lineStyle();
+ _background.graphics.beginFill(_darkColor, 0.75);
+ _background.graphics.drawRoundRect(0, 0, backgroundWidth, backgroundHeight, 6, 6);
+ _background.graphics.endFill();
+
+ //Draw track
+ var trackWidth:Float = (50 / 100) * _stage.stageWidth;
+ var trackHeight:Float = 11;
+ _loaderTrack.x = (_stage.stageWidth / 2) - (trackWidth / 2);
+ _loaderTrack.y = (_stage.stageHeight / 2) - (trackHeight / 2);
+ _loaderTrack.graphics.lineStyle();
+ _loaderTrack.graphics.beginFill(_seekColor, 0.3);
+ _loaderTrack.graphics.drawRoundRect(0, trackHeight/2/2, trackWidth, trackHeight/2, 5, 5);
+
+ //Draw thumb
+ var matrix:Matrix = new Matrix( );
+ matrix.createGradientBox(trackHeight*3, trackHeight, Utils.degreesToRadians(-90), trackHeight*3, 0);
+ var colors:Array<UInt> = [_controlColor, _controlColor];
+ var alphas:Array<Float> = [0.75, 1];
+ var ratios:Array<UInt> = [0, 255];
+
+ _loaderThumb.x = _loaderTrack.x;
+ _loaderThumb.y = _loaderTrack.y;
+ _loaderThumb.graphics.lineStyle();
+ _loaderThumb.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ //_loaderThumb.graphics.beginFill(_controlColor, 1);
+ _loaderThumb.graphics.drawRoundRect(0, 0, trackHeight*3, trackHeight, 10, 10);
+ }
+
+ /**
+ * Stops drawing the loader
+ */
+ public function hide():Void
+ {
+ this.visible = false;
+ _visible = false;
+ }
+
+ /**
+ * Starts drawing the loader
+ */
+ public function show():Void
+ {
+ this.visible = true;
+ _visible = true;
+ }
+
+ /**
+ * Set loader colors
+ * @param colors
+ */
+ public function setColors(colors:Array<String>):Void
+ {
+ _darkColor = colors[0].length > 0? Std.parseInt("0x" + colors[0]) : 0x000000;
+ _controlColor = colors[1].length > 0? Std.parseInt("0x" + colors[1]) : 0xFFFFFF;
+ _seekColor = colors[2].length > 0? Std.parseInt("0x" + colors[2]) : 0x747474;
+
+ drawLoader();
+ }
+}
\ No newline at end of file
diff --git a/src/jaris/player/controls/Controls.hx b/src/jaris/player/newcontrols/NewControls.hx
old mode 100644
new mode 100755
similarity index 76%
copy from src/jaris/player/controls/Controls.hx
copy to src/jaris/player/newcontrols/NewControls.hx
index bd05525..e3493bc
--- a/src/jaris/player/controls/Controls.hx
+++ b/src/jaris/player/newcontrols/NewControls.hx
@@ -20,7 +20,7 @@
* see <http://www.gnu.org/licenses/>.
*/
-package jaris.player.controls;
+package jaris.player.newcontrols;
//{Libraries
import flash.display.GradientType;
@@ -38,13 +38,13 @@ import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.utils.Timer;
import jaris.animation.Animation;
-import jaris.display.Loader;
import jaris.events.PlayerEvents;
-import jaris.player.controls.AspectRatioIcon;
-import jaris.player.controls.FullscreenIcon;
-import jaris.player.controls.PauseIcon;
-import jaris.player.controls.PlayIcon;
-import jaris.player.controls.VolumeIcon;
+import jaris.player.newcontrols.Loader;
+import jaris.player.newcontrols.AspectRatioIcon;
+import jaris.player.newcontrols.FullscreenIcon;
+import jaris.player.newcontrols.PauseIcon;
+import jaris.player.newcontrols.PlayIcon;
+import jaris.player.newcontrols.VolumeIcon;
import jaris.player.Player;
import flash.display.Sprite;
import flash.display.Stage;
@@ -54,7 +54,7 @@ import jaris.utils.Utils;
/**
* Default controls for jaris player
*/
-class Controls extends MovieClip {
+class NewControls extends MovieClip {
//{Member Variables
private var _thumb:Sprite;
@@ -66,7 +66,9 @@ class Controls extends MovieClip {
private var _player:Player;
private var _darkColor:UInt;
private var _brightColor:UInt;
+ private var _seekColor:UInt;
private var _controlColor:UInt;
+ private var _controlSize:Int;
private var _hoverColor:UInt;
private var _hideControlsTimer:Timer;
private var _hideAspectRatioLabelTimer:Timer;
@@ -104,6 +106,8 @@ class Controls extends MovieClip {
_brightColor = 0x4c4c4c;
_controlColor = 0xFFFFFF;
_hoverColor = 0x67A8C1;
+ _seekColor = 0x7c7c7c;
+ _controlSize = 40;
_percentLoaded = 0.0;
_hideControlsTimer = new Timer(500);
_hideAspectRatioLabelTimer = new Timer(500);
@@ -115,9 +119,42 @@ class Controls extends MovieClip {
_textFormat.size = 14;
//}
+ //{Playing controls initialization
+ _controlsBar = new Sprite();
+ _controlsBar.visible = true;
+ addChild(_controlsBar);
+
+ _playControl = new PlayIcon(0, 0, 0, 0, _controlColor, _hoverColor);
+ _controlsBar.addChild(_playControl);
+
+ _pauseControl = new PauseIcon(0, 0, 0, 0, _controlColor, _hoverColor);
+ _pauseControl.visible = false;
+ _controlsBar.addChild(_pauseControl);
+
+ _aspectRatioControl = new AspectRatioIcon(0, 0, 0, 0, _controlColor, _hoverColor);
+ _controlsBar.addChild(_aspectRatioControl);
+
+ _fullscreenControl = new FullscreenIcon(0, 0, 0, 0, _controlColor, _hoverColor);
+ _controlsBar.addChild(_fullscreenControl);
+
+ _volumeIcon = new VolumeIcon(0, 0, 0, 0, _controlColor, _hoverColor);
+ _controlsBar.addChild(_volumeIcon);
+
+ _volumeSlider = new Sprite();
+ _volumeSlider.visible = false;
+ _controlsBar.addChild(_volumeSlider);
+
+ _volumeTrack = new Sprite();
+ _volumeTrack.visible = false;
+ _volumeTrack.buttonMode = true;
+ _volumeTrack.useHandCursor = true;
+ _volumeTrack.tabEnabled = false;
+ _controlsBar.addChild(_volumeTrack);
+ //}
+
//{Seeking Controls initialization
_seekBar = new Sprite();
- addChild(_seekBar);
+ _controlsBar.addChild(_seekBar);
_trackDownloaded = new Sprite( );
_trackDownloaded.tabEnabled = false;
@@ -129,7 +166,6 @@ class Controls extends MovieClip {
_track.useHandCursor = true;
_seekBar.addChild(_track);
-
_thumb = new Sprite( );
_thumb.buttonMode = true;
_thumb.useHandCursor = true;
@@ -159,37 +195,6 @@ class Controls extends MovieClip {
addChild(_seekPlayTimeLabel);
//}
- //{Playing controls initialization
- _controlsBar = new Sprite();
- _controlsBar.visible = true;
- addChild(_controlsBar);
-
- _playControl = new PlayIcon(0, 0, 0, 0, _controlColor, _hoverColor);
- _controlsBar.addChild(_playControl);
-
- _pauseControl = new PauseIcon(0, 0, 0, 0, _controlColor, _hoverColor);
- _pauseControl.visible = false;
- _controlsBar.addChild(_pauseControl);
-
- _aspectRatioControl = new AspectRatioIcon(0, 0, 0, 0, _controlColor, _hoverColor);
- _controlsBar.addChild(_aspectRatioControl);
-
- _fullscreenControl = new FullscreenIcon(0, 0, 0, 0, _controlColor, _hoverColor);
- _controlsBar.addChild(_fullscreenControl);
-
- _volumeIcon = new VolumeIcon(0, 0, 0, 0, _controlColor, _hoverColor);
- _controlsBar.addChild(_volumeIcon);
-
- _volumeSlider = new Sprite();
- _controlsBar.addChild(_volumeSlider);
-
- _volumeTrack = new Sprite();
- _volumeTrack.buttonMode = true;
- _volumeTrack.useHandCursor = true;
- _volumeTrack.tabEnabled = false;
- _controlsBar.addChild(_volumeTrack);
- //}
-
//{Aspect ratio label
_aspectRatioLabelContainer = new Sprite();
addChild(_aspectRatioLabelContainer);
@@ -208,8 +213,9 @@ class Controls extends MovieClip {
_loader.hide();
var loaderColors:Array <String> = ["", "", "", ""];
- loaderColors[0] = Std.string(_brightColor);
+ loaderColors[0] = Std.string(_darkColor);
loaderColors[1] = Std.string(_controlColor);
+ loaderColors[2] = Std.string(_seekColor);
_loader.setColors(loaderColors);
@@ -402,7 +408,13 @@ class Controls extends MovieClip {
*/
private function onVolumeIconClick(event: MouseEvent):Void
{
- _player.toggleMute();
+ if (_volumeSlider.visible) {
+ _volumeSlider.visible = false;
+ _volumeTrack.visible = false;
+ } else {
+ _volumeSlider.visible = true;
+ _volumeTrack.visible = true;
+ }
}
/**
@@ -459,7 +471,7 @@ class Controls extends MovieClip {
//wait till fade out finishes
}
- Animation.fadeIn(_aspectRatioLabelContainer, 300);
+ Animation.fadeIn(_aspectRatioLabelContainer, 1);
_hideAspectRatioLabelTimer.start();
}
@@ -491,16 +503,6 @@ class Controls extends MovieClip {
*/
private function onPlayerResize(event:PlayerEvents):Void
{
- if (!_player.isFullscreen())
- {
- if (_player.getVideo().y + _player.getVideo().height >= _stage.stageHeight)
- {
- _player.getVideo().height = _stage.stageHeight - _seekBar.height;
- _player.getVideo().width = _player.getVideo().height * _player.getAspectRatio();
-
- _player.getVideo().x = (_stage.stageWidth / 2) - (_player.getVideo().width / 2);
- }
- }
}
/**
@@ -522,9 +524,9 @@ class Controls extends MovieClip {
*/
private function onPlayerMouseHide(event:PlayerEvents):Void
{
- if (_seekBar.visible && _player.isFullscreen())
+ if (_controlsBar.visible && _player.isFullscreen())
{
- Animation.slideOut(_seekBar, "bottom", 1000);
+ hideControls();
}
}
@@ -536,13 +538,13 @@ class Controls extends MovieClip {
{
//Only use slidein effect on fullscreen since switching to windowed mode on
//hardware scaling causes a bug by a slow response on stage height changes
- if (_player.isFullscreen() && !_seekBar.visible)
+ if (_player.isFullscreen() && !_controlsBar.visible)
{
- Animation.slideIn(_seekBar, "bottom",1000);
+ _controlsBar.visible = true;
}
- else
+ else if (!_controlsBar.visible)
{
- _seekBar.visible = true;
+ _controlsBar.visible = true;
}
}
@@ -567,9 +569,8 @@ class Controls extends MovieClip {
_seekPlayTimeLabel.setTextFormat(_textFormat);
_seekPlayTimeLabel.y = _stage.stageHeight - _seekBar.height - _seekPlayTimeLabel.height - 1;
- _seekPlayTimeLabel.x = clickPosition + (_seekPlayTimeLabel.width / 2);
-
- _seekPlayTimeLabel.backgroundColor = _brightColor;
+ _seekPlayTimeLabel.x = clickPosition + (_seekPlayTimeLabel.width / 2) + (_playControl.width + 10) * 2;
+ _seekPlayTimeLabel.backgroundColor = _darkColor;
_seekPlayTimeLabel.background = true;
_seekPlayTimeLabel.textColor = _controlColor;
_seekPlayTimeLabel.borderColor = _darkColor;
@@ -577,7 +578,7 @@ class Controls extends MovieClip {
if (!_seekPlayTimeLabel.visible)
{
- Animation.fadeIn(_seekPlayTimeLabel, 300);
+ _seekPlayTimeLabel.visible = true;
}
}
@@ -587,7 +588,7 @@ class Controls extends MovieClip {
*/
private function onTrackMouseOut(event:MouseEvent):Void
{
- Animation.fadeOut(_seekPlayTimeLabel, 300);
+ _seekPlayTimeLabel.visible = false;
}
/**
@@ -609,7 +610,7 @@ class Controls extends MovieClip {
{
_thumb.graphics.lineStyle();
_thumb.graphics.beginFill(_hoverColor);
- _thumb.graphics.drawRect(0, (_seekBar.height/2)-(10/2), 10, 10);
+ _thumb.graphics.drawRoundRect(0, (_seekBar.height/2)-(11/2), 11, 11, 10, 10);
_thumb.graphics.endFill();
}
@@ -619,9 +620,14 @@ class Controls extends MovieClip {
*/
private function onThumbMouseOut(event:MouseEvent):Void
{
- _thumb.graphics.lineStyle();
- _thumb.graphics.beginFill(_controlColor);
- _thumb.graphics.drawRect(0, (_seekBar.height/2)-(10/2), 10, 10);
+ var matrix:Matrix = new Matrix( );
+ matrix.createGradientBox(11, 11, Utils.degreesToRadians(-90), 11, 0);
+ var colors:Array<UInt> = [_controlColor, _controlColor];
+ var alphas:Array<Float> = [0.75, 1];
+ var ratios:Array<UInt> = [0, 255];
+
+ _thumb.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ _thumb.graphics.drawRoundRect(0, (_seekBar.height / 2) - (11 / 2), 11, 11, 10, 10);
_thumb.graphics.endFill();
}
@@ -643,8 +649,7 @@ class Controls extends MovieClip {
*/
private function redrawControls():Void
{
- drawSeekControls();
- drawPlayingControls();
+ drawControls();
drawAspectRatioLabel();
}
@@ -662,44 +667,84 @@ class Controls extends MovieClip {
}
var position:Float = _player.getStartTime() / _player.getDuration();
- var startPosition:Float = (position * _track.width) + _track.x;
+ var startPosition:Float = (position > 0?(position * _track.width):0) + _track.x;
_trackDownloaded.graphics.clear();
_trackDownloaded.graphics.lineStyle();
_trackDownloaded.x = startPosition;
- _trackDownloaded.graphics.beginFill(_brightColor, 0xFFFFFF);
- _trackDownloaded.graphics.drawRect(0, (_seekBar.height / 2) - (10 / 2), ((_track.width + _track.x) - _trackDownloaded.x) * _percentLoaded, 10);
+ _trackDownloaded.graphics.beginFill(_seekColor, 0.5);
+ _trackDownloaded.graphics.drawRoundRect(0, (_seekBar.height / 2) - (5 / 2), ((_track.width + _track.x) - _trackDownloaded.x) * _percentLoaded, 5, 3, 3);
_trackDownloaded.graphics.endFill();
}
/**
- * Draws all seekbar controls
+ * Draws NEW control bar player/seek controls
*/
- private function drawSeekControls()
+ private function drawControls():Void
{
//Reset sprites for redraw
+ _controlsBar.graphics.clear();
+ _volumeTrack.graphics.clear();
+ _volumeSlider.graphics.clear();
+ _volumeSlider.visible = false;
+ _volumeTrack.visible = false;
+
+ //Reset sprites for redraw
_seekBar.graphics.clear();
_track.graphics.clear();
_thumb.graphics.clear();
- //Draw seek bar
- var _seekBarWidth:UInt = _stage.stageWidth;
- var _seekBarHeight:UInt = 25;
- _seekBar.x = 0;
- _seekBar.y = _stage.stageHeight - _seekBarHeight;
+ //Draw controls bar
+ var barMargin = 10;
+ var barWidth = _stage.stageWidth;
+ var barHeight = _controlSize;
+ var barCenter = barWidth / 2;
+ var buttonSize = Std.int(((80 / 100) * (barHeight - (barMargin*2))));
+
+ _controlsBar.x = 0;
+ _controlsBar.y = (_stage.stageHeight - barHeight);
+
var matrix:Matrix = new Matrix( );
- matrix.createGradientBox(_seekBarWidth, _seekBarHeight, Utils.degreesToRadians(90), 0, 0);
+ matrix.createGradientBox(barWidth, barHeight, Utils.degreesToRadians(-90), barWidth, 0);
var colors:Array<UInt> = [_brightColor, _darkColor];
- var alphas:Array<UInt> = [1, 1];
+ var alphas:Array<Float> = [1.0, 1];
var ratios:Array<UInt> = [0, 255];
+ _controlsBar.graphics.lineStyle();
+ _controlsBar.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ _controlsBar.graphics.drawRect(0, 2, barWidth, barHeight-2);
+ _controlsBar.graphics.endFill();
+ _controlsBar.graphics.beginFill(_darkColor, 1);
+ _controlsBar.graphics.drawRect(0, 0, barWidth, 1);
+ _controlsBar.graphics.endFill();
+ _controlsBar.graphics.beginFill(_brightColor, 1);
+ _controlsBar.graphics.drawRect(0, 1, barWidth, 1);
+ _controlsBar.graphics.endFill();
+
+ //Draw seek bar
+ var _seekBarWidth = barWidth - (buttonSize+barMargin)*3 - (_playControl.x + _playControl.width + barMargin) - barMargin;
+ var _seekBarHeight = barHeight;
+ _seekBar.x = _playControl.x + _playControl.width + barMargin;
+ _seekBar.y = 0;
_seekBar.graphics.lineStyle();
- _seekBar.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ _seekBar.graphics.beginFill(_darkColor, 0);
_seekBar.graphics.drawRect(0, 0, _seekBarWidth, _seekBarHeight);
_seekBar.graphics.endFill();
- _textFormat.color = _controlColor;
+ //Draw playbutton
+ _playControl.setNormalColor(_controlColor);
+ _playControl.setHoverColor(_hoverColor);
+ _playControl.setPosition(barMargin, barMargin);
+ _playControl.setSize(buttonSize+5, buttonSize+5);
+ //Draw pausebutton
+ _pauseControl.setNormalColor(_controlColor);
+ _pauseControl.setHoverColor(_hoverColor);
+ _pauseControl.setPosition(_playControl.x, _playControl.y);
+ _pauseControl.setSize(buttonSize+5, buttonSize+5);
+
//Draw current play time label
+ _textFormat.color = _seekColor;
+ _currentPlayTimeLabel.x = 0;
_currentPlayTimeLabel.y = _seekBarHeight - (_seekBarHeight / 2) - (_currentPlayTimeLabel.height / 2);
_currentPlayTimeLabel.antiAliasType = AntiAliasType.ADVANCED;
_currentPlayTimeLabel.setTextFormat(_textFormat);
@@ -714,96 +759,69 @@ class Controls extends MovieClip {
drawDownloadProgress();
//Draw track place holder for drag
- _track.x = _currentPlayTimeLabel.width;
- _track.graphics.lineStyle(1, _controlColor);
- _track.graphics.beginFill(_darkColor, 0);
- _track.graphics.drawRect(0, (_seekBarHeight / 2) - (10 / 2), _seekBarWidth - _currentPlayTimeLabel.width - _totalPlayTimeLabel.width, 10);
+ _track.x = _currentPlayTimeLabel.x + _currentPlayTimeLabel.width + barMargin;
+ _track.graphics.lineStyle();
+ _track.graphics.beginFill(_seekColor, 0);
+ _track.graphics.drawRect(0, (_seekBarHeight / 2) - ((buttonSize+barMargin) / 2), _totalPlayTimeLabel.x - _totalPlayTimeLabel.width - barMargin - barMargin, buttonSize + barMargin);
_track.graphics.endFill();
- //Draw thumb
- _thumb.x = _currentPlayTimeLabel.width;
- _thumb.graphics.lineStyle();
- _thumb.graphics.beginFill(_controlColor);
- _thumb.graphics.drawRect(0, (_seekBarHeight/2)-(10/2), 10, 10);
- _thumb.graphics.endFill();
- }
-
- /**
- * Draws control bar player controls
- */
- private function drawPlayingControls():Void
- {
- //Reset sprites for redraw
- _controlsBar.graphics.clear();
- _volumeTrack.graphics.clear();
- _volumeSlider.graphics.clear();
-
- //Draw controls bar
- var barMargin = _stage.stageHeight < 330 ? 5 : 25;
- var barHeight = _stage.stageHeight - _seekBar.height - (barMargin * 2);
- var barWidth = _stage.stageHeight < 330 ? 45 : 60;
- _controlsBar.x = (_stage.stageWidth - barWidth) + 20;
- _controlsBar.y = barMargin;
+ _track.graphics.lineStyle();
+ _track.graphics.beginFill(_seekColor, 0.3);
+ _track.graphics.drawRoundRect(0, (_seekBarHeight / 2) - (5 / 2), _totalPlayTimeLabel.x - _totalPlayTimeLabel.width - barMargin - barMargin, 5, 3, 3);
+ _track.graphics.endFill();
+ //Draw thumb
var matrix:Matrix = new Matrix( );
- matrix.createGradientBox(barWidth, barHeight, Utils.degreesToRadians(0), 0, barHeight);
- var colors:Array<UInt> = [_brightColor, _darkColor];
- var alphas:Array<Float> = [0.75, 0.75];
+ matrix.createGradientBox(11, 11, Utils.degreesToRadians(-90), 11, 0);
+ var colors:Array<UInt> = [_controlColor, _controlColor];
+ var alphas:Array<Float> = [0.75, 1];
var ratios:Array<UInt> = [0, 255];
- _controlsBar.graphics.lineStyle();
- _controlsBar.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
- _controlsBar.graphics.drawRoundRect(0, 0, barWidth, barHeight, 20, 20);
- _controlsBar.graphics.endFill();
- var topMargin:Float = _stage.stageHeight < 330 ? 5 : 10;
- var barCenter:Float = (barWidth - 20) / 2;
- var buttonSize:Float = ((80 / 100) * (barWidth - 20));
- var buttonX:Float = buttonSize / 2;
-
- //Draw playbutton
- _playControl.setNormalColor(_controlColor);
- _playControl.setHoverColor(_hoverColor);
- _playControl.setPosition(barCenter - buttonX, topMargin);
- _playControl.setSize(buttonSize, buttonSize);
+ _thumb.x = _currentPlayTimeLabel.width + _currentPlayTimeLabel.x + barMargin;
+ _thumb.graphics.lineStyle();
+ _thumb.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ //_thumb.graphics.beginFill(_controlColor);
+ _thumb.graphics.drawRoundRect(0, (_seekBarHeight/2)-(11/2), 11, 11, 10, 10);
+ _thumb.graphics.endFill();
- //Draw pausebutton
- _pauseControl.setNormalColor(_controlColor);
- _pauseControl.setHoverColor(_hoverColor);
- _pauseControl.setPosition(_playControl.x, topMargin);
- _pauseControl.setSize(buttonSize, buttonSize);
+ //Draw volume icon
+ _volumeIcon.setNormalColor(_controlColor);
+ _volumeIcon.setHoverColor(_hoverColor);
+ _volumeIcon.setPosition(_seekBar.x + _seekBar.width + barMargin, _playControl.y+1);
+ _volumeIcon.setSize(buttonSize, buttonSize);
//Draw aspec ratio button
_aspectRatioControl.setNormalColor(_controlColor);
_aspectRatioControl.setHoverColor(_hoverColor);
- _aspectRatioControl.setPosition(_playControl.x, (_playControl.y + buttonSize) + topMargin);
+ _aspectRatioControl.setPosition(_volumeIcon.x + _volumeIcon.width + barMargin, _playControl.y+1);
_aspectRatioControl.setSize(buttonSize, buttonSize);
//Draw fullscreen button
_fullscreenControl.setNormalColor(_controlColor);
_fullscreenControl.setHoverColor(_hoverColor);
- _fullscreenControl.setPosition(_playControl.x, (_aspectRatioControl.y + _aspectRatioControl.height) + topMargin);
+ _fullscreenControl.setPosition(_aspectRatioControl.x + _aspectRatioControl.width + barMargin, _playControl.y+1);
_fullscreenControl.setSize(buttonSize, buttonSize);
- //Draw volume icon
- _volumeIcon.setNormalColor(_controlColor);
- _volumeIcon.setHoverColor(_hoverColor);
- _volumeIcon.setPosition(_playControl.x, barHeight - _playControl.height - topMargin);
- _volumeIcon.setSize(buttonSize, buttonSize);
-
//Draw volume track
- _volumeTrack.x = _playControl.x;
- _volumeTrack.y = (_fullscreenControl.y + _fullscreenControl.height) + topMargin;
+ _volumeTrack.x = _controlsBar.width-(buttonSize+barMargin)*3;
+ _volumeTrack.y = -_controlsBar.height-2;
_volumeTrack.graphics.lineStyle(1, _controlColor);
_volumeTrack.graphics.beginFill(0x000000, 0);
- _volumeTrack.graphics.drawRect(0, 0, _playControl.width / 2, _volumeIcon.y - (_fullscreenControl.y + _fullscreenControl.height) - (topMargin*2));
+ _volumeTrack.graphics.drawRect(0, 0, buttonSize, _controlsBar.height);
_volumeTrack.graphics.endFill();
- _volumeTrack.x = barCenter - (_volumeTrack.width / 2);
//Draw volume slider
+ var matrix:Matrix = new Matrix( );
+ matrix.createGradientBox(_volumeTrack.width, _volumeTrack.height, Utils.degreesToRadians(-90), _volumeTrack.width, 0);
+ var colors:Array<UInt> = [_hoverColor, _hoverColor];
+ var alphas:Array<Float> = [0.75, 1];
+ var ratios:Array<UInt> = [0, 255];
+
_volumeSlider.x = _volumeTrack.x;
_volumeSlider.y = _volumeTrack.y;
_volumeSlider.graphics.lineStyle();
- _volumeSlider.graphics.beginFill(_controlColor, 1);
+ _volumeSlider.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ //_volumeSlider.graphics.beginFill(_hoverColor, 1);
_volumeSlider.graphics.drawRect(0, 0, _volumeTrack.width, _volumeTrack.height);
_volumeSlider.graphics.endFill();
@@ -828,8 +846,8 @@ class Controls extends MovieClip {
//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.lineStyle(0, _darkColor);
+ _aspectRatioLabelContainer.graphics.beginFill(_darkColor, 1);
_aspectRatioLabelContainer.graphics.drawRoundRect(0, 0, _aspectRatioLabel.width + 20, _aspectRatioLabel.height + 20, 15, 15);
_aspectRatioLabelContainer.graphics.endFill();
@@ -847,8 +865,8 @@ class Controls extends MovieClip {
{
if(_controlsBar.visible)
{
- drawPlayingControls();
- Animation.slideOut(_controlsBar, "right", 800);
+ drawControls();
+ Animation.slideOut(_controlsBar, "bottom", 800);
}
}
@@ -859,8 +877,8 @@ class Controls extends MovieClip {
{
if(!_controlsBar.visible)
{
- drawPlayingControls();
- Animation.slideIn(_controlsBar, "right", 800);
+ drawControls();
+ _controlsBar.visible = true;
}
}
//}
@@ -877,16 +895,32 @@ class Controls extends MovieClip {
_brightColor = colors[1].length > 0? Std.parseInt("0x" + colors[1]) : 0x4c4c4c;
_controlColor = colors[2].length > 0? Std.parseInt("0x" + colors[2]) : 0xFFFFFF;
_hoverColor = colors[3].length > 0? Std.parseInt("0x" + colors[3]) : 0x67A8C1;
+ _seekColor = colors[4].length > 0? Std.parseInt("0x" + colors[4]) : 0x7c7c7c;
+
var loaderColors:Array <String> = ["", ""];
- loaderColors[0] = colors[1];
+ loaderColors[0] = colors[0];
loaderColors[1] = colors[2];
+ loaderColors[2] = colors[4];
_loader.setColors(loaderColors);
redrawControls();
}
/**
+ * Sets the player controls size (height)
+ * @param size int: for e.g. 50
+ */
+ public function setControlSize(size:Int):Void
+ {
+ if (size == 0)
+ return;
+
+ _controlSize = size;
+ redrawControls();
+ }
+
+ /**
* To set the duration label when autostart parameter is false
* @param duration in seconds or formatted string in format hh:mm:ss
*/
diff --git a/src/jaris/player/newcontrols/PauseIcon.hx b/src/jaris/player/newcontrols/PauseIcon.hx
new file mode 100755
index 0000000..c0b8343
--- /dev/null
+++ b/src/jaris/player/newcontrols/PauseIcon.hx
@@ -0,0 +1,127 @@
+/**
+ * @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.newcontrols;
+import flash.display.Sprite;
+import flash.events.MouseEvent;
+import flash.geom.Matrix;
+import jaris.utils.Utils;
+import flash.display.GradientType;
+
+class PauseIcon extends Sprite
+{
+ private var _width:Float;
+ private var _height:Float;
+ private var _normalColor:UInt;
+ private var _hoverColor:UInt;
+
+ public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
+ {
+ super();
+
+ this.x = x;
+ this.y = y;
+ this.buttonMode = true;
+ this.useHandCursor = true;
+ this.tabEnabled = false;
+
+ _width = width;
+ _height = height;
+ _normalColor = normalColor;
+ _hoverColor = hoverColor;
+
+ addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
+ addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
+
+ draw(_normalColor);
+ }
+
+ private function onMouseOver(event:MouseEvent):Void
+ {
+ draw(_hoverColor);
+ }
+
+ private function onMouseOut(event:MouseEvent):Void
+ {
+ draw(_normalColor);
+ }
+
+ //{Private Methods
+ private function draw(color:UInt):Void
+ {
+ graphics.clear();
+
+ graphics.lineStyle(0, color, 0.0);
+ graphics.beginFill(color, 0);
+ graphics.drawRect(0, 0, _width, _height);
+ graphics.endFill();
+
+ var matrix:Matrix = new Matrix( );
+ matrix.createGradientBox(_width, _height, Utils.degreesToRadians(-90), _width, 0);
+ var colors:Array<UInt> = [color, color];
+ var alphas:Array<Float> = [0.75, 1];
+ var ratios:Array<UInt> = [0, 255];
+
+ graphics.lineStyle();
+ graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ //graphics.beginFill(color);
+ graphics.drawRoundRect(0, 0, (33 / 100) * _width, _height, 6, 6);
+ graphics.drawRoundRect(_width - ((33 / 100) * _width), 0, (33 / 100) * _width, _height, 6, 6);
+ graphics.endFill();
+
+ graphics.lineStyle();
+ graphics.beginFill(color, 0);
+ graphics.drawRect(0, 0, _width, _height);
+ graphics.endFill();
+ }
+ //}
+
+ //{Setters
+ public function setNormalColor(color:UInt):Void
+ {
+ _normalColor = color;
+ draw(_normalColor);
+ }
+
+ public function setHoverColor(color:UInt):Void
+ {
+ _hoverColor = color;
+ draw(_hoverColor);
+ }
+
+ public function setPosition(x:Float, y:Float):Void
+ {
+ this.x = x;
+ this.y = y;
+
+ draw(_normalColor);
+ }
+
+ public function setSize(width:Float, height:Float):Void
+ {
+ _width = width;
+ _height = height;
+
+ draw(_normalColor);
+ }
+ //}
+}
\ No newline at end of file
diff --git a/src/jaris/player/newcontrols/PlayIcon.hx b/src/jaris/player/newcontrols/PlayIcon.hx
new file mode 100755
index 0000000..9059215
--- /dev/null
+++ b/src/jaris/player/newcontrols/PlayIcon.hx
@@ -0,0 +1,122 @@
+/**
+ * @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.newcontrols;
+import flash.display.Sprite;
+import flash.events.MouseEvent;
+import flash.geom.Matrix;
+import jaris.utils.Utils;
+import flash.display.GradientType;
+
+class PlayIcon extends Sprite
+{
+ private var _width:Float;
+ private var _height:Float;
+ private var _normalColor:UInt;
+ private var _hoverColor:UInt;
+
+ public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
+ {
+ super();
+
+ this.x = x;
+ this.y = y;
+ this.buttonMode = true;
+ this.useHandCursor = true;
+ this.tabEnabled = false;
+
+ _width = width;
+ _height = height;
+ _normalColor = normalColor;
+ _hoverColor = hoverColor;
+
+ addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
+ addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
+
+ draw(_normalColor);
+ }
+
+ private function onMouseOver(event:MouseEvent):Void
+ {
+ draw(_hoverColor);
+ }
+
+ private function onMouseOut(event:MouseEvent):Void
+ {
+ draw(_normalColor);
+ }
+
+ //{Private Methods
+ private function draw(color:UInt):Void
+ {
+ graphics.clear();
+ graphics.lineStyle(0, color, 0.0);
+ graphics.beginFill(color, 0);
+ graphics.drawRect(0, 0, _width, _height);
+ graphics.endFill();
+
+ var matrix:Matrix = new Matrix( );
+ matrix.createGradientBox(_width, _height, Utils.degreesToRadians(-90), _width, 0);
+ var colors:Array<UInt> = [color, color];
+ var alphas:Array<Float> = [0.75, 1];
+ var ratios:Array<UInt> = [0, 255];
+
+ graphics.lineStyle();
+ graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ //graphics.beginFill(color);
+ graphics.lineTo(0, _height);
+ graphics.lineTo(_width, _height / 2);
+ graphics.lineTo(0, 0);
+ graphics.endFill();
+ }
+ //}
+
+ //{Setters
+ public function setNormalColor(color:UInt):Void
+ {
+ _normalColor = color;
+ draw(_normalColor);
+ }
+
+ public function setHoverColor(color:UInt):Void
+ {
+ _hoverColor = color;
+ draw(_hoverColor);
+ }
+
+ public function setPosition(x:Float, y:Float):Void
+ {
+ this.x = x;
+ this.y = y;
+
+ draw(_normalColor);
+ }
+
+ public function setSize(width:Float, height:Float):Void
+ {
+ _width = width;
+ _height = height;
+
+ draw(_normalColor);
+ }
+ //}
+}
\ No newline at end of file
diff --git a/src/jaris/player/newcontrols/VolumeIcon.hx b/src/jaris/player/newcontrols/VolumeIcon.hx
new file mode 100755
index 0000000..c263ecf
--- /dev/null
+++ b/src/jaris/player/newcontrols/VolumeIcon.hx
@@ -0,0 +1,125 @@
+/**
+ * @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.newcontrols;
+import flash.display.Sprite;
+import flash.events.MouseEvent;
+import flash.geom.Matrix;
+import jaris.utils.Utils;
+import flash.display.GradientType;
+
+class VolumeIcon extends Sprite
+{
+ private var _width:Float;
+ private var _height:Float;
+ private var _normalColor:UInt;
+ private var _hoverColor:UInt;
+
+ public function new(x:Float, y:Float, width:Float, height:Float, normalColor:UInt, hoverColor:UInt)
+ {
+ super();
+
+ this.x = x;
+ this.y = y;
+ this.buttonMode = true;
+ this.useHandCursor = true;
+ this.tabEnabled = false;
+
+ _width = width;
+ _height = height;
+ _normalColor = normalColor;
+ _hoverColor = hoverColor;
+
+ addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
+ addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
+
+ draw(_normalColor);
+ }
+
+ private function onMouseOver(event:MouseEvent):Void
+ {
+ draw(_hoverColor);
+ }
+
+ private function onMouseOut(event:MouseEvent):Void
+ {
+ draw(_normalColor);
+ }
+
+ //{Private Methods
+ private function draw(color:UInt):Void
+ {
+ graphics.clear();
+
+ graphics.lineStyle(0, color, 0.0);
+ graphics.beginFill(color, 0);
+ graphics.drawRect(0, 0, _width, _height);
+ graphics.endFill();
+
+ var matrix:Matrix = new Matrix( );
+ matrix.createGradientBox(_width, _height, Utils.degreesToRadians(-90), _width, 0);
+ var colors:Array<UInt> = [color, color];
+ var alphas:Array<Float> = [0.75, 1];
+ var ratios:Array<UInt> = [0, 255];
+
+ graphics.lineStyle();
+ graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+ //graphics.beginFill(color, 1);
+ graphics.drawRect(0, ((50 / 100) * _height) / 2+1, _width / 2-1, ((50 / 100) * _height));
+ graphics.moveTo(_width / 2 -1, ((50 / 100) * _height)/2+1);
+ graphics.lineTo(_width, 0);
+ graphics.lineTo(_width, _height+2);
+ graphics.lineTo(_width / 2 -1, ((50 / 100) * _height) + (((50 / 100) * _height) / 2)+1);
+ graphics.endFill();
+ }
+ //}
+
+ //{Setters
+ public function setNormalColor(color:UInt):Void
+ {
+ _normalColor = color;
+ draw(_normalColor);
+ }
+
+ public function setHoverColor(color:UInt):Void
+ {
+ _hoverColor = color;
+ draw(_hoverColor);
+ }
+
+ public function setPosition(x:Float, y:Float):Void
+ {
+ this.x = x;
+ this.y = y;
+
+ draw(_normalColor);
+ }
+
+ public function setSize(width:Float, height:Float):Void
+ {
+ _width = width;
+ _height = height;
+
+ draw(_normalColor);
+ }
+ //}
+}
\ 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