[Pkg-javascript-commits] [jarisplayer] 03/80: mp3 support and other improvements
Jonas Smedegaard
dr at jones.dk
Tue May 10 08:45:30 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 d3e03b344fc4843dd1fa95410de0abf3213dcd62
Author: jgmylm <jgmylm at edf201c3-a14d-0410-a11e-aa85364efa9f>
Date: Tue Mar 9 04:57:51 2010 +0000
mp3 support and other improvements
git-svn-id: https://jaris.svn.sourceforge.net/svnroot/jaris/trunk@3 edf201c3-a14d-0410-a11e-aa85364efa9f
---
bin/JarisFLVPlayer.swf | Bin 16949 -> 18733 bytes
bin/index.html | 45 ++-
bin/jaris-intro.mp4 | Bin 2908604 -> 0 bytes
changes.txt | 36 ++
documentation.txt | 127 +++++++
readme.txt | 32 +-
src/jaris/Main.hx | 44 ++-
src/jaris/Version.hx | 28 +-
src/jaris/animation/Animation.hx | 21 +-
src/jaris/animation/AnimationsBase.hx | 21 +-
src/jaris/display/Loader.hx | 84 +++--
src/jaris/display/Logo.hx | 21 +-
src/jaris/display/Menu.hx | 52 ++-
src/jaris/display/Poster.hx | 27 +-
src/jaris/events/PlayerEvents.hx | 21 +-
src/jaris/player/AspectRatio.hx | 21 +-
src/jaris/player/Player.hx | 473 +++++++++++++++++++++++----
src/jaris/player/StreamType.hx | 21 +-
src/jaris/player/controls/AspectRatioIcon.hx | 119 +++++++
src/jaris/player/{ => controls}/Controls.hx | 310 ++++++------------
src/jaris/player/controls/FullscreenIcon.hx | 114 +++++++
src/jaris/player/controls/PauseIcon.hx | 112 +++++++
src/jaris/player/controls/PlayIcon.hx | 107 ++++++
src/jaris/player/controls/VolumeIcon.hx | 110 +++++++
src/jaris/utils/Utils.hx | 37 ++-
25 files changed, 1607 insertions(+), 376 deletions(-)
diff --git a/bin/JarisFLVPlayer.swf b/bin/JarisFLVPlayer.swf
index 8bfe04d..52f863e 100644
Binary files a/bin/JarisFLVPlayer.swf and b/bin/JarisFLVPlayer.swf differ
diff --git a/bin/index.html b/bin/index.html
index dd62cb1..bd49bb0 100644
--- a/bin/index.html
+++ b/bin/index.html
@@ -9,12 +9,32 @@
<script src="js/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">
- var flashvars = {
- file: "jaris-intro.mp4",
+ var flashvarsVideo = {
+ file: "http://jaris.sourceforge.net/files/jaris-intro.flv",
+ type: "video",
streamtype: "file",
- poster: "poster.png",
+ duration: "52",
+ poster: "http://jaris.sourceforge.net/images/poster.png",
autostart: "false",
- logo: "logo.png",
+ 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"
+ };
+ var flashvarsAudio = {
+ file: "http://jaris.sourceforge.net/files/audio.mp3",
+ type: "audio",
+ streamtype: "file",
+ duration: "00:04:25",
+ 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",
@@ -37,7 +57,8 @@
var attributes = {
id:"JarisFLVPlayer"
};
- swfobject.embedSWF("JarisFLVPlayer.swf", "altContent", "640px", "360px", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
+ swfobject.embedSWF("JarisFLVPlayer.swf", "altContentOne", "576px", "360px", "10.0.0", "expressInstall.swf", flashvarsVideo, params, attributes);
+ swfobject.embedSWF("JarisFLVPlayer.swf", "altContentTwo", "576px", "360px", "10.0.0", "expressInstall.swf", flashvarsAudio, params, attributes);
</script>
<style>
html, body { height:100%; }
@@ -47,7 +68,19 @@
<body>
<br />
<center>
- <div id="altContent">
+ <h1>Video Example</h1>
+ <div id="altContentOne">
+ <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>
<p>Alternative content</p>
<p><a href="http://www.adobe.com/go/getflashplayer"><img
diff --git a/bin/jaris-intro.mp4 b/bin/jaris-intro.mp4
deleted file mode 100644
index 8ad9ecb..0000000
Binary files a/bin/jaris-intro.mp4 and /dev/null differ
diff --git a/changes.txt b/changes.txt
new file mode 100644
index 0000000..f5d02d1
--- /dev/null
+++ b/changes.txt
@@ -0,0 +1,36 @@
+Jaris FLV Player v2.0.1 beta - 03/08/2010
+
+ * Toggle Quality on Context Menu
+ * Initial mp3 support
+ * Loader fixes
+ * Controls fixes
+ * Other refinements and fixes
+ * Duration parameter to indicate how much total time takes input media
+
+Jaris FLV Player v2.0.0 beta - 03/05/2010
+
+ * Moved from swishmax 2 to haxe and flashdevelop
+ * New GUI completely written in haxe (AS3)
+ * Hide controls on fullscreen
+ * Recalculate aspect ratio on fullscreen.
+ * Redraw controls on fullscreen and normal switching.
+ * Initial pseudo streaming support
+ * Compiled to flash 10
+ * Now uses as3 libraries
+ * Optional Hardware scaling
+ * Video smoothing enabled by default
+ * Added custom context menu
+ * Other refinements and fixes
+
+Jaris FLV Player v1.0 - 05/21/2008
+
+ * Calculates video aspect ratio on player load.
+ * Support Flash 9 Stage.displayState (Fullscreen mode).
+ * Support for preview image of the video.
+ * Display buffering message.
+ * Internal volume control.
+ * Back and forward control.
+ * Display the actual playing time and total time.
+ * Support for logo image on the fly.
+ * Flag to autostart the video on player load.
+
diff --git a/documentation.txt b/documentation.txt
new file mode 100644
index 0000000..e04f6c8
--- /dev/null
+++ b/documentation.txt
@@ -0,0 +1,127 @@
+==================
+How To!
+==================
+
+The above example is one of the ways to embed the player to your html files. Just copy and paste.
+
+---------------------------------------Code------------------------------------------
+<object
+ classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
+ codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,45,2"
+ width="640" height="360"
+>
+ <param name="allowFullscreen" value="true">
+ <param name="allowScriptAccess" value="always">
+ <param name="movie" value="JarisFLVPlayer.swf">
+ <param name="bgcolor" value="#000000">
+ <param name="quality" value="high">
+ <param name="scale" value="noscale">
+ <param name="wmode" value="opaque">
+ <param name="flashvars" value="file=jaris-intro.mp4&type=video&streamtype=file&poster=poster.png&autostart=false&logo=logo.png&logoposition=top left&logoalpha=30&logowidth=130&logolink=http://jaris.sourceforge.net&hardwarescaling=false&darkcolor=000000&brightcolor=4c4c4c&controlcolor=FFFFFF&hovercolor=67A8C1">
+ <param name="seamlesstabbing" value="false">
+ <embed
+ type="application/x-shockwave-flash"
+ pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
+ width="640" height="360"
+ src="JarisFLVPlayer.swf"
+ allowfullscreen="true"
+ allowscriptaccess="always"
+ bgcolor="#000000"
+ quality="high"
+ scale="noscale"
+ wmode="opaque"
+ flashvars="file=jaris-intro.mp4&type=video&streamtype=file&poster=poster.png&autostart=false&logo=logo.png&logoposition=top left&logoalpha=30&logowidth=130&logolink=http://jaris.sourceforge.net&hardwarescaling=false&darkcolor=000000&brightcolor=4c4c4c&controlcolor=FFFFFF&hovercolor=67A8C1"
+ seamlesstabbing="false"
+ >
+ <noembed>
+ </noembed>
+ </embed>
+</object>
+--------------------------------------End-Code---------------------------------------
+
+==================
+Flash Variables
+==================
+
+Here is the list of variables that you can pass to the player.
+
+ * file:
+ This is the actual file that is going to be played.
+
+ * type:
+ The type of file to play, allowable values are: audio, video.
+
+ * streamtype:
+ The stream type of the file, allowable values are: file, http (for pseudostream) and soon rmtp.
+
+ * duration:
+ Total times in seconds for input media or formatted string in the format hh:mm:ss
+
+ * poster:
+ Screenshot of the video that is displayed before playing.
+
+ * autostart:
+ A true or false value that indicates to the player if it should auto play the video on load.
+
+ * logo:
+ An image of your logo.
+
+ * logoposition:
+ The position of the logo in the player, permitted values are: top left, top right, bottom left and bottom right
+
+ * logoalpha:
+ The transparency percent. values permitted 1 to 100
+
+ * logowidth:
+ The width in pixels of the logo.
+
+ * logolink:
+ A link to a webpage when the logo is clicked.
+
+ * hardwarescaling:
+ Enable or disable hardware scaling on fullscreen mode, values: false or true
+
+ * logoalpha:
+ The transparency percent. values permitted 1 to 100
+
+ * darkcolor:
+ The darker color of player controls
+
+ * brightcolor:
+ The bright color of player controls
+
+ * controlcolor:
+ The face color of controls
+
+ * hovercolor:
+ On mouse hover color for controls
+
+==================
+Keyboard Shortcuts
+==================
+
+Here is the list of keyboard shortcuts to control Jaris Player.
+
+ * SPACE
+ Play or pause video.
+
+ * TAB
+ Switch between different aspect ratios.
+
+ * UP
+ Raise volume
+
+ * DOWN
+ Lower volume
+
+ * LEFT
+ Rewind
+
+ * RIGHT
+ Forward
+
+ * M
+ Mute or unmute volume.
+
+ * F
+ Swtich to fullscreen mode.
\ No newline at end of file
diff --git a/readme.txt b/readme.txt
index 234cbcc..bd797e3 100644
--- a/readme.txt
+++ b/readme.txt
@@ -21,22 +21,32 @@ Thats the story of how Jaris was born.
Features
==================
- * Keeps video Aspect Ratio
- * Fullscreen Support
- * Video Thumbnail
- * Volume Control
- * Seek Control
- * Time Display
- * Your own Logo
+
+ * Aspect ratio switcher
+ * Fullscreen support
+ * Http pseudostreaming support
+ * Poster image
+ * Volume control
+ * Seek control
+ * Display time
+ * Use your own logo
+ * Add a link to your logo
+ * Change position of logo
+ * Hide controls on fullscreen
+ * Custom control colors
+ * Hardware scaling
+ * Keyboard shortcuts
+ * Mp3 support
+
==================
License
==================
-Jaris is licensed under GPL and LGPL, meaning that you could use it for commercial use.
-What we ask for is that any improvements made to the player should be taken over here so
-that any one could enjoy the new improvements or features also. In this way everyone could
+Jaris is licensed under GPL and LGPL, meaning that you could use it commercially.
+What we ask for is that any improvements made to the player should be taken back to jaris flv website
+so that any one could enjoy the new improvements or features also. In this way everyone could
help to maintain an up to date tool that adapts to todays multimedia demands.
-Using sourceforge.net you could send a patch https://sourceforge.net/projects/jaris/.
+Using sourceforge.net you could send a patch http://sourceforge.net/projects/jaris/.
Enjoy a totally free player ;-)
\ No newline at end of file
diff --git a/src/jaris/Main.hx b/src/jaris/Main.hx
index c46514c..ac3e7a3 100644
--- a/src/jaris/Main.hx
+++ b/src/jaris/Main.hx
@@ -1,9 +1,26 @@
-/**
- * ...
+/**
* @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;
import flash.display.Stage;
@@ -11,11 +28,11 @@ import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.Lib;
import flash.system.Capabilities;
-import jaris.display.Loader;
import jaris.display.Logo;
import jaris.display.Menu;
import jaris.display.Poster;
-import jaris.player.Controls;
+import jaris.player.controls.Controls;
+import jaris.player.InputType;
import jaris.player.Player;
import jaris.player.StreamType;
@@ -45,18 +62,20 @@ class Main
var player:Player = new Player();
if (Capabilities.playerType == "PlugIn" || Capabilities.playerType == "ActiveX")
{
- var autoStart:Bool = parameters.autostart == "true" || parameters.autostart == ""? true: false;
- var streamType:String = parameters.streamtype != ""? parameters.streamtype : StreamType.FILE;
+ var autoStart:Bool = parameters.autostart == "true" || parameters.autostart == "" || parameters.autostart == null? true: false;
+ var type:String = parameters.type != "" && parameters.type != null? parameters.type : InputType.VIDEO;
+ var streamType:String = parameters.streamtype != "" && parameters.streamtype != null? parameters.streamtype : StreamType.FILE;
+ player.setType(type);
player.setStreamType(streamType);
if (autoStart)
{
- player.load(parameters.file);
+ player.load(parameters.file, type, streamType);
}
else
{
- player.setVideoSource(parameters.file);
+ player.setSource(parameters.file);
}
player.setPoster(posterImage);
@@ -64,8 +83,9 @@ class Main
}
else
{
- //For development purpose
- player.load("jaris-intro.mp4");
+ //For development purposes
+ 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);
}
//Modify Context Menu
@@ -84,6 +104,7 @@ class Main
//Draw Controls
+ var duration:String = parameters.duration != "" && parameters.duration != null? parameters.duration : "0";
var controls:Controls = new Controls(player);
var controlColors:Array <String> = ["", "", "", ""];
@@ -93,6 +114,7 @@ class Main
controlColors[3] = parameters.hovercolor != null ? parameters.hovercolor : "";
controls.setControlColors(controlColors);
+ controls.setDurationLabel(duration);
movieClip.addChild(controls);
}
diff --git a/src/jaris/Version.hx b/src/jaris/Version.hx
index 75509a4..c7198d4 100644
--- a/src/jaris/Version.hx
+++ b/src/jaris/Version.hx
@@ -1,17 +1,35 @@
-/**
- * ...
+/**
* @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;
/**
- * Actual jaris player version and date
+ * Actual jaris flv player version and date
*/
class Version
{
- public static var NUMBER:String = "2.0";
- public static var DATE:String = "05";
+ public static var NUMBER:String = "2.0.1";
+ public static var STATUS:String = "beta";
+ public static var DATE:String = "08";
public static var MONTH:String = "03";
public static var YEAR:String = "2010";
}
\ No newline at end of file
diff --git a/src/jaris/animation/Animation.hx b/src/jaris/animation/Animation.hx
index d422d56..9494a4c 100644
--- a/src/jaris/animation/Animation.hx
+++ b/src/jaris/animation/Animation.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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.animation;
diff --git a/src/jaris/animation/AnimationsBase.hx b/src/jaris/animation/AnimationsBase.hx
index afe4499..775e7f1 100644
--- a/src/jaris/animation/AnimationsBase.hx
+++ b/src/jaris/animation/AnimationsBase.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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.animation;
diff --git a/src/jaris/display/Loader.hx b/src/jaris/display/Loader.hx
index 42451f2..4254538 100644
--- a/src/jaris/display/Loader.hx
+++ b/src/jaris/display/Loader.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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.display;
@@ -21,10 +38,9 @@ class Loader extends Sprite
private var _background:Sprite;
private var _loaderTrack:Sprite;
private var _loaderThumb:Sprite;
-
+ private var _visible:Bool;
private var _brightColor:UInt;
private var _controlColor:UInt;
-
private var _forward:Bool;
public function new()
@@ -47,6 +63,7 @@ class Loader extends Sprite
_controlColor = 0xFFFFFF;
_forward = true;
+ _visible = true;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
_stage.addEventListener(Event.RESIZE, onResize);
@@ -60,26 +77,29 @@ class Loader extends Sprite
*/
private function onEnterFrame(event:Event):Void
{
- if (_forward)
- {
- if ((_loaderThumb.x + _loaderThumb.width) >= (_loaderTrack.x + _loaderTrack.width))
- {
- _forward = false;
- }
- else
- {
- _loaderThumb.x += 10;
- }
- }
- else
+ if (_visible)
{
- if (_loaderThumb.x <= _loaderTrack.x)
+ if (_forward)
{
- _forward = true;
+ if ((_loaderThumb.x + _loaderThumb.width) >= (_loaderTrack.x + _loaderTrack.width))
+ {
+ _forward = false;
+ }
+ else
+ {
+ _loaderThumb.x += 10;
+ }
}
else
{
- _loaderThumb.x -= 10;
+ if (_loaderThumb.x <= _loaderTrack.x)
+ {
+ _forward = true;
+ }
+ else
+ {
+ _loaderThumb.x -= 10;
+ }
}
}
}
@@ -104,9 +124,13 @@ class Loader extends Sprite
_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(_brightColor, 0.5);
- _background.graphics.drawRect(0, 0, _stage.stageWidth, _stage.stageHeight);
+ _background.graphics.drawRoundRect(0, 0, backgroundWidth, backgroundHeight, 6, 6);
_background.graphics.endFill();
//Draw track
@@ -126,13 +150,31 @@ class Loader extends Sprite
}
/**
+ * 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
{
_brightColor = colors[0].length > 0? Std.parseInt("0x" + colors[0]) : 0x4c4c4c;
- _controlColor = colors[0].length > 0? Std.parseInt("0x" + colors[0]) : 0xFFFFFF;
+ _controlColor = colors[1].length > 0? Std.parseInt("0x" + colors[1]) : 0xFFFFFF;
drawLoader();
}
diff --git a/src/jaris/display/Logo.hx b/src/jaris/display/Logo.hx
index 4f7df11..3351143 100644
--- a/src/jaris/display/Logo.hx
+++ b/src/jaris/display/Logo.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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.display;
diff --git a/src/jaris/display/Menu.hx b/src/jaris/display/Menu.hx
index 6e63f9e..e9f3835 100644
--- a/src/jaris/display/Menu.hx
+++ b/src/jaris/display/Menu.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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.display;
@@ -30,18 +47,21 @@ class Menu
private var _muteMenuItem:ContextMenuItem;
private var _volumeUpMenuItem:ContextMenuItem;
private var _volumeDownMenuItem:ContextMenuItem;
+ private var _qualityContextMenu:ContextMenuItem;
public function new(player:Player)
{
_movieClip = Lib.current;
_player = player;
-
+
+ //Initialize context menu replacement
_contextMenu = new ContextMenu();
_contextMenu.hideBuiltInItems();
_contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, onMenuOpen);
- _jarisVersionMenuItem = new ContextMenuItem("Jaris Player v" + Version.NUMBER, true, true, true);
+ //Initialize each menu item
+ _jarisVersionMenuItem = new ContextMenuItem("Jaris Player v" + Version.NUMBER + " " + Version.STATUS, true, true, true);
_jarisVersionMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onJarisVersion);
_playMenuItem = new ContextMenuItem("Play (SPACE)", true, true, true);
@@ -62,6 +82,10 @@ class Menu
_volumeDownMenuItem = new ContextMenuItem("Volume - (arrow DOWN)");
_volumeDownMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onVolumeDown);
+ _qualityContextMenu = new ContextMenuItem("Lower Quality", true, true, true);
+ _qualityContextMenu.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onQuality);
+
+ //add all context menu items to context menu object
_contextMenu.customItems.push(_jarisVersionMenuItem);
_contextMenu.customItems.push(_playMenuItem);
_contextMenu.customItems.push(_fullscreenMenuItem);
@@ -69,7 +93,9 @@ class Menu
_contextMenu.customItems.push(_muteMenuItem);
_contextMenu.customItems.push(_volumeUpMenuItem);
_contextMenu.customItems.push(_volumeDownMenuItem);
+ _contextMenu.customItems.push(_qualityContextMenu);
+ //override default context menu
_movieClip.contextMenu = _contextMenu;
}
@@ -135,6 +161,15 @@ class Menu
case AspectRatio._16_10:
_aspectRatioMenuItem.caption = "Aspect Ratio (original) (TAB)";
}
+
+ if (_player.getQuality())
+ {
+ _qualityContextMenu.caption = "Lower Quality";
+ }
+ else
+ {
+ _qualityContextMenu.caption = "Higher Quality";
+ }
}
/**
@@ -199,4 +234,13 @@ class Menu
{
_player.volumeDown();
}
+
+ /**
+ * Toggle video quality
+ * @param event
+ */
+ private function onQuality(event:ContextMenuEvent)
+ {
+ _player.toggleQuality();
+ }
}
\ No newline at end of file
diff --git a/src/jaris/display/Poster.hx b/src/jaris/display/Poster.hx
index de8056a..dcd3f65 100644
--- a/src/jaris/display/Poster.hx
+++ b/src/jaris/display/Poster.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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.display;
@@ -49,6 +66,7 @@ class Poster extends Sprite
loaderColors[1] = parameters.controlcolor != null ? parameters.controlcolor : "";
_loaderStatus = new jaris.display.Loader();
+ _loaderStatus.show();
_loaderStatus.setColors(loaderColors);
addChild(_loaderStatus);
@@ -63,7 +81,8 @@ class Poster extends Sprite
*/
private function onNotLoaded(event:IOErrorEvent):Void
{
- //Image not loaded
+ _loaderStatus.hide();
+ removeChild(_loaderStatus);
}
/**
@@ -72,7 +91,7 @@ class Poster extends Sprite
*/
private function onLoaderComplete(event:Event):Void
{
- _loaderStatus.visible = false;
+ _loaderStatus.hide();
removeChild(_loaderStatus);
addChild(_loader);
diff --git a/src/jaris/events/PlayerEvents.hx b/src/jaris/events/PlayerEvents.hx
index f50b3ba..1ca4799 100644
--- a/src/jaris/events/PlayerEvents.hx
+++ b/src/jaris/events/PlayerEvents.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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.events;
diff --git a/src/jaris/player/AspectRatio.hx b/src/jaris/player/AspectRatio.hx
index 350b26d..a26712f 100644
--- a/src/jaris/player/AspectRatio.hx
+++ b/src/jaris/player/AspectRatio.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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;
diff --git a/src/jaris/player/Player.hx b/src/jaris/player/Player.hx
index 570a5ca..00201b2 100644
--- a/src/jaris/player/Player.hx
+++ b/src/jaris/player/Player.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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;
@@ -11,16 +28,21 @@ import flash.display.Stage;
import flash.display.StageDisplayState;
import flash.events.Event;
import flash.events.FullScreenEvent;
+import flash.events.IOErrorEvent;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.events.NetStatusEvent;
+import flash.events.ProgressEvent;
import flash.events.TimerEvent;
import flash.geom.Rectangle;
import flash.Lib;
+import flash.media.Sound;
+import flash.media.SoundChannel;
import flash.media.SoundTransform;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
+import flash.net.URLRequest;
import flash.system.Capabilities;
import flash.ui.Keyboard;
import flash.ui.Mouse;
@@ -38,33 +60,37 @@ class Player
private var _movieClip:MovieClip;
private var _connection:NetConnection;
private var _stream:NetStream;
- private var _video:Video;
private var _fullscreen:Bool;
private var _soundMuted:Bool;
private var _volume:Float;
private var _mouseVisible:Bool;
- private var _videoLoaded:Bool;
+ private var _mediaLoaded:Bool;
private var _hideMouseTimer:Timer;
- private var _videoSource:String;
+ private var _checkAudioTimer:Timer;
+ private var _mediaSource:String;
+ private var _type:String;
private var _streamType:String;
- private var _videoServer:String; //For future use on rtmp
+ private var _server:String; //For future use on rtmp
+ private var _sound:Sound;
+ private var _soundChannel:SoundChannel;
+ private var _video:Video;
private var _videoWidth:Float;
private var _videoHeight:Float;
- private var _videoDuration:Float;
private var _videoMask:Sprite;
+ private var _videoQualityHigh:Bool;
+ private var _mediaDuration:Float;
private var _isPlaying:Bool;
private var _eventListeners:Dynamic;
private var _eventCount:UInt;
private var _playerEvent:PlayerEvents;
private var _aspectRatio:Float;
private var _originalAspectRatio:Float;
- private var _videoEndReached:Bool;
+ private var _mediaEndReached:Bool;
private var _seekPoints:Array<Float>;
private var _downloadCompleted:Bool;
private var _startTime:Float;
private var _firstLoad:Bool;
private var _stopped:Bool;
- private var _videoQualityHigh:Bool;
private var _useHardWareScaling:Bool;
private var _poster:Poster;
//}
@@ -80,8 +106,9 @@ class Player
_soundMuted = false;
_volume = 1.0;
_fullscreen = false;
- _videoLoaded = false;
+ _mediaLoaded = false;
_hideMouseTimer = new Timer(1500);
+ _checkAudioTimer = new Timer(100);
_eventListeners = new Array();
_eventCount = 0;
_playerEvent = new PlayerEvents();
@@ -93,6 +120,17 @@ class Player
_videoQualityHigh = false;
_isPlaying = false;
_streamType = StreamType.FILE;
+ _type = InputType.VIDEO;
+ _server = "";
+ //}
+
+ //{Initialize sound object
+ _sound = new Sound();
+ _sound.addEventListener(Event.COMPLETE, onSoundComplete);
+ _sound.addEventListener(Event.ID3, onSoundID3);
+ _sound.addEventListener(IOErrorEvent.IO_ERROR, onSoundIOError);
+ _sound.addEventListener(ProgressEvent.PROGRESS, onSoundProgress);
+
//}
//{Initialize video and connection objets
@@ -118,6 +156,7 @@ class Player
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
_stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullScreen);
_hideMouseTimer.addEventListener(TimerEvent.TIMER, hideMouseTimer);
+ _checkAudioTimer.addEventListener(TimerEvent.TIMER, checkAudioTimer);
_stream.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
//}
}
@@ -145,6 +184,22 @@ class Player
}
}
}
+
+ /**
+ * To check if the sound finished playing
+ * @param event
+ */
+ private function checkAudioTimer(event:TimerEvent):Void
+ {
+ if (_soundChannel.position + 100 >= _sound.length)
+ {
+ _isPlaying = false;
+ _mediaEndReached = true;
+ callEvents(PlayerEvents.PLAYBACK_FINISHED);
+
+ _checkAudioTimer.stop();
+ }
+ }
//}
@@ -161,25 +216,25 @@ class Player
callEvents(PlayerEvents.CONNECTION_SUCCESS);
case "NetStream.Play.StreamNotFound":
- trace("Stream not found: " + _videoSource);
+ trace("Stream not found: " + _mediaSource);
callEvents(PlayerEvents.CONNECTION_FAILED);
case "NetStream.Play.Stop":
if (_isPlaying) { _stream.togglePause(); }
_isPlaying = false;
- _videoEndReached = true;
+ _mediaEndReached = true;
callEvents(PlayerEvents.PLAYBACK_FINISHED);
case "NetStream.Play.Start":
_isPlaying = true;
- _videoEndReached = false;
+ _mediaEndReached = false;
if (_stream.bytesLoaded != _stream.bytesTotal)
{
callEvents(PlayerEvents.BUFFERING);
}
case "NetStream.Seek.Notify":
- _videoEndReached = false;
+ _mediaEndReached = false;
case "NetStream.Buffer.Empty":
if (_stream.bytesLoaded != _stream.bytesTotal)
@@ -287,7 +342,7 @@ class Player
_hideMouseTimer.start();
//If browser player resume playing
- if ((Capabilities.playerType == "ActiveX" || Capabilities.playerType == "PlugIn") && isPlaying())
+ if ((Capabilities.playerType == "ActiveX" || Capabilities.playerType == "PlugIn"))
{
togglePlay();
}
@@ -352,12 +407,12 @@ class Player
}
}
- _videoLoaded = true;
- _videoDuration = data.duration;
+ _mediaLoaded = true;
+ _mediaDuration = data.duration;
_aspectRatio = AspectRatio.getAspectRatio(_videoWidth, _videoHeight);
_originalAspectRatio = _aspectRatio;
- _playerEvent.duration = _videoDuration;
+ _playerEvent.duration = _mediaDuration;
_playerEvent.width = _videoWidth;
_playerEvent.height = _videoHeight;
_playerEvent.aspectRatio = _aspectRatio;
@@ -374,7 +429,87 @@ class Player
*/
private function onLastSecond(data:Dynamic):Void
{
+ //To work on it?
+ }
+
+ /**
+ * When sound finished downloading
+ * @param event
+ */
+ private function onSoundComplete(event:Event)
+ {
+ _mediaDuration = _sound.length / 1000;
+ _playerEvent.duration = _sound.length / 1000;
+ _downloadCompleted = true;
+
+ callEvents(PlayerEvents.META_RECIEVED);
+ }
+
+ /**
+ * Mimic stream onMetaData
+ * @param event
+ */
+ private function onSoundID3(event:Event)
+ {
+ if (_firstLoad)
+ {
+ _soundChannel = _sound.play();
+ _checkAudioTimer.start();
+
+ _isPlaying = true;
+
+ if (_poster != null)
+ {
+ _videoWidth = _poster.width;
+ _videoHeight = _poster.height;
+ }
+
+ _firstLoad = false;
+
+ _mediaLoaded = true;
+ _mediaDuration = ((_sound.bytesTotal / _sound.bytesLoaded) * _sound.length) / 1000;
+ _aspectRatio = AspectRatio.getAspectRatio(_videoWidth, _videoHeight);
+ _originalAspectRatio = _aspectRatio;
+
+ _playerEvent.duration = _mediaDuration;
+ _playerEvent.width = _videoWidth;
+ _playerEvent.height = _videoHeight;
+ _playerEvent.aspectRatio = _aspectRatio;
+
+ callEvents(PlayerEvents.CONNECTION_SUCCESS);
+ callEvents(PlayerEvents.META_RECIEVED);
+
+ resizeAndCenterPlayer();
+ }
+ }
+
+ /**
+ * Dispatch connection failed event on error
+ * @param event
+ */
+ private function onSoundIOError(event:IOErrorEvent)
+ {
+ callEvents(PlayerEvents.CONNECTION_FAILED);
+ }
+
+ /**
+ * Monitor sound download progress
+ * @param event
+ */
+ private function onSoundProgress(event:ProgressEvent)
+ {
+ if (_sound.isBuffering)
+ {
+ callEvents(PlayerEvents.BUFFERING);
+ }
+ else
+ {
+ callEvents(PlayerEvents.NOT_BUFFERING);
+ }
+ _mediaDuration = ((_sound.bytesTotal / _sound.bytesLoaded) * _sound.length) / 1000;
+ _playerEvent.duration = _mediaDuration;
+ callEvents(PlayerEvents.META_RECIEVED);
}
//}
@@ -459,9 +594,12 @@ class Player
*/
private function canSeek(time:Float):Bool
{
- time = getBestSeekPoint(time);
+ if (_type == InputType.VIDEO)
+ {
+ time = getBestSeekPoint(time);
+ }
- var cacheTotal = Math.floor((getDuration() - _startTime) * (_stream.bytesLoaded / _stream.bytesTotal)) - 1;
+ var cacheTotal = Math.floor((getDuration() - _startTime) * (getBytesLoaded() / getBytesTotal())) - 1;
if(time >= _startTime && time < _startTime + cacheTotal)
{
@@ -490,21 +628,31 @@ class Player
* Loads a video and starts playing it
* @param video video url to load
*/
- public function load(video:String, server:String=""):Void
+ public function load(source:String, type:String="video", streamType:String="file", server:String=""):Void
{
+ _type = type;
+ _streamType = streamType;
+ _mediaSource = source;
_stopped = false;
- _videoSource = video;
- _videoLoaded = false;
+ _mediaLoaded = false;
_firstLoad = true;
_startTime = 0;
_downloadCompleted = false;
_seekPoints = new Array();
+ _server = server;
callEvents(PlayerEvents.BUFFERING);
- _stream.bufferTime = 10;
- _stream.play(video);
- _stream.client = this;
+ if (_type == InputType.VIDEO)
+ {
+ _stream.bufferTime = 10;
+ _stream.play(source);
+ _stream.client = this;
+ }
+ else if(_type == InputType.AUDIO && _streamType == StreamType.FILE)
+ {
+ _sound.load(new URLRequest(source));
+ }
}
/**
@@ -512,12 +660,21 @@ class Player
*/
public function stopAndClose():Void
{
- _videoLoaded = false;
+ _mediaLoaded = false;
_isPlaying = false;
_stopped = true;
_startTime = 0;
_poster.visible = true;
- _stream.close();
+
+ if (_type == InputType.VIDEO)
+ {
+ _stream.close();
+ }
+ else
+ {
+ _soundChannel.stop();
+ _sound.close();
+ }
}
/**
@@ -561,7 +718,19 @@ class Player
{
if (_startTime <= 1 && _downloadCompleted)
{
- _stream.seek(seekTime);
+ if (_type == InputType.VIDEO)
+ {
+ _stream.seek(seekTime);
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ _soundChannel.stop();
+ _soundChannel = _sound.play(seekTime * 1000);
+ if (!_isPlaying)
+ {
+ _soundChannel.stop();
+ }
+ }
}
else if(_seekPoints.length > 0 && _streamType == StreamType.PSEUDOSTREAM)
{
@@ -574,13 +743,13 @@ class Player
else if(seekTime != _startTime)
{
var url:String;
- if (_videoSource.indexOf("?") != -1)
+ if (_mediaSource.indexOf("?") != -1)
{
- url = _videoSource + "&start=" + seekTime;
+ url = _mediaSource + "&start=" + seekTime;
}
else
{
- url = _videoSource + "?start=" + seekTime;
+ url = _mediaSource + "?start=" + seekTime;
}
_startTime = seekTime;
@@ -589,8 +758,20 @@ class Player
}
else if(canSeek(seekTime))
{
- seekTime = getBestSeekPoint(seekTime);
- _stream.seek(seekTime);
+ if (_type == InputType.VIDEO)
+ {
+ seekTime = getBestSeekPoint(seekTime);
+ _stream.seek(seekTime);
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ _soundChannel.stop();
+ _soundChannel = _sound.play(seekTime * 1000);
+ if (!_isPlaying)
+ {
+ _soundChannel.stop();
+ }
+ }
}
return seekTime;
@@ -606,7 +787,7 @@ class Player
}
/**
- * Cycle betewen aspect rations
+ * Cycle betewen aspect ratios
* @return new aspect ratio in use
*/
public function toggleAspectRatio():Float
@@ -654,30 +835,61 @@ class Player
*/
public function togglePlay():Bool
{
- if (_videoLoaded)
+ if (_mediaLoaded)
{
- if (_videoEndReached)
+ if (_mediaEndReached)
{
- _videoEndReached = false;
- _stream.seek(0);
- _stream.togglePause();
+ _mediaEndReached = false;
+
+ if (_type == InputType.VIDEO)
+ {
+ _stream.seek(0);
+ _stream.togglePause();
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ _checkAudioTimer.start();
+ _soundChannel = _sound.play();
+ }
}
- else if (_videoLoaded)
+ else if (_mediaLoaded)
{
- _stream.togglePause();
+ if (_type == InputType.VIDEO)
+ {
+ _stream.togglePause();
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ if (_isPlaying)
+ {
+ _soundChannel.stop();
+ }
+ else
+ {
+ //If end of audio reached start from beggining
+ if (_soundChannel.position + 100 >= _sound.length)
+ {
+ _soundChannel = _sound.play();
+ }
+ else
+ {
+ _soundChannel = _sound.play(_soundChannel.position);
+ }
+ }
+ }
}
else if (_stopped)
{
- load(_videoSource);
+ load(_mediaSource, _type, _streamType, _server);
}
_isPlaying = !_isPlaying;
return _isPlaying;
}
- else if(_videoSource != "")
+ else if(_mediaSource != "")
{
- load(_videoSource);
+ load(_mediaSource, _type, _streamType, _server);
return true;
}
@@ -746,6 +958,7 @@ class Player
public function toggleMute():Bool
{
var soundTransform:SoundTransform = new SoundTransform();
+ var isMute:Bool;
//unmute sound
if (_soundMuted)
@@ -764,7 +977,7 @@ class Player
_stream.soundTransform = soundTransform;
- return false;
+ isMute = false;
}
//mute sound
@@ -775,8 +988,19 @@ class Player
soundTransform.volume = 0;
_stream.soundTransform = soundTransform;
- return true;
+ isMute = true;
}
+
+ if (_type == InputType.VIDEO)
+ {
+ _stream.soundTransform = soundTransform;
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ _soundChannel.soundTransform = soundTransform;
+ }
+
+ return isMute;
}
/**
@@ -804,9 +1028,18 @@ class Player
//raise volume if not already at max
if (_volume < 1)
{
- _volume = _stream.soundTransform.volume + (10/100);
- soundTransform.volume = _volume;
- _stream.soundTransform = soundTransform;
+ if (_type == InputType.VIDEO)
+ {
+ _volume = _stream.soundTransform.volume + (10/100);
+ soundTransform.volume = _volume;
+ _stream.soundTransform = soundTransform;
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ _volume = _soundChannel.soundTransform.volume + (10/100);
+ soundTransform.volume = _volume;
+ _soundChannel.soundTransform = soundTransform;
+ }
}
//reset volume to 1.0 if already reached max
@@ -828,10 +1061,19 @@ class Player
//lower sound
if(!_soundMuted)
- {
- _volume = _stream.soundTransform.volume - (10/100);
- soundTransform.volume = _volume;
- _stream.soundTransform = soundTransform;
+ {
+ if (_type == InputType.VIDEO)
+ {
+ _volume = _stream.soundTransform.volume - (10/100);
+ soundTransform.volume = _volume;
+ _stream.soundTransform = soundTransform;
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ _volume = _soundChannel.soundTransform.volume - (10/100);
+ soundTransform.volume = _volume;
+ _soundChannel.soundTransform = soundTransform;
+ }
//if volume reached min is muted
if (_volume <= 0)
@@ -848,6 +1090,15 @@ class Player
//{Setters
/**
+ * Set input type
+ * @param type Allowable values are audio, video
+ */
+ public function setType(type:String):Void
+ {
+ _type = type;
+ }
+
+ /**
* Set streaming type
* @param streamType Allowable values are file, http, rmtp
*/
@@ -870,9 +1121,9 @@ class Player
* media is loaded automatically
* @param source
*/
- public function setVideoSource(source):Void
+ public function setSource(source):Void
{
- _videoSource = source;
+ _mediaSource = source;
}
/**
@@ -895,7 +1146,15 @@ class Player
}
soundTransform.volume = volume;
- _stream.soundTransform = soundTransform;
+
+ if (_type == InputType.VIDEO)
+ {
+ _stream.soundTransform = soundTransform;
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ _soundChannel.soundTransform = soundTransform;
+ }
}
/**
@@ -927,7 +1186,18 @@ class Player
*/
public function getTime():Float
{
- return _stream.time;
+ var time:Float = 0;
+
+ if(_type == InputType.VIDEO)
+ {
+ time = _stream.time;
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ time = _soundChannel.position / 1000;
+ }
+
+ return time;
}
/**
@@ -958,21 +1228,12 @@ class Player
}
/**
- * The stream associated with the player
- * @return netstream object
- */
- public function getNetStream():NetStream
- {
- return _stream;
- }
-
- /**
* Total duration time of the loaded media
* @return time in seconds
*/
public function getDuration():Float
{
- return _videoDuration;
+ return _mediaDuration;
}
/**
@@ -985,6 +1246,15 @@ class Player
}
/**
+ * The stream associated with the player
+ * @return netstream object
+ */
+ public function getNetStream():NetStream
+ {
+ return _stream;
+ }
+
+ /**
* Video object associated to the player
* @return video object for further manipulation
*/
@@ -994,6 +1264,15 @@ class Player
}
/**
+ * Sound object associated to the player
+ * @return sound object for further manipulation
+ */
+ public function getSound():Sound
+ {
+ return _sound;
+ }
+
+ /**
* The current sound state
* @return true if mute otherwise false
*/
@@ -1001,5 +1280,63 @@ class Player
{
return _soundMuted;
}
+
+ /**
+ * The amount of total bytes
+ * @return amount of bytes
+ */
+ public function getBytesTotal():Float
+ {
+ var bytesTotal:Float = 0;
+
+ if (_type == InputType.VIDEO)
+ {
+ bytesTotal = _stream.bytesTotal;
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ bytesTotal = _sound.bytesTotal;
+ }
+
+ return bytesTotal;
+ }
+
+ /**
+ * The amount of bytes loaded
+ * @return amount of bytes
+ */
+ public function getBytesLoaded():Float
+ {
+ var bytesLoaded:Float = 0;
+
+ if (_type == InputType.VIDEO)
+ {
+ bytesLoaded = _stream.bytesLoaded;
+ }
+ else if (_type == InputType.AUDIO)
+ {
+ bytesLoaded = _sound.bytesLoaded;
+ }
+
+ return bytesLoaded;
+ }
+
+ /**
+ * Current playing file type
+ * @return audio or video
+ */
+ public function getType():String
+ {
+ return _type;
+ }
+
+ /**
+ * To check current quality mode
+ * @return true if high quality false if low
+ */
+ public function getQuality():Bool
+ {
+ return _videoQualityHigh;
+ }
//}
}
\ No newline at end of file
diff --git a/src/jaris/player/StreamType.hx b/src/jaris/player/StreamType.hx
index 1c98b70..00cd7d9 100644
--- a/src/jaris/player/StreamType.hx
+++ b/src/jaris/player/StreamType.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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;
diff --git a/src/jaris/player/controls/AspectRatioIcon.hx b/src/jaris/player/controls/AspectRatioIcon.hx
new file mode 100644
index 0000000..d05d5fa
--- /dev/null
+++ b/src/jaris/player/controls/AspectRatioIcon.hx
@@ -0,0 +1,119 @@
+/**
+ * @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.controls;
+import flash.display.Sprite;
+import flash.events.MouseEvent;
+
+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(2, color);
+ graphics.drawRect(0, 0, _width, _height);
+
+ var innerWidth:Float = (60 / 100) * width;
+ var innerHeight:Float = (60 / 100) * height;
+ var innerX:Float = (width / 2) - (innerWidth / 2) - 1;
+ var innerY:Float = (height / 2) - (innerHeight / 2) - 1;
+
+ graphics.lineStyle();
+ graphics.beginFill(color, 1);
+ graphics.drawRect(innerX, innerY, innerWidth, innerHeight);
+ graphics.endFill();
+
+ graphics.lineStyle();
+ graphics.beginFill(0, 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/Controls.hx b/src/jaris/player/controls/Controls.hx
similarity index 64%
rename from src/jaris/player/Controls.hx
rename to src/jaris/player/controls/Controls.hx
index 7c2e9ef..0f8959d 100644
--- a/src/jaris/player/Controls.hx
+++ b/src/jaris/player/controls/Controls.hx
@@ -1,9 +1,26 @@
-/**
- * ...
+/**
* @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;
+package jaris.player.controls;
//{Libraries
import flash.display.GradientType;
@@ -21,6 +38,11 @@ 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.Player;
import flash.display.Sprite;
import flash.display.Stage;
@@ -53,11 +75,11 @@ class Controls extends MovieClip {
private var _controlsVisible:Bool;
private var _seekBar:Sprite;
private var _controlsBar:Sprite;
- private var _playControl:Sprite;
- private var _pauseControl:Sprite;
- private var _aspectRatioControl:Sprite;
- private var _fullscreenControl:Sprite;
- private var _volumeIcon:Sprite;
+ private var _playControl:PlayIcon;
+ private var _pauseControl:PauseIcon;
+ private var _aspectRatioControl:AspectRatioIcon;
+ private var _fullscreenControl:FullscreenIcon;
+ private var _volumeIcon:VolumeIcon;
private var _volumeTrack:Sprite;
private var _volumeSlider:Sprite;
private var _loader:Loader;
@@ -134,35 +156,20 @@ class Controls extends MovieClip {
_controlsBar.visible = true;
addChild(_controlsBar);
- _playControl = new Sprite();
- _playControl.buttonMode = true;
- _playControl.useHandCursor = true;
- _playControl.tabEnabled = false;
+ _playControl = new PlayIcon(0, 0, 0, 0, _controlColor, _hoverColor);
_controlsBar.addChild(_playControl);
- _pauseControl = new Sprite();
+ _pauseControl = new PauseIcon(0, 0, 0, 0, _controlColor, _hoverColor);
_pauseControl.visible = false;
- _pauseControl.buttonMode = true;
- _pauseControl.useHandCursor = true;
- _pauseControl.tabEnabled = false;
_controlsBar.addChild(_pauseControl);
- _aspectRatioControl = new Sprite();
- _aspectRatioControl.buttonMode = true;
- _aspectRatioControl.useHandCursor = true;
- _aspectRatioControl.tabEnabled = false;
+ _aspectRatioControl = new AspectRatioIcon(0, 0, 0, 0, _controlColor, _hoverColor);
_controlsBar.addChild(_aspectRatioControl);
- _fullscreenControl = new Sprite();
- _fullscreenControl.buttonMode = true;
- _fullscreenControl.useHandCursor = true;
- _fullscreenControl.tabEnabled = false;
+ _fullscreenControl = new FullscreenIcon(0, 0, 0, 0, _controlColor, _hoverColor);
_controlsBar.addChild(_fullscreenControl);
- _volumeIcon = new Sprite();
- _volumeIcon.buttonMode = true;
- _volumeIcon.useHandCursor = true;
- _volumeIcon.tabEnabled = false;
+ _volumeIcon = new VolumeIcon(0, 0, 0, 0, _controlColor, _hoverColor);
_controlsBar.addChild(_volumeIcon);
_volumeSlider = new Sprite();
@@ -177,7 +184,7 @@ class Controls extends MovieClip {
//{Loader bar
_loader = new Loader();
- _loader.visible = false;
+ _loader.hide();
var loaderColors:Array <String> = ["", "", "", ""];
loaderColors[0] = Std.string(_brightColor);
@@ -200,23 +207,11 @@ class Controls extends MovieClip {
_track.addEventListener(MouseEvent.MOUSE_MOVE, onTrackMouseMove);
_track.addEventListener(MouseEvent.MOUSE_OUT, onTrackMouseOut);
_trackBar.addEventListener(MouseEvent.MOUSE_OUT, onThumbMouseUp);
- _controlsBar.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
- _controlsBar.addEventListener(MouseEvent.MOUSE_OVER, onMouseMove);
_playControl.addEventListener(MouseEvent.CLICK, onPlayClick);
- _playControl.addEventListener(MouseEvent.MOUSE_OVER, onPlayButtonHover);
- _playControl.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutRedrawControlBar);
_pauseControl.addEventListener(MouseEvent.CLICK, onPauseClick);
- _pauseControl.addEventListener(MouseEvent.MOUSE_OVER, onPauseButtonHover);
- _pauseControl.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutRedrawControlBar);
_aspectRatioControl.addEventListener(MouseEvent.CLICK, onAspectRatioClick);
- _aspectRatioControl.addEventListener(MouseEvent.MOUSE_OVER, onAspectRatioButtonHover);
- _aspectRatioControl.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutRedrawControlBar);
_fullscreenControl.addEventListener(MouseEvent.CLICK, onFullscreenClick);
- _fullscreenControl.addEventListener(MouseEvent.MOUSE_OVER, onFullscreenButtonHover);
- _fullscreenControl.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutRedrawControlBar);
_volumeIcon.addEventListener(MouseEvent.CLICK, onVolumeIconClick);
- _volumeIcon.addEventListener(MouseEvent.MOUSE_OVER, onVolumeIconButtonHover);
- _volumeIcon.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutRedrawControlBar);
_volumeTrack.addEventListener(MouseEvent.CLICK, onVolumeTrackClick);
_player.addEventListener(PlayerEvents.FULLSCREEN, onPlayerFullScreen);
@@ -253,7 +248,11 @@ class Controls extends MovieClip {
{
if (_controlsVisible)
{
- if (_stage.mouseX < _controlsBar.x)
+ if (_stage.mouseX < _controlsBar.x ||
+ _stage.mouseX >= _stage.stageWidth - 1 ||
+ _stage.mouseY >= _stage.stageHeight - 1 ||
+ _stage.mouseY <= 1
+ )
{
_controlsVisible = false;
}
@@ -310,15 +309,6 @@ class Controls extends MovieClip {
}
/**
- * Used for various controls to redraw controbar after mouse out to clear hover effect
- * @param event
- */
- private function onMouseOutRedrawControlBar(event:MouseEvent)
- {
- drawPlayingControls();
- }
-
- /**
* Toggles pause or play
* @param event
*/
@@ -330,20 +320,6 @@ class Controls extends MovieClip {
}
/**
- * Changes play control color to hover color
- * @param event
- */
- private function onPlayButtonHover(event:MouseEvent):Void
- {
- var triangleRatio = ((80 / 100) * (_controlsBar.width - 20));
- _playControl.graphics.clear();
- _playControl.graphics.lineStyle();
- _playControl.graphics.beginFill(_hoverColor);
- Utils.drawTriangle(_playControl, 0, 0, triangleRatio, 0);
- _playControl.graphics.endFill();
- }
-
- /**
* Toggles pause or play
* @param event
*/
@@ -355,24 +331,6 @@ class Controls extends MovieClip {
}
/**
- * Changes pause button color to hover color
- * @param event
- */
- private function onPauseButtonHover(event:MouseEvent):Void
- {
- _pauseControl.graphics.lineStyle();
- _pauseControl.graphics.beginFill(_hoverColor);
- _pauseControl.graphics.drawRoundRect(0, 0, (33 / 100) * _playControl.width, _playControl.height, 6, 6);
- _pauseControl.graphics.drawRoundRect(_playControl.width - ((33 / 100) * _playControl.width), 0, (33 / 100) * _playControl.width, _playControl.height, 6, 6);
- _pauseControl.graphics.endFill();
-
- _pauseControl.graphics.lineStyle();
- _pauseControl.graphics.beginFill(0x000000, 0);
- _pauseControl.graphics.drawRect(0, 0, _pauseControl.width, _playControl.height);
- _pauseControl.graphics.endFill();
- }
-
- /**
* Toggles betewen aspect ratios
* @param event
*/
@@ -382,28 +340,6 @@ class Controls extends MovieClip {
}
/**
- * Changes aspect ratio icon color to hover one
- * @param event
- */
- private function onAspectRatioButtonHover(event:MouseEvent):Void
- {
- _aspectRatioControl.graphics.clear();
-
- _aspectRatioControl.graphics.lineStyle(2, _hoverColor);
- _aspectRatioControl.graphics.drawRect(0, 0, _playControl.width, _playControl.height);
-
- _aspectRatioControl.graphics.lineStyle();
- _aspectRatioControl.graphics.beginFill(_hoverColor, 1);
- _aspectRatioControl.graphics.drawRect(5, 5, _aspectRatioControl.width - 12, _aspectRatioControl.height - 12);
- _aspectRatioControl.graphics.endFill();
-
- _aspectRatioControl.graphics.lineStyle();
- _aspectRatioControl.graphics.beginFill(0x000000, 0);
- _aspectRatioControl.graphics.drawRect(0, 0, _aspectRatioControl.width, _aspectRatioControl.height);
- _aspectRatioControl.graphics.endFill();
- }
-
- /**
* Toggles between window and fullscreen mode
* @param event
*/
@@ -413,26 +349,6 @@ class Controls extends MovieClip {
}
/**
- * Changes fullscreen icon color to hover one
- * @param event
- */
- private function onFullscreenButtonHover(event:MouseEvent):Void
- {
- _fullscreenControl.graphics.lineStyle(2, _hoverColor);
- _fullscreenControl.graphics.beginFill(0x000000, 0);
- _fullscreenControl.graphics.drawRoundRect(0, 0, _playControl.width, _playControl.height, 6, 6);
- _fullscreenControl.graphics.endFill();
-
- _fullscreenControl.graphics.lineStyle();
- _fullscreenControl.graphics.beginFill(_hoverColor, 1);
- _fullscreenControl.graphics.drawRoundRect(3, 3, 4, 4, 2, 2);
- _fullscreenControl.graphics.drawRoundRect(_fullscreenControl.width - 9, 3, 4, 4, 2, 2);
- _fullscreenControl.graphics.drawRoundRect(3, _fullscreenControl.height - 9, 4, 4, 2, 2);
- _fullscreenControl.graphics.drawRoundRect(_fullscreenControl.width - 9, _fullscreenControl.height - 9, 4, 4, 2, 2);
- _fullscreenControl.graphics.endFill();
- }
-
- /**
* Toggles between mute and unmute
* @param event
*/
@@ -442,22 +358,6 @@ class Controls extends MovieClip {
}
/**
- * Changes volume icon color to hover one
- * @param event
- */
- public function onVolumeIconButtonHover(event: MouseEvent)
- {
- _volumeIcon.graphics.lineStyle();
- _volumeIcon.graphics.beginFill(_hoverColor, 1);
- _volumeIcon.graphics.drawRect(0, ((50 / 100) * _playControl.height) / 2, _playControl.width / 2, ((50 / 100) * _playControl.height));
- _volumeIcon.graphics.moveTo(_playControl.width / 2, ((50 / 100) * _playControl.height)/2);
- _volumeIcon.graphics.lineTo(_playControl.width, 0);
- _volumeIcon.graphics.lineTo(_playControl.width, _playControl.height);
- _volumeIcon.graphics.lineTo(_playControl.width / 2, ((50 / 100) * _playControl.height) + (((50 / 100) * _playControl.height) / 2));
- _volumeIcon.graphics.endFill();
- }
-
- /**
* Detect user click on volume track control and change volume according
* @param event
*/
@@ -484,7 +384,7 @@ class Controls extends MovieClip {
*/
private function onPlayerBuffering(event:PlayerEvents):Void
{
- _loader.visible = true;
+ _loader.show();
}
/**
@@ -493,7 +393,7 @@ class Controls extends MovieClip {
*/
private function onPlayerNotBuffering(event:PlayerEvents):Void
{
- _loader.visible = false;
+ _loader.hide();
}
/**
@@ -531,7 +431,10 @@ class Controls extends MovieClip {
while (_seekBar.width != _stage.stageWidth && count <= 3)
{
redrawControls();
- hideControls();
+ if (_player.isPlaying())
+ {
+ hideControls();
+ }
count++;
}
}
@@ -702,10 +605,10 @@ class Controls extends MovieClip {
*/
private function drawDownloadProgress():Void
{
- if (_player.getNetStream().bytesTotal > 0)
+ if (_player.getBytesTotal() > 0)
{
- var bytesLoaded:Float = _player.getNetStream().bytesLoaded;
- var bytesTotal:Float = _player.getNetStream().bytesTotal;
+ var bytesLoaded:Float = _player.getBytesLoaded();
+ var bytesTotal:Float = _player.getBytesTotal();
_percentLoaded = bytesLoaded / bytesTotal;
}
@@ -771,16 +674,11 @@ class Controls extends MovieClip {
{
//Reset sprites for redraw
_controlsBar.graphics.clear();
- _playControl.graphics.clear();
- _pauseControl.graphics.clear();
- _aspectRatioControl.graphics.clear();
- _fullscreenControl.graphics.clear();
_volumeTrack.graphics.clear();
- _volumeIcon.graphics.clear();
_volumeSlider.graphics.clear();
//Draw controls bar
- var barWidth = 60;
+ var barWidth = _stage.stageHeight < 330 ? 45 : 60;
_controlsBar.x = (_stage.stageWidth - barWidth) + 20;
_controlsBar.y = 25;
@@ -796,82 +694,47 @@ class Controls extends MovieClip {
_controlsBar.width = barWidth;
_controlsBar.height = _stage.stageHeight - 75;
- var topMargin = 10;
+ var topMargin:Float = _stage.stageHeight < 330 ? 5 : 10;
var barCenter:Float = (_controlsBar.width - 20) / 2;
+ var buttonSize:Float = ((80 / 100) * (_controlsBar.width - 20));
+ var buttonX:Float = buttonSize / 2;
//Draw playbutton
- var triangleRatio = ((80 / 100) * (_controlsBar.width - 20));
- _playControl.x = barCenter - (triangleRatio/2);
- _playControl.y = topMargin;
- _playControl.graphics.lineStyle();
- _playControl.graphics.beginFill(_controlColor);
- Utils.drawTriangle(_playControl, 0, 0, triangleRatio, 0);
- _playControl.graphics.endFill();
+ _playControl.setNormalColor(_controlColor);
+ _playControl.setHoverColor(_hoverColor);
+ _playControl.setPosition(barCenter - buttonX, topMargin);
+ _playControl.setSize(buttonSize, buttonSize);
//Draw pausebutton
- _pauseControl.x = _playControl.x;
- _pauseControl.y = _playControl.y;
- _pauseControl.graphics.lineStyle();
- _pauseControl.graphics.beginFill(_controlColor);
- _pauseControl.graphics.drawRoundRect(0, 0, (33 / 100) * _playControl.width, _playControl.height, 6, 6);
- _pauseControl.graphics.drawRoundRect(_playControl.width - ((33 / 100) * _playControl.width), 0, (33 / 100) * _playControl.width, _playControl.height, 6, 6);
- _pauseControl.graphics.endFill();
-
- _pauseControl.graphics.lineStyle();
- _pauseControl.graphics.beginFill(_controlColor, 0);
- _pauseControl.graphics.drawRect(0, 0, _pauseControl.width, _playControl.height);
- _pauseControl.graphics.endFill();
+ _pauseControl.setNormalColor(_controlColor);
+ _pauseControl.setHoverColor(_hoverColor);
+ _pauseControl.setPosition(_playControl.x, topMargin);
+ _pauseControl.setSize(buttonSize, buttonSize);
//Draw aspec ratio button
- _aspectRatioControl.x = _playControl.x;
- _aspectRatioControl.y = _playControl.y + _playControl.height + topMargin;
- _aspectRatioControl.graphics.lineStyle(2, _controlColor);
- _aspectRatioControl.graphics.drawRect(0, 0, _playControl.width, _playControl.height);
-
- _aspectRatioControl.graphics.lineStyle();
- _aspectRatioControl.graphics.beginFill(_controlColor, 1);
- _aspectRatioControl.graphics.drawRect(5, 5, _aspectRatioControl.width - 12, _aspectRatioControl.height - 12);
- _aspectRatioControl.graphics.endFill();
-
- _aspectRatioControl.graphics.lineStyle();
- _aspectRatioControl.graphics.beginFill(0x000000, 0);
- _aspectRatioControl.graphics.drawRect(0, 0, _aspectRatioControl.width, _aspectRatioControl.height);
- _aspectRatioControl.graphics.endFill();
+ _aspectRatioControl.setNormalColor(_controlColor);
+ _aspectRatioControl.setHoverColor(_hoverColor);
+ _aspectRatioControl.setPosition(_playControl.x, (_playControl.y + buttonSize) + topMargin);
+ _aspectRatioControl.setSize(buttonSize, buttonSize);
//Draw fullscreen button
- _fullscreenControl.x = _playControl.x;
- _fullscreenControl.y = _aspectRatioControl.y + _aspectRatioControl.height + topMargin;
- _fullscreenControl.graphics.lineStyle(2, _controlColor);
- _fullscreenControl.graphics.beginFill(0x000000, 0);
- _fullscreenControl.graphics.drawRoundRect(0, 0, _playControl.width, _playControl.height, 6, 6);
- _fullscreenControl.graphics.endFill();
-
- _fullscreenControl.graphics.lineStyle();
- _fullscreenControl.graphics.beginFill(_controlColor, 1);
- _fullscreenControl.graphics.drawRoundRect(3, 3, 4, 4, 2, 2);
- _fullscreenControl.graphics.drawRoundRect(_fullscreenControl.width - 9, 3, 4, 4, 2, 2);
- _fullscreenControl.graphics.drawRoundRect(3, _fullscreenControl.height - 9, 4, 4, 2, 2);
- _fullscreenControl.graphics.drawRoundRect(_fullscreenControl.width - 9, _fullscreenControl.height - 9, 4, 4, 2, 2);
- _fullscreenControl.graphics.endFill();
+ _fullscreenControl.setNormalColor(_controlColor);
+ _fullscreenControl.setHoverColor(_hoverColor);
+ _fullscreenControl.setPosition(_playControl.x, (_aspectRatioControl.y + _aspectRatioControl.height) + topMargin);
+ _fullscreenControl.setSize(buttonSize, buttonSize);
//Draw volume icon
- _volumeIcon.x = _playControl.x;
- _volumeIcon.y = _controlsBar.height - _playControl.height - 10;
- _volumeIcon.graphics.lineStyle();
- _volumeIcon.graphics.beginFill(_controlColor, 1);
- _volumeIcon.graphics.drawRect(0, ((50 / 100) * _playControl.height) / 2, _playControl.width / 2, ((50 / 100) * _playControl.height));
- _volumeIcon.graphics.moveTo(_playControl.width / 2, ((50 / 100) * _playControl.height)/2);
- _volumeIcon.graphics.lineTo(_playControl.width, 0);
- _volumeIcon.graphics.lineTo(_playControl.width, _playControl.height);
- _volumeIcon.graphics.lineTo(_playControl.width / 2, ((50 / 100) * _playControl.height) + (((50 / 100) * _playControl.height) / 2));
- _volumeIcon.graphics.endFill();
+ _volumeIcon.setNormalColor(_controlColor);
+ _volumeIcon.setHoverColor(_hoverColor);
+ _volumeIcon.setPosition(_playControl.x, _controlsBar.height - _playControl.height - topMargin);
+ _volumeIcon.setSize(buttonSize, buttonSize);
//Draw volume track
_volumeTrack.x = _playControl.x;
- _volumeTrack.y = (_fullscreenControl.y + _fullscreenControl.height) + 10;
+ _volumeTrack.y = (_fullscreenControl.y + _fullscreenControl.height) + topMargin;
_volumeTrack.graphics.lineStyle(1, _controlColor);
_volumeTrack.graphics.beginFill(0x000000, 0);
- _volumeTrack.graphics.drawRect(0, 0, _playControl.width / 2, _volumeIcon.y - (_fullscreenControl.y + _fullscreenControl.height) - 20);
+ _volumeTrack.graphics.drawRect(0, 0, _playControl.width / 2, _volumeIcon.y - (_fullscreenControl.y + _fullscreenControl.height) - (topMargin*2));
_volumeTrack.graphics.endFill();
_volumeTrack.x = barCenter - (_volumeTrack.width / 2);
@@ -896,7 +759,7 @@ class Controls extends MovieClip {
if(_controlsBar.visible)
{
drawPlayingControls();
- Animation.slideOut(_controlsBar, "right", 1500);
+ Animation.slideOut(_controlsBar, "right", 800);
}
}
@@ -908,7 +771,7 @@ class Controls extends MovieClip {
if(!_controlsBar.visible)
{
drawPlayingControls();
- Animation.slideIn(_controlsBar, "right", 1500);
+ Animation.slideIn(_controlsBar, "right", 800);
}
}
//}
@@ -926,13 +789,28 @@ class Controls extends MovieClip {
_controlColor = colors[2].length > 0? Std.parseInt("0x" + colors[2]) : 0xFFFFFF;
_hoverColor = colors[3].length > 0? Std.parseInt("0x" + colors[3]) : 0x67A8C1;
- var loaderColors:Array <String> = ["", "", "", ""];
+ var loaderColors:Array <String> = ["", ""];
loaderColors[0] = colors[1];
loaderColors[1] = colors[2];
_loader.setColors(loaderColors);
redrawControls();
}
+
+ public function setDurationLabel(duration:String):Void
+ {
+ //Person passed time already formatted
+ if (duration.indexOf(":") != -1)
+ {
+ _totalPlayTimeLabel.text = duration;
+ }
+
+ //Time passed in seconds
+ else
+ {
+ _totalPlayTimeLabel.text = Std.string(Utils.formatTime(Std.parseFloat(duration)));
+ }
+ }
//}
}
\ No newline at end of file
diff --git a/src/jaris/player/controls/FullscreenIcon.hx b/src/jaris/player/controls/FullscreenIcon.hx
new file mode 100644
index 0000000..95da6e5
--- /dev/null
+++ b/src/jaris/player/controls/FullscreenIcon.hx
@@ -0,0 +1,114 @@
+/**
+ * @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.controls;
+import flash.display.Sprite;
+import flash.events.MouseEvent;
+
+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(2, color);
+ graphics.beginFill(0x000000, 0);
+ graphics.drawRoundRect(0, 0, _width, _height, 6, 6);
+ graphics.endFill();
+
+ graphics.lineStyle();
+ graphics.beginFill(color, 1);
+ graphics.drawRoundRect(3, 3, 4, 4, 2, 2);
+ graphics.drawRoundRect(width - 9, 3, 4, 4, 2, 2);
+ graphics.drawRoundRect(3, height - 9, 4, 4, 2, 2);
+ graphics.drawRoundRect(width - 9, height - 9, 4, 4, 2, 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/controls/PauseIcon.hx b/src/jaris/player/controls/PauseIcon.hx
new file mode 100644
index 0000000..c16a113
--- /dev/null
+++ b/src/jaris/player/controls/PauseIcon.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.controls;
+import flash.display.Sprite;
+import flash.events.MouseEvent;
+
+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();
+ 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/controls/PlayIcon.hx b/src/jaris/player/controls/PlayIcon.hx
new file mode 100644
index 0000000..0d506d9
--- /dev/null
+++ b/src/jaris/player/controls/PlayIcon.hx
@@ -0,0 +1,107 @@
+/**
+ * @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.controls;
+import flash.display.Sprite;
+import flash.events.MouseEvent;
+
+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();
+ 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/controls/VolumeIcon.hx b/src/jaris/player/controls/VolumeIcon.hx
new file mode 100644
index 0000000..e2eed7d
--- /dev/null
+++ b/src/jaris/player/controls/VolumeIcon.hx
@@ -0,0 +1,110 @@
+/**
+ * @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.controls;
+import flash.display.Sprite;
+import flash.events.MouseEvent;
+
+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();
+ graphics.beginFill(color, 1);
+ graphics.drawRect(0, ((50 / 100) * _height) / 2, _width / 2, ((50 / 100) * _height));
+ graphics.moveTo(_width / 2, ((50 / 100) * _height)/2);
+ graphics.lineTo(_width, 0);
+ graphics.lineTo(_width, _height);
+ graphics.lineTo(_width / 2, ((50 / 100) * _height) + (((50 / 100) * _height) / 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/utils/Utils.hx b/src/jaris/utils/Utils.hx
index 9e17d32..2ffdcc3 100644
--- a/src/jaris/utils/Utils.hx
+++ b/src/jaris/utils/Utils.hx
@@ -1,6 +1,23 @@
-/**
- * ...
+/**
* @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.utils;
@@ -104,20 +121,4 @@ class Utils
return timeString;
}
-
- /**
- * Draws a triangle. Im not so good on mathematics so this is incomplete only for play button xD
- * @param object
- * @param x
- * @param y
- * @param ratio
- * @param rotation
- */
- public static function drawTriangle(object:Dynamic, x:Float, y:Float, ratio:Float, rotation:Float=0):Void
- {
- object.graphics.moveTo(x, y);
- object.graphics.lineTo(x, y + ratio);
- object.graphics.lineTo(x + ratio, y + (ratio / 2 ));
- object.graphics.lineTo(x, y);
- }
}
\ 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