move from Jaris > MediaElement for <video> fallback + use composer
also made it so the video element is no longer bigger than parent div
This commit is contained in:
parent
dd105e174e
commit
b0daab8766
46 changed files with 44 additions and 8633 deletions
|
@ -28,7 +28,8 @@
|
|||
|
||||
"bower-asset/jquery" : "1.12.3",
|
||||
"bower-asset/jquery-timeago" : "1.5.2",
|
||||
"bower-asset/tablesorter" : "2.0.5"
|
||||
"bower-asset/tablesorter" : "2.0.5",
|
||||
"bower-asset/mediaelement" : "2.21.1"
|
||||
},
|
||||
|
||||
"vendor-copy": {
|
||||
|
@ -36,6 +37,7 @@
|
|||
"vendor/bower-asset/jquery/dist/jquery.min.map" : "lib/vendor/js/jquery-1.12.3.min.map",
|
||||
"vendor/bower-asset/jquery-timeago/jquery.timeago.js" : "lib/vendor/js/jquery.timeago.js",
|
||||
"vendor/bower-asset/tablesorter/jquery.tablesorter.min.js" : "lib/vendor/js/jquery.tablesorter.min.js"
|
||||
"vendor/bower-asset/mediaelement/build/flashmediaelement.swf" : "lib/vendor/swf/flashmediaelement.swf"
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
* In the future, it may be necessary to change the user agent checks to reflect the current state of H.264 support.<br><br>
|
||||
* Made possible by:<br>
|
||||
* <a href='http://getid3.sourceforge.net/'>getID3()</a> - Gets media information with PHP (no bulky FFMPEG API required).<br>
|
||||
* <a href='http://jarisflvplayer.org/'>Jaris FLV Player</a> - GPLv3 flash multimedia player.
|
||||
*/
|
||||
|
||||
class VideoFileHandler extends DataHandlerExtension {
|
||||
|
|
|
@ -4,45 +4,48 @@ class VideoFileHandlerTheme extends Themelet {
|
|||
public function display_image(Page $page, Image $image) {
|
||||
$data_href = get_base_href();
|
||||
$ilink = $image->get_image_link();
|
||||
$thumb_url = make_http($image->get_thumb_link()); //used as fallback image
|
||||
$ext = strtolower($image->get_ext());
|
||||
|
||||
if ($ext == "mp4") {
|
||||
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
|
||||
<script language='JavaScript' type='text/javascript'>
|
||||
if( navigator.userAgent.match(/Firefox/i) ||
|
||||
navigator.userAgent.match(/Opera/i) ||
|
||||
(navigator.userAgent.match(/MSIE/i) && parseFloat(navigator.appVersion.split('MSIE')[1]) < 9)){
|
||||
document.write(\"<object data='{$data_href}/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source=$ilink&type=video&streamtype=file&controltype=0' name='flashvars'></object>\");
|
||||
}
|
||||
else {
|
||||
document.write(\"<video controls autoplay loop'>\");
|
||||
document.write(\"<source src='" . make_link("/image/" . $image->id) . "' type='video/mp4' />\");
|
||||
document.write(\"<object data='{$data_href}/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source=$ilink&type=video&streamtype=file&controltype=0' name='flashvars'></object>\");
|
||||
}
|
||||
</script>
|
||||
<noscript>Javascript appears to be disabled. Please enable it and try again.</noscript>";
|
||||
} elseif ($ext == "flv") {
|
||||
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
|
||||
<object data='{$data_href}/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'>
|
||||
<param value='#000000' name='bgcolor'>
|
||||
<param name='allowFullScreen' value='true'>
|
||||
<param value='high' name='quality'>
|
||||
<param value='opaque' name='wmode'>
|
||||
<param value='source={$ilink}&type=video&streamtype=file&controltype=0' name='flashvars'>
|
||||
</object>";
|
||||
} elseif ($ext == "ogv") {
|
||||
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
|
||||
<video controls autoplay loop>
|
||||
<source src='" . make_link("/image/" . $image->id) . "' type='video/ogg' />
|
||||
</video>";
|
||||
} elseif ($ext == "webm") {
|
||||
$ie_only = "<!--[if IE]><p>To view webm files with IE, please <a href='http://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]-->";
|
||||
$html = $ie_only ."Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
|
||||
<video controls autoplay loop>
|
||||
<source src='" . make_link("/image/" . $image->id) . "' type='video/webm' />
|
||||
</video>";
|
||||
}
|
||||
else {
|
||||
$full_url = make_http($ilink);
|
||||
|
||||
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>";
|
||||
|
||||
//Browser media format support: https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
|
||||
$supportedExts = ['mp4' => 'video/mp4', 'm4v' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm', 'flv' => 'video/flv'];
|
||||
if(array_key_exists($ext, $supportedExts)) {
|
||||
//FLV isn't supported by <video>, but it should always fallback to the flash-based method.
|
||||
if($ext == "webm") {
|
||||
//Several browsers still lack WebM support sadly: http://caniuse.com/#feat=webm
|
||||
$html .= "<!--[if IE]><p>To view webm files with IE, please <a href='https://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]-->";
|
||||
}
|
||||
|
||||
$html_fallback = "
|
||||
<object width=\"100%\" height=\"480px\" type=\"application/x-shockwave-flash\" data=\"lib/vendor/swf/flashmediaelement.swf\">
|
||||
<param name=\"movie\" value=\"lib/vendor/swf/flashmediaelement.swf\" />
|
||||
|
||||
<param name=\"allowFullScreen\" value=\"true\" />
|
||||
<param name=\"wmode\" value=\"opaque\" />
|
||||
|
||||
<param name=\"flashVars\" value=\"controls=true&autoplay=true&poster={$thumb_url}&file={$full_url}\" />
|
||||
<img src=\"{$thumb_url}\" />
|
||||
</object>";
|
||||
|
||||
if($ext == "flv") {
|
||||
//FLV doesn't support <video>.
|
||||
$html .= $html_fallback;
|
||||
} else {
|
||||
$html .= "
|
||||
<video controls autoplay width=\"100%\">
|
||||
<source src='{$ilink}' type='{$supportedExts[$ext]}'>
|
||||
|
||||
<!-- If browser doesn't support filetype, fallback to flash -->
|
||||
{$html_fallback}
|
||||
|
||||
</video>";
|
||||
}
|
||||
|
||||
} else {
|
||||
//This should never happen, but just in case let's have a fallback..
|
||||
$html = "Video type '$ext' not recognised";
|
||||
}
|
||||
$page->add_block(new Block("Video", $html, "main", 10));
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project version="2">
|
||||
<!-- Output SWF options -->
|
||||
<output>
|
||||
<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 -->
|
||||
<classpaths>
|
||||
<class path="src" />
|
||||
</classpaths>
|
||||
<!-- Build options -->
|
||||
<build>
|
||||
<option directives="" />
|
||||
<option flashStrict="False" />
|
||||
<option mainClass="jaris.Main" />
|
||||
<option enabledebug="False" />
|
||||
<option additional="" />
|
||||
</build>
|
||||
<!-- haxelib libraries -->
|
||||
<haxelib>
|
||||
<!-- example: <library name="..." /> -->
|
||||
</haxelib>
|
||||
<!-- Class files to compile (other referenced classes will automatically be included) -->
|
||||
<compileTargets>
|
||||
<compile path="src\jaris\Main.hx" />
|
||||
</compileTargets>
|
||||
<!-- Assets to embed into the output SWF -->
|
||||
<library>
|
||||
<!-- example: <asset path="..." id="..." update="..." glyphs="..." mode="..." place="..." sharepoint="..." /> -->
|
||||
</library>
|
||||
<!-- Paths to exclude from the Project Explorer tree -->
|
||||
<hiddenPaths>
|
||||
<!-- example: <hidden path="..." /> -->
|
||||
</hiddenPaths>
|
||||
<!-- Executed before build -->
|
||||
<preBuildCommand />
|
||||
<!-- Executed after build -->
|
||||
<postBuildCommand alwaysRun="False" />
|
||||
<!-- Other project options -->
|
||||
<options>
|
||||
<option showHiddenPaths="True" />
|
||||
<option testMovie="Default" />
|
||||
</options>
|
||||
<!-- Plugin storage -->
|
||||
<storage />
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
|
@ -1,126 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Jaris FLV Player</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="language" content="en" />
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<script src="js/swfobject.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var flashvarsVideo = {
|
||||
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"
|
||||
};
|
||||
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",
|
||||
streamtype: "file",
|
||||
server: "",//Used for rtmp streams
|
||||
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",
|
||||
logolink: "http://jaris.sourceforge.net",
|
||||
hardwarescaling: "false",
|
||||
darkcolor: "D3D3D3",
|
||||
brightcolor: "FFFFFF",
|
||||
controlcolor: "000000",
|
||||
hovercolor: "FF0000"
|
||||
};
|
||||
var params = {
|
||||
menu: "false",
|
||||
scale: "noScale",
|
||||
allowFullscreen: "true",
|
||||
allowScriptAccess: "always",
|
||||
bgcolor: "#000000",
|
||||
quality: "high",
|
||||
wmode: "opaque"
|
||||
};
|
||||
var attributes = {
|
||||
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>
|
||||
html, body { height:100%; }
|
||||
body { margin:0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<br />
|
||||
<center>
|
||||
<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>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>
|
||||
<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>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
|
@ -1,98 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson Gonzalez
|
||||
* @copyright 2010 Jefferson Gonzalez
|
||||
*
|
||||
* @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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
*Interface for the JarisFLVPlayer JavaScript API implemented
|
||||
*by Sascha from http://projekktor.com/
|
||||
*@param id The id of the flash object
|
||||
*/
|
||||
function JarisFLVPlayer(id){
|
||||
|
||||
this.playerId = id; //Stores the id of the player
|
||||
this.player = document.getElementById(id); //Object that points to the player
|
||||
}
|
||||
|
||||
//Event constants
|
||||
JarisFLVPlayer.event = {
|
||||
MOUSE_HIDE: "onMouseHide",
|
||||
MOUSE_SHOW: "onMouseShow",
|
||||
MEDIA_INITIALIZED: "onDataInitialized",
|
||||
BUFFERING: "onBuffering",
|
||||
NOT_BUFFERING: "onNotBuffering",
|
||||
RESIZE: "onResize",
|
||||
PLAY_PAUSE: "onPlayPause",
|
||||
PLAYBACK_FINISHED: "onPlaybackFinished",
|
||||
CONNECTION_FAILED: "onConnectionFailed",
|
||||
ASPECT_RATIO: "onAspectRatio",
|
||||
VOLUME_UP: "onVolumeUp",
|
||||
VOLUME_DOWN: "onVolumeDown",
|
||||
VOLUME_CHANGE: "onVolumeChange",
|
||||
MUTE: "onMute",
|
||||
TIME: "onTimeUpdate",
|
||||
PROGRESS: "onProgress",
|
||||
SEEK: "onSeek",
|
||||
ON_ALL: "on*"
|
||||
};
|
||||
|
||||
JarisFLVPlayer.prototype.isBuffering = function(){
|
||||
return this.player.api_get("isBuffering");
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.isPlaying = function(){
|
||||
return this.player.api_get("isPlaying");
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.getCurrentTime = function(){
|
||||
return this.player.api_get("time");
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.getBytesLoaded = function(){
|
||||
return this.player.api_get("loaded");
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.getVolume = function(){
|
||||
return this.player.api_get("volume");
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.addListener = function(event, listener){
|
||||
this.player.api_addlistener(event, listener);
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.removeListener = function(event){
|
||||
this.player.api_removelistener(event);
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.play = function(){
|
||||
this.player.api_play();
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.pause = function(){
|
||||
this.player.api_pause();
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.seek = function(seconds){
|
||||
this.player.api_seek(seconds);
|
||||
}
|
||||
|
||||
JarisFLVPlayer.prototype.volume = function(value){
|
||||
this.player.api_volume(value);
|
||||
}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
Binary file not shown.
Before Width: | Height: | Size: 87 KiB |
|
@ -1,118 +0,0 @@
|
|||
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.
|
||||
|
||||
Jaris FLV Player v2.0.13 beta - 6/03/2011
|
||||
|
||||
* Implemented loop class
|
||||
* Added loop functionality by passing loop=true or loop=1 as parameter
|
||||
* Fixed reported bug "slider will show wrong position" on pseudostreaming seek (Thanks to Adam)
|
||||
|
||||
Jaris FLV Player v2.0.12 beta - 06/11/2010
|
||||
|
||||
* Java Script Api to listen for events and control the player.
|
||||
* More player events added to use on JSApi.
|
||||
* All this changes thanks to Sascha Kluger from http://projekktor.com
|
||||
|
||||
Jaris FLV Player v2.0.11 beta - 03/10/2010
|
||||
|
||||
* Removed togglePlay of onFullscreen event since it seems that new flash versions doesnt emits
|
||||
the space keydown anymore that affected playback on fullcreen switching.
|
||||
* Added class to store user settings as volume and aspect ratio to load them next time player is load.
|
||||
|
||||
Jaris FLV Player v2.0.10 beta - 29/09/2010
|
||||
|
||||
* Added flashvar aspectratio option to initially tell on wich aspect ratio to play the video
|
||||
|
||||
Jaris FLV Player v2.0.9 beta - 26/05/2010
|
||||
|
||||
* Improved poster to keep aspect ratio and display back when playback finishes
|
||||
|
||||
Jaris FLV Player v2.0.8 beta - 14/05/2010
|
||||
|
||||
* Fixed bug on formatTime function calculating hours as minutes
|
||||
|
||||
Jaris FLV Player v2.0.7 beta - 03/19/2010
|
||||
|
||||
* Fixed youtube security bug
|
||||
|
||||
Jaris FLV Player v2.0.6 beta - 03/13/2010
|
||||
|
||||
* Added: display current aspect ratio label on aspect ratio toggle
|
||||
* Improved readability of text
|
||||
* only attach netstream to video object if input type is video
|
||||
* remove poster from player code
|
||||
|
||||
Jaris FLV Player v2.0.5 beta - 03/12/2010
|
||||
|
||||
* Improved aspect ratio toogle when video aspect ratio is already on the aspect ratios list
|
||||
* Fixed context menu aspect ratio rotation
|
||||
|
||||
Jaris FLV Player v2.0.4 beta - 03/11/2010
|
||||
|
||||
* Fixed a drawing issue where seek bar after fullscreen stayed long
|
||||
* Documented other parts of the code
|
||||
|
||||
Jaris FLV Player v2.0.3 beta - 03/10/2010
|
||||
|
||||
* Support for rtmp streaming
|
||||
* support for youtube
|
||||
* better support for http streaming like lighttpd
|
||||
* Fixed calculation of width on original aspect ratio larger than stage
|
||||
* And many hours of improvements
|
||||
|
||||
Jaris FLV Player v2.0.2 beta - 03/09/2010
|
||||
|
||||
* Implement EventDispatcher on Player class instead of using custom event mechanism
|
||||
* Fixed not getting initial stage widht and height on IE when using swfobjects
|
||||
* Some more improvements to controls on short heights
|
||||
* Other improvements and code refactoring
|
||||
* added id3 info to player events
|
||||
|
||||
Jaris FLV Player v2.0.1 beta - 03/08/2010
|
||||
|
||||
* Toggle Quality on Context Menu
|
||||
* Introduction of type parameter
|
||||
* 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.
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
==================
|
||||
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="source=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="source=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.
|
||||
|
||||
* source:
|
||||
This is the actual path of the media 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, rmtp, youtube.
|
||||
|
||||
* server:
|
||||
Used in coordination with rtmp stream servers
|
||||
|
||||
* 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 in png, jpg or gif format.
|
||||
|
||||
* autostart:
|
||||
A true or false value that indicates to the player if it should auto play the video on load.
|
||||
|
||||
* logo:
|
||||
The path to the 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 0 to 100, while more higher the vale less transparency is applied.
|
||||
|
||||
* 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
|
||||
|
||||
* 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
|
||||
|
||||
* brightcolor:
|
||||
The bright color of player controls in html hexadecimal format
|
||||
|
||||
* controlcolor:
|
||||
The face color of controls in html hexadecimal format
|
||||
|
||||
* hovercolor:
|
||||
On mouse hover color for controls in html hexadecimal format
|
||||
|
||||
* aspectratio:
|
||||
To override original aspect ratio on first time player load. Allowable values: 1:1, 3:2, 4:3, 5:4, 14:9, 14:10, 16:9, 16:10
|
||||
|
||||
* jsapi:
|
||||
Expose events to javascript functions and enable controlling the player from the outside. Set to any value to enable.
|
||||
|
||||
* 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
|
||||
==================
|
||||
|
||||
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.
|
||||
|
||||
* X
|
||||
Stops and close current stream
|
|
@ -1,789 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
|
@ -1,52 +0,0 @@
|
|||
==================
|
||||
Jaris FLV Player
|
||||
==================
|
||||
A flash flv player made using haxe and flash develop that can be embedded into any website
|
||||
for free or commercial use.
|
||||
|
||||
Web Page: http://jaris.sourceforge.net/
|
||||
Project Page: https://sourceforge.net/projects/jaris/
|
||||
|
||||
==================
|
||||
Be Free!
|
||||
==================
|
||||
|
||||
Searching for an flv player that could be used freely in all aspects and open source was
|
||||
a hard job. So I just decided to work on a basic player that had the most important
|
||||
features found in others players.
|
||||
|
||||
Thats the story of how Jaris was born.
|
||||
|
||||
==================
|
||||
Features
|
||||
==================
|
||||
|
||||
|
||||
* 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 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 http://sourceforge.net/projects/jaris/.
|
||||
|
||||
Enjoy a totally free player ;-)
|
|
@ -1,204 +0,0 @@
|
|||
/**
|
||||
* @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.MovieClip;
|
||||
import flash.display.Stage;
|
||||
import flash.display.StageAlign;
|
||||
import flash.display.StageScaleMode;
|
||||
import flash.Lib;
|
||||
import flash.system.Capabilities;
|
||||
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;
|
||||
import jaris.player.StreamType;
|
||||
import jaris.player.AspectRatio;
|
||||
import jaris.player.UserSettings;
|
||||
import jaris.player.Loop;
|
||||
|
||||
/**
|
||||
* Main jaris player starting point
|
||||
*/
|
||||
class Main
|
||||
{
|
||||
static var stage:Stage;
|
||||
static var movieClip:MovieClip;
|
||||
|
||||
static function main():Void
|
||||
{
|
||||
//Initialize stage and main movie clip
|
||||
stage = Lib.current.stage;
|
||||
movieClip = Lib.current;
|
||||
|
||||
stage.scaleMode = StageScaleMode.NO_SCALE;
|
||||
stage.align = StageAlign.TOP_LEFT;
|
||||
|
||||
//Retrieve user settings
|
||||
var userSettings:UserSettings = new UserSettings();
|
||||
|
||||
//Reads flash vars
|
||||
var parameters:Dynamic<String> = flash.Lib.current.loaderInfo.parameters;
|
||||
|
||||
//Initialize and draw player object
|
||||
var player:Player = new Player();
|
||||
if (Capabilities.playerType == "PlugIn" || Capabilities.playerType == "ActiveX")
|
||||
{
|
||||
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;
|
||||
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"))
|
||||
{
|
||||
switch(aspectRatio)
|
||||
{
|
||||
case "1:1":
|
||||
player.setAspectRatio(AspectRatio._1_1);
|
||||
case "3:2":
|
||||
player.setAspectRatio(AspectRatio._3_2);
|
||||
case "4:3":
|
||||
player.setAspectRatio(AspectRatio._4_3);
|
||||
case "5:4":
|
||||
player.setAspectRatio(AspectRatio._5_4);
|
||||
case "14:9":
|
||||
player.setAspectRatio(AspectRatio._14_9);
|
||||
case "14:10":
|
||||
player.setAspectRatio(AspectRatio._14_10);
|
||||
case "16:9":
|
||||
player.setAspectRatio(AspectRatio._16_9);
|
||||
case "16:10":
|
||||
player.setAspectRatio(AspectRatio._16_10);
|
||||
}
|
||||
}
|
||||
else if(userSettings.isSet("aspectratio"))
|
||||
{
|
||||
player.setAspectRatio(userSettings.getAspectRatio());
|
||||
}
|
||||
|
||||
player.setType(type);
|
||||
player.setStreamType(streamType);
|
||||
player.setServer(server);
|
||||
player.setVolume(userSettings.getVolume());
|
||||
player.setBufferTime(bufferTime);
|
||||
|
||||
if (autoStart)
|
||||
{
|
||||
player.load(parameters.source, type, streamType, server);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setSource(parameters.source);
|
||||
}
|
||||
|
||||
player.setHardwareScaling(parameters.hardwarescaling=="true"?true:false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//For development purposes
|
||||
if(userSettings.isSet("aspectratio"))
|
||||
{
|
||||
player.setAspectRatio(userSettings.getAspectRatio());
|
||||
}
|
||||
|
||||
player.setVolume(userSettings.getVolume());
|
||||
|
||||
player.load("http://jaris.sourceforge.net/files/jaris-intro.flv", InputType.VIDEO, StreamType.FILE);
|
||||
//player.load("http://jaris.sourceforge.net/files/audio.mp3", InputType.AUDIO, StreamType.FILE);
|
||||
}
|
||||
|
||||
//Draw preview image
|
||||
if (parameters.poster != null)
|
||||
{
|
||||
var poster:String = parameters.poster;
|
||||
var posterImage = new Poster(poster);
|
||||
posterImage.setPlayer(player);
|
||||
movieClip.addChild(posterImage);
|
||||
}
|
||||
|
||||
//Modify Context Menu
|
||||
var menu:Menu = new Menu(player);
|
||||
|
||||
//Draw logo
|
||||
if (parameters.logo!=null)
|
||||
{
|
||||
var logoSource:String = parameters.logo != null ? parameters.logo : "logo.png";
|
||||
var logoPosition:String = parameters.logoposition != null ? parameters.logoposition : "top left";
|
||||
var logoAlpha:Float = parameters.logoalpha != null ? Std.parseFloat(parameters.logoalpha) / 100 : 0.3;
|
||||
var logoWidth:Float = parameters.logowidth != null ? Std.parseFloat(parameters.logowidth) : 130;
|
||||
var logoLink:String = parameters.logolink != null ? parameters.logolink : "http://jaris.sourceforge.net";
|
||||
|
||||
var logo:Logo = new Logo(logoSource, logoPosition, logoAlpha, logoWidth);
|
||||
logo.setLink(logoLink);
|
||||
movieClip.addChild(logo);
|
||||
}
|
||||
|
||||
//Draw Controls
|
||||
if (parameters.controls != "false")
|
||||
{
|
||||
var duration:String = parameters.duration != "" && parameters.duration != null? parameters.duration : "0";
|
||||
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> = ["", "", "", "", ""];
|
||||
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 : "";
|
||||
|
||||
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
|
||||
if (parameters.loop != null)
|
||||
{
|
||||
var loop:Loop = new Loop(player);
|
||||
}
|
||||
|
||||
//Expose events to javascript functions and enable controlling the player from the outside
|
||||
if (parameters.jsapi != null)
|
||||
{
|
||||
var jsAPI:JsApi = new JsApi(player);
|
||||
movieClip.addChild(jsAPI);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* @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 flv player version and date
|
||||
*/
|
||||
class Version
|
||||
{
|
||||
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 = "08";
|
||||
public static var YEAR:String = "2011";
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Gives quick access usage to jaris animations
|
||||
*/
|
||||
class Animation
|
||||
{
|
||||
|
||||
/**
|
||||
* Quick access to fade in effect
|
||||
* @param object the object to animate
|
||||
* @param seconds the duration of the animation
|
||||
*/
|
||||
public static function fadeIn(object:Dynamic, seconds:Float):Void
|
||||
{
|
||||
var animation:AnimationsBase = new AnimationsBase();
|
||||
animation.fadeIn(object, seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick access to fade out effect
|
||||
* @param object the object to animate
|
||||
* @param seconds the duration of the animation
|
||||
*/
|
||||
public static function fadeOut(object:Dynamic, seconds:Float):Void
|
||||
{
|
||||
var animation:AnimationsBase = new AnimationsBase();
|
||||
animation.fadeOut(object, seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick access to slide in effect
|
||||
* @param object the object to animate
|
||||
* @param position could be top, left, bottom or right
|
||||
* @param seconds the duration of the animation
|
||||
*/
|
||||
public static function slideIn(object:Dynamic, position:String, seconds:Float):Void
|
||||
{
|
||||
var animation:AnimationsBase = new AnimationsBase();
|
||||
animation.slideIn(object, position, seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick access to slide out effect
|
||||
* @param object the object to animate
|
||||
* @param position could be top, left, bottom or right
|
||||
* @param seconds the duration of the animation
|
||||
*/
|
||||
public static function slideOut(object:Dynamic, position:String, seconds:Float):Void
|
||||
{
|
||||
var animation:AnimationsBase = new AnimationsBase();
|
||||
animation.slideOut(object, position, seconds);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,306 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Stage;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.Lib;
|
||||
import flash.utils.Timer;
|
||||
|
||||
/**
|
||||
* Jaris main animations
|
||||
*/
|
||||
class AnimationsBase
|
||||
{
|
||||
private var _fadeInTimer:Timer;
|
||||
private var _fadeOutTimer:Timer;
|
||||
|
||||
private var _slideInTimer:Timer;
|
||||
private var _slideInOrigX:Float;
|
||||
private var _slideInOrigY:Float;
|
||||
private var _slideInPosition:String;
|
||||
private var _slideInIncrements:Float;
|
||||
|
||||
private var _slideOutTimer:Timer;
|
||||
private var _slideOutOrigX:Float;
|
||||
private var _slideOutOrigY:Float;
|
||||
private var _slideOutPosition:String;
|
||||
private var _slideOutIncrements:Float;
|
||||
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
|
||||
|
||||
private var _currentObject:Dynamic;
|
||||
|
||||
public function new()
|
||||
{
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves an object until is shown
|
||||
* @param event
|
||||
*/
|
||||
private function slideInTimer(event:TimerEvent):Void
|
||||
{
|
||||
var last:Bool = false;
|
||||
switch(_slideInPosition)
|
||||
{
|
||||
case "top":
|
||||
if (_currentObject.y >= _slideInOrigY) { last = true; }
|
||||
_currentObject.y += _slideInIncrements;
|
||||
|
||||
case "left":
|
||||
if (_currentObject.x >= _slideInOrigX) { last = true; }
|
||||
_currentObject.x += _slideInIncrements;
|
||||
|
||||
case "bottom":
|
||||
if (_currentObject.y <= _slideInOrigY) { last = true; }
|
||||
_currentObject.y -= _slideInIncrements;
|
||||
|
||||
case "right":
|
||||
if (_currentObject.x <= _slideInOrigX) { last = true; }
|
||||
_currentObject.x -= _slideInIncrements;
|
||||
}
|
||||
|
||||
if (last)
|
||||
{
|
||||
_currentObject.x = _slideInOrigX;
|
||||
_currentObject.y = _slideInOrigY;
|
||||
_slideInTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves an object until is hidden
|
||||
* @param event
|
||||
*/
|
||||
private function slideOutTimer(event:TimerEvent):Void
|
||||
{
|
||||
if (((_currentObject.x + _currentObject.width) < 0) || (_currentObject.y + _currentObject.height < 0))
|
||||
{
|
||||
_currentObject.visible = false;
|
||||
_currentObject.x = _slideOutOrigX;
|
||||
_currentObject.y = _slideOutOrigY;
|
||||
|
||||
_slideOutTimer.stop();
|
||||
}
|
||||
else if (((_currentObject.x) > _stage.stageWidth) || (_currentObject.y > _stage.stageHeight))
|
||||
{
|
||||
_currentObject.visible = false;
|
||||
_currentObject.x = _slideOutOrigX;
|
||||
_currentObject.y = _slideOutOrigY;
|
||||
|
||||
_slideOutTimer.stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(_slideOutPosition)
|
||||
{
|
||||
case "top":
|
||||
_currentObject.y -= _slideOutIncrements;
|
||||
|
||||
case "left":
|
||||
_currentObject.x -= _slideOutIncrements;
|
||||
|
||||
case "bottom":
|
||||
_currentObject.y += _slideOutIncrements;
|
||||
|
||||
case "right":
|
||||
_currentObject.x += _slideOutIncrements;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower object transparency until not visible
|
||||
* @param event
|
||||
*/
|
||||
private function fadeOutTimer(event:TimerEvent):Void
|
||||
{
|
||||
if (_currentObject.alpha > 0)
|
||||
{
|
||||
_currentObject.alpha -= 1 / 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentObject.visible = false;
|
||||
_fadeOutTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Highers object transparency until visible
|
||||
* @param event
|
||||
*/
|
||||
private function fadeInTimer(event:TimerEvent):Void
|
||||
{
|
||||
if (_currentObject.alpha < 1)
|
||||
{
|
||||
_currentObject.alpha += 1 / 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
_fadeInTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Effect that moves an object into stage
|
||||
* @param object the element to move
|
||||
* @param slidePosition could be top, left bottom or right
|
||||
* @param speed the time in seconds for duration of the animation
|
||||
*/
|
||||
public function slideIn(object:Dynamic, slidePosition:String, speed:Float=1000):Void
|
||||
{
|
||||
if (object.visible)
|
||||
{
|
||||
object.visible = false;
|
||||
}
|
||||
|
||||
_slideInOrigX = object.x;
|
||||
_slideInOrigY = object.y;
|
||||
_slideInPosition = slidePosition;
|
||||
|
||||
var increments:Float = 0;
|
||||
|
||||
switch(slidePosition)
|
||||
{
|
||||
case "top":
|
||||
object.y = 0 - object.height;
|
||||
increments = object.height + _slideInOrigY;
|
||||
|
||||
case "left":
|
||||
object.x = 0 - object.width;
|
||||
increments = object.width + _slideInOrigX;
|
||||
|
||||
case "bottom":
|
||||
object.y = _stage.stageHeight;
|
||||
increments = _stage.stageHeight - _slideInOrigY;
|
||||
|
||||
case "right":
|
||||
object.x = _stage.stageWidth;
|
||||
increments = _stage.stageWidth - _slideInOrigX;
|
||||
}
|
||||
|
||||
_slideInIncrements = increments / (speed / 100);
|
||||
|
||||
_currentObject = object;
|
||||
_currentObject.visible = true;
|
||||
_currentObject.alpha = 1;
|
||||
|
||||
_slideInTimer = new Timer(speed / 100);
|
||||
_slideInTimer.addEventListener(TimerEvent.TIMER, slideInTimer);
|
||||
_slideInTimer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Effect that moves an object out of stage
|
||||
* @param object the element to move
|
||||
* @param slidePosition could be top, left bottom or right
|
||||
* @param speed the time in seconds for duration of the animation
|
||||
*/
|
||||
public function slideOut(object:Dynamic, slidePosition:String, speed:Float=1000):Void
|
||||
{
|
||||
if (!object.visible)
|
||||
{
|
||||
object.visible = true;
|
||||
}
|
||||
|
||||
_slideOutOrigX = object.x;
|
||||
_slideOutOrigY = object.y;
|
||||
_slideOutPosition = slidePosition;
|
||||
|
||||
var increments:Float = 0;
|
||||
|
||||
switch(slidePosition)
|
||||
{
|
||||
case "top":
|
||||
increments = object.height + _slideOutOrigY;
|
||||
|
||||
case "left":
|
||||
increments = object.width + _slideOutOrigX;
|
||||
|
||||
case "bottom":
|
||||
increments = _stage.stageHeight - _slideOutOrigY;
|
||||
|
||||
case "right":
|
||||
increments = _stage.stageWidth - _slideOutOrigX;
|
||||
}
|
||||
|
||||
_slideOutIncrements = increments / (speed / 100);
|
||||
|
||||
_currentObject = object;
|
||||
_currentObject.visible = true;
|
||||
_currentObject.alpha = 1;
|
||||
|
||||
_slideOutTimer = new Timer(speed / 100);
|
||||
_slideOutTimer.addEventListener(TimerEvent.TIMER, slideOutTimer);
|
||||
_slideOutTimer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Effect that dissapears an object from stage
|
||||
* @param object the element to dissapear
|
||||
* @param speed the time in seconds for the duration of the animation
|
||||
*/
|
||||
public function fadeOut(object:Dynamic, speed:Float=500):Void
|
||||
{
|
||||
if (!object.visible)
|
||||
{
|
||||
object.visible = true;
|
||||
}
|
||||
|
||||
object.alpha = 1;
|
||||
_currentObject = object;
|
||||
|
||||
_fadeOutTimer = new Timer(speed / 10);
|
||||
_fadeOutTimer.addEventListener(TimerEvent.TIMER, fadeOutTimer);
|
||||
_fadeOutTimer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Effect that shows a hidden object an in stage
|
||||
* @param object the element to show
|
||||
* @param speed the time in seconds for the duration of the animation
|
||||
*/
|
||||
public function fadeIn(object:Dynamic, speed:Float=500):Void
|
||||
{
|
||||
if (object.visible)
|
||||
{
|
||||
object.visible = false;
|
||||
}
|
||||
|
||||
object.alpha = 0;
|
||||
_currentObject = object;
|
||||
_currentObject.visible = true;
|
||||
|
||||
_fadeInTimer = new Timer(speed / 10);
|
||||
_fadeInTimer.addEventListener(TimerEvent.TIMER, fadeInTimer);
|
||||
_fadeInTimer.start();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,181 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.display.Stage;
|
||||
import flash.events.Event;
|
||||
import flash.Lib;
|
||||
|
||||
/**
|
||||
* 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 _brightColor:UInt;
|
||||
private var _controlColor: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);
|
||||
|
||||
_brightColor = 0x4c4c4c;
|
||||
_controlColor = 0xFFFFFF;
|
||||
|
||||
_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(_brightColor, 0.5);
|
||||
_background.graphics.drawRoundRect(0, 0, backgroundWidth, backgroundHeight, 6, 6);
|
||||
_background.graphics.endFill();
|
||||
|
||||
//Draw track
|
||||
var trackWidth:Float = (50 / 100) * _stage.stageWidth;
|
||||
var trackHeight:Float = 15;
|
||||
_loaderTrack.x = (_stage.stageWidth / 2) - (trackWidth / 2);
|
||||
_loaderTrack.y = (_stage.stageHeight / 2) - (trackHeight / 2);
|
||||
_loaderTrack.graphics.lineStyle(2, _controlColor);
|
||||
_loaderTrack.graphics.drawRect(0, 0, trackWidth, trackHeight);
|
||||
|
||||
//Draw thumb
|
||||
_loaderThumb.x = _loaderTrack.x;
|
||||
_loaderThumb.y = _loaderTrack.y;
|
||||
_loaderThumb.graphics.lineStyle();
|
||||
_loaderThumb.graphics.beginFill(_controlColor, 1);
|
||||
_loaderThumb.graphics.drawRect(0, 0, trackHeight, trackHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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[1].length > 0? Std.parseInt("0x" + colors[1]) : 0xFFFFFF;
|
||||
|
||||
drawLoader();
|
||||
}
|
||||
}
|
|
@ -1,185 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.display.Stage;
|
||||
import flash.events.Event;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.Lib;
|
||||
import flash.net.URLRequest;
|
||||
|
||||
/**
|
||||
* To display an image in jpg, png or gif format as logo
|
||||
*/
|
||||
class Logo extends Sprite
|
||||
{
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _loader:Loader;
|
||||
private var _position:String;
|
||||
private var _alpha:Float;
|
||||
private var _source:String;
|
||||
private var _width:Float;
|
||||
private var _link:String;
|
||||
private var _loading:Bool;
|
||||
|
||||
public function new(source:String, position:String, alpha:Float, width:Float=0.0)
|
||||
{
|
||||
super();
|
||||
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
_loader = new Loader();
|
||||
_position = position;
|
||||
_alpha = alpha;
|
||||
_source = source;
|
||||
_width = width;
|
||||
_loading = true;
|
||||
|
||||
this.tabEnabled = false;
|
||||
|
||||
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
|
||||
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onNotLoaded);
|
||||
_loader.load(new URLRequest(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers when the logo image could not be loaded
|
||||
* @param event
|
||||
*/
|
||||
private function onNotLoaded(event:IOErrorEvent):Void
|
||||
{
|
||||
//Image not loaded
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers when the logo image finished loading.
|
||||
* @param event
|
||||
*/
|
||||
private function onLoaderComplete(event:Event):Void
|
||||
{
|
||||
addChild(_loader);
|
||||
|
||||
setWidth(_width);
|
||||
setPosition(_position);
|
||||
setAlpha(_alpha);
|
||||
_loading = false;
|
||||
|
||||
_stage.addEventListener(Event.RESIZE, onStageResize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalculate logo position on stage resize
|
||||
* @param event
|
||||
*/
|
||||
private function onStageResize(event:Event):Void
|
||||
{
|
||||
setPosition(_position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the an url when the logo is clicked
|
||||
* @param event
|
||||
*/
|
||||
private function onLogoClick(event:MouseEvent):Void
|
||||
{
|
||||
Lib.getURL(new URLRequest(_link), "_blank");
|
||||
}
|
||||
|
||||
/**
|
||||
* Position where logo will be showing
|
||||
* @param position values could be top left, top right, bottom left, bottom right
|
||||
*/
|
||||
public function setPosition(position:String):Void
|
||||
{
|
||||
switch(position)
|
||||
{
|
||||
case "top left":
|
||||
this.x = 25;
|
||||
this.y = 25;
|
||||
|
||||
case "top right":
|
||||
this.x = _stage.stageWidth - this._width - 25;
|
||||
this.y = 25;
|
||||
|
||||
case "bottom left":
|
||||
this.x = 25;
|
||||
this.y = _stage.stageHeight - this.height - 25;
|
||||
|
||||
case "bottom right":
|
||||
this.x = _stage.stageWidth - this.width - 25;
|
||||
this.y = _stage.stageHeight - this.height - 25;
|
||||
|
||||
default:
|
||||
this.x = 25;
|
||||
this.y = 25;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To set logo transparency
|
||||
* @param alpha
|
||||
*/
|
||||
public function setAlpha(alpha:Float):Void
|
||||
{
|
||||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets logo width and recalculates height keeping aspect ratio
|
||||
* @param width
|
||||
*/
|
||||
public function setWidth(width:Float):Void
|
||||
{
|
||||
if (width > 0)
|
||||
{
|
||||
this.height = (this.height / this.width) * width;
|
||||
this.width = width;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Link that opens when clicked the logo image is clicked
|
||||
* @param link
|
||||
*/
|
||||
public function setLink(link:String):Void
|
||||
{
|
||||
_link = link;
|
||||
this.buttonMode = true;
|
||||
this.useHandCursor = true;
|
||||
this.addEventListener(MouseEvent.CLICK, onLogoClick);
|
||||
}
|
||||
|
||||
/**
|
||||
* To check if the logo stills loading
|
||||
* @return true if loading false otherwise
|
||||
*/
|
||||
public function isLoading():Bool
|
||||
{
|
||||
return _loading;
|
||||
}
|
||||
}
|
|
@ -1,246 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.ContextMenuEvent;
|
||||
import flash.Lib;
|
||||
import flash.net.URLRequest;
|
||||
import flash.ui.ContextMenu;
|
||||
import flash.ui.ContextMenuItem;
|
||||
import jaris.player.Player;
|
||||
import jaris.player.AspectRatio;
|
||||
import jaris.Version;
|
||||
|
||||
/**
|
||||
* Modify original context menu
|
||||
*/
|
||||
class Menu
|
||||
{
|
||||
private var _movieClip:MovieClip;
|
||||
public static var _player:Player;
|
||||
|
||||
private var _contextMenu:ContextMenu;
|
||||
private var _jarisVersionMenuItem:ContextMenuItem;
|
||||
private var _playMenuItem:ContextMenuItem;
|
||||
private var _fullscreenMenuItem:ContextMenuItem;
|
||||
private var _aspectRatioMenuItem:ContextMenuItem;
|
||||
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);
|
||||
|
||||
//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);
|
||||
_playMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onPlay);
|
||||
|
||||
_fullscreenMenuItem = new ContextMenuItem("Fullscreen View (F)");
|
||||
_fullscreenMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onFullscreen);
|
||||
|
||||
_aspectRatioMenuItem = new ContextMenuItem("Aspect Ratio (original) (TAB)");
|
||||
_aspectRatioMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onAspectRatio);
|
||||
|
||||
_muteMenuItem = new ContextMenuItem("Mute (M)");
|
||||
_muteMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onMute);
|
||||
|
||||
_volumeUpMenuItem = new ContextMenuItem("Volume + (arrow UP)");
|
||||
_volumeUpMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onVolumeUp);
|
||||
|
||||
_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);
|
||||
_contextMenu.customItems.push(_aspectRatioMenuItem);
|
||||
_contextMenu.customItems.push(_muteMenuItem);
|
||||
_contextMenu.customItems.push(_volumeUpMenuItem);
|
||||
_contextMenu.customItems.push(_volumeDownMenuItem);
|
||||
_contextMenu.customItems.push(_qualityContextMenu);
|
||||
|
||||
//override default context menu
|
||||
_movieClip.contextMenu = _contextMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update context menu item captions depending on player status before showing them
|
||||
* @param event
|
||||
*/
|
||||
private function onMenuOpen(event:ContextMenuEvent):Void
|
||||
{
|
||||
if (_player.isPlaying())
|
||||
{
|
||||
_playMenuItem.caption = "Pause (SPACE)";
|
||||
}
|
||||
else
|
||||
{
|
||||
_playMenuItem.caption = "Play (SPACE)";
|
||||
}
|
||||
|
||||
if (_player.isFullscreen())
|
||||
{
|
||||
_fullscreenMenuItem.caption = "Normal View";
|
||||
}
|
||||
else
|
||||
{
|
||||
_fullscreenMenuItem.caption = "Fullscreen View (F)";
|
||||
}
|
||||
|
||||
if (_player.getMute())
|
||||
{
|
||||
_muteMenuItem.caption = _player.isFullscreen()?"Unmute":"Unmute (M)";
|
||||
}
|
||||
else
|
||||
{
|
||||
_muteMenuItem.caption = _player.isFullscreen()?"Mute":"Mute (M)";
|
||||
}
|
||||
|
||||
switch(_player.getAspectRatioString())
|
||||
{
|
||||
case "original":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (1:1) (TAB)";
|
||||
|
||||
case "1:1":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (3:2) (TAB)";
|
||||
|
||||
case "3:2":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (4:3) (TAB)";
|
||||
|
||||
case "4:3":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (5:4) (TAB)";
|
||||
|
||||
case "5:4":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (14:9) (TAB)";
|
||||
|
||||
case "14:9":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (14:10) (TAB)";
|
||||
|
||||
case "14:10":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (16:9) (TAB)";
|
||||
|
||||
case "16:9":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (16:10) (TAB)";
|
||||
|
||||
case "16:10":
|
||||
_aspectRatioMenuItem.caption = "Aspect Ratio (original) (TAB)";
|
||||
}
|
||||
|
||||
if (_player.getQuality())
|
||||
{
|
||||
_qualityContextMenu.caption = "Lower Quality";
|
||||
}
|
||||
else
|
||||
{
|
||||
_qualityContextMenu.caption = "Higher Quality";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open jaris player website
|
||||
* @param event
|
||||
*/
|
||||
private function onJarisVersion(event:ContextMenuEvent)
|
||||
{
|
||||
Lib.getURL(new URLRequest("http://jaris.sourceforge.net"), "_blank");
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles playback
|
||||
* @param event
|
||||
*/
|
||||
private function onPlay(event:ContextMenuEvent)
|
||||
{
|
||||
_player.togglePlay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles fullscreen
|
||||
* @param event
|
||||
*/
|
||||
private function onFullscreen(event:ContextMenuEvent)
|
||||
{
|
||||
_player.toggleFullscreen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles aspect ratio
|
||||
* @param event
|
||||
*/
|
||||
private function onAspectRatio(event:ContextMenuEvent)
|
||||
{
|
||||
_player.toggleAspectRatio();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles mute
|
||||
* @param event
|
||||
*/
|
||||
private function onMute(event:ContextMenuEvent)
|
||||
{
|
||||
_player.toggleMute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise volume
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeUp(event:ContextMenuEvent)
|
||||
{
|
||||
_player.volumeUp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower volume
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeDown(event:ContextMenuEvent)
|
||||
{
|
||||
_player.volumeDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle video quality
|
||||
* @param event
|
||||
*/
|
||||
private function onQuality(event:ContextMenuEvent)
|
||||
{
|
||||
_player.toggleQuality();
|
||||
}
|
||||
}
|
|
@ -1,170 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.display.Stage;
|
||||
import flash.events.Event;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.Lib;
|
||||
import flash.net.URLRequest;
|
||||
import jaris.events.PlayerEvents;
|
||||
import jaris.player.InputType;
|
||||
import jaris.player.Player;
|
||||
|
||||
/**
|
||||
* To display an png, jpg or gif as preview of video content
|
||||
*/
|
||||
class Poster extends Sprite
|
||||
{
|
||||
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _loader:Loader;
|
||||
private var _source:String;
|
||||
private var _width:Float;
|
||||
private var _height:Float;
|
||||
private var _loading:Bool;
|
||||
private var _loaderStatus:jaris.display.Loader;
|
||||
private var _player:Player;
|
||||
|
||||
public function new(source:String)
|
||||
{
|
||||
super();
|
||||
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
_loader = new Loader();
|
||||
_source = source;
|
||||
_loading = true;
|
||||
|
||||
//Reads flash vars
|
||||
var parameters:Dynamic<String> = flash.Lib.current.loaderInfo.parameters;
|
||||
|
||||
//Draw Loader status
|
||||
var loaderColors:Array <String> = ["", "", "", ""];
|
||||
loaderColors[0] = parameters.brightcolor != null ? parameters.brightcolor : "";
|
||||
loaderColors[1] = parameters.controlcolor != null ? parameters.controlcolor : "";
|
||||
|
||||
_loaderStatus = new jaris.display.Loader();
|
||||
_loaderStatus.show();
|
||||
_loaderStatus.setColors(loaderColors);
|
||||
addChild(_loaderStatus);
|
||||
|
||||
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
|
||||
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onNotLoaded);
|
||||
_loader.load(new URLRequest(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers when the poster image could not be loaded
|
||||
* @param event
|
||||
*/
|
||||
private function onNotLoaded(event:IOErrorEvent):Void
|
||||
{
|
||||
_loaderStatus.hide();
|
||||
removeChild(_loaderStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers when the poster image finalized loading
|
||||
* @param event
|
||||
*/
|
||||
private function onLoaderComplete(event:Event):Void
|
||||
{
|
||||
_loaderStatus.hide();
|
||||
removeChild(_loaderStatus);
|
||||
|
||||
addChild(_loader);
|
||||
|
||||
_width = this.width;
|
||||
_height = this.height;
|
||||
_loading = false;
|
||||
|
||||
_stage.addEventListener(Event.RESIZE, onStageResize);
|
||||
|
||||
resizeImage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers when the stage is resized to resize the poster image
|
||||
* @param event
|
||||
*/
|
||||
private function onStageResize(event:Event):Void
|
||||
{
|
||||
resizeImage();
|
||||
}
|
||||
|
||||
private function onPlayerMediaInitialized(event:PlayerEvents)
|
||||
{
|
||||
if (_player.getType() == InputType.VIDEO)
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPlayerPlay(event:PlayerEvents)
|
||||
{
|
||||
if (_player.getType() == InputType.VIDEO)
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPlayBackFinished(event:PlayerEvents)
|
||||
{
|
||||
this.visible = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the poster image to take all the stage
|
||||
*/
|
||||
private function resizeImage():Void
|
||||
{
|
||||
this.height = _stage.stageHeight;
|
||||
this.width = ((_width / _height) * this.height);
|
||||
|
||||
this.x = (_stage.stageWidth / 2) - (this.width / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* To check if the poster image stills loading
|
||||
* @return true if stills loading false if loaded
|
||||
*/
|
||||
public function isLoading():Bool
|
||||
{
|
||||
return _loading;
|
||||
}
|
||||
|
||||
public function setPlayer(player:Player):Void
|
||||
{
|
||||
_player = player;
|
||||
_player.addEventListener(PlayerEvents.MEDIA_INITIALIZED, onPlayerMediaInitialized);
|
||||
_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayBackFinished);
|
||||
_player.addEventListener(PlayerEvents.PLAY_PAUSE, onPlayerPlay);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
import flash.events.Event;
|
||||
import flash.media.ID3Info;
|
||||
import flash.media.Sound;
|
||||
import flash.net.NetStream;
|
||||
|
||||
/**
|
||||
* Implements the player events
|
||||
*/
|
||||
class PlayerEvents extends Event
|
||||
{
|
||||
public static var ASPECT_RATIO = "onAspectRatio";
|
||||
public static var MOUSE_SHOW = "onMouseShow";
|
||||
public static var MOUSE_HIDE = "onMouseHide";
|
||||
public static var FULLSCREEN = "onFullscreen";
|
||||
public static var VOLUME_UP = "onVolumeUp";
|
||||
public static var VOLUME_DOWN = "onVolumeDown";
|
||||
public static var VOLUME_CHANGE= "onVolumeChange"; //Nuevo
|
||||
public static var MUTE = "onMute";
|
||||
public static var FORWARD = "onForward";
|
||||
public static var REWIND = "onRewind";
|
||||
public static var PLAY_PAUSE = "onPlayPause";
|
||||
public static var SEEK = "onSeek";
|
||||
public static var TIME = "onTimeUpdate";
|
||||
public static var PROGRESS = "onProgress";
|
||||
public static var BUFFERING = "onBuffering";
|
||||
public static var NOT_BUFFERING = "onNotBuffering";
|
||||
public static var CONNECTION_FAILED = "onConnectionFailed";
|
||||
public static var CONNECTION_SUCCESS = "onConnectionSuccess";
|
||||
public static var MEDIA_INITIALIZED = "onDataInitialized";
|
||||
public static var PLAYBACK_FINISHED = "onPlaybackFinished";
|
||||
public static var STOP_CLOSE = "onStopAndClose";
|
||||
public static var RESIZE = "onResize";
|
||||
|
||||
public var name:String;
|
||||
public var aspectRatio:Float;
|
||||
public var duration:Float;
|
||||
public var fullscreen:Bool;
|
||||
public var mute:Bool;
|
||||
public var volume:Float;
|
||||
public var width:Float;
|
||||
public var height:Float;
|
||||
public var stream:NetStream;
|
||||
public var sound:Sound;
|
||||
public var time:Float;
|
||||
public var id3Info:ID3Info;
|
||||
|
||||
public function new(type:String, bubbles:Bool=false, cancelable:Bool=false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
|
||||
fullscreen = false;
|
||||
mute = false;
|
||||
volume = 1.0;
|
||||
duration = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
time = 0;
|
||||
name = type;
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Stores the player used aspect ratio constants
|
||||
*/
|
||||
class AspectRatio
|
||||
{
|
||||
public static var _1_1:Float = 1 / 1;
|
||||
public static var _3_2:Float = 3 / 2;
|
||||
public static var _4_3:Float = 4 / 3;
|
||||
public static var _5_4:Float = 5 / 4;
|
||||
public static var _14_9:Float = 14 / 9;
|
||||
public static var _14_10:Float = 14 / 10;
|
||||
public static var _16_9:Float = 16 / 9;
|
||||
public static var _16_10:Float = 16 / 10;
|
||||
|
||||
/**
|
||||
* Calculates the ratio for a given width and height
|
||||
* @param width
|
||||
* @param height
|
||||
* @return aspect ratio
|
||||
*/
|
||||
public static function getAspectRatio(width:Float, height:Float):Float
|
||||
{
|
||||
return width / height;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Stores the identifiers for loaded media type
|
||||
*/
|
||||
class InputType
|
||||
{
|
||||
public static var AUDIO = "audio";
|
||||
public static var VIDEO = "video";
|
||||
}
|
|
@ -1,232 +0,0 @@
|
|||
/**
|
||||
* @author Sascha Kluger
|
||||
* @copyright 2010 Jefferson González, Sascha Kluger
|
||||
*
|
||||
* @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;
|
||||
|
||||
//{Libraries
|
||||
import flash.system.Capabilities;
|
||||
import flash.system.Security;
|
||||
import flash.external.ExternalInterface;
|
||||
import flash.display.GradientType;
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Matrix;
|
||||
import flash.Lib;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.display.MovieClip;
|
||||
import flash.net.NetStream;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.net.ObjectEncoding;
|
||||
import flash.text.AntiAliasType;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
import flash.text.TextFormat;
|
||||
import flash.utils.Timer;
|
||||
import jaris.animation.Animation;
|
||||
import jaris.display.Loader;
|
||||
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;
|
||||
import jaris.utils.Utils;
|
||||
//}
|
||||
|
||||
/**
|
||||
* Default controls for jaris player
|
||||
*/
|
||||
class JsApi extends MovieClip {
|
||||
|
||||
//{Member Variables
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _player:Player;
|
||||
private var _isBuffering:Bool;
|
||||
private var _percentLoaded:Float;
|
||||
private var _externalListeners:Hash<String>;
|
||||
|
||||
//}
|
||||
|
||||
|
||||
//{Constructor
|
||||
public function new(player:Player)
|
||||
{
|
||||
super();
|
||||
_externalListeners = new Hash<String>();
|
||||
|
||||
Security.allowDomain("*");
|
||||
|
||||
//{Main variables
|
||||
// _stage = Lib.current.stage;
|
||||
// _movieClip = Lib.current;
|
||||
_player = player;
|
||||
|
||||
_player.addEventListener(PlayerEvents.MOUSE_HIDE, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.MOUSE_SHOW, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.MEDIA_INITIALIZED, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.BUFFERING, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.NOT_BUFFERING, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.RESIZE, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.PLAY_PAUSE, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.CONNECTION_FAILED, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.ASPECT_RATIO, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.VOLUME_UP, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.VOLUME_DOWN, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.VOLUME_CHANGE, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.MUTE, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.TIME, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.PROGRESS, onPlayerEvent);
|
||||
_player.addEventListener(PlayerEvents.SEEK, onPlayerEvent);
|
||||
|
||||
ExternalInterface.addCallback("api_get", getAttribute);
|
||||
ExternalInterface.addCallback("api_addlistener", addJsListener);
|
||||
ExternalInterface.addCallback("api_removelistener", removeJsListener);
|
||||
ExternalInterface.addCallback("api_play", setPlay);
|
||||
ExternalInterface.addCallback("api_pause", setPause);
|
||||
ExternalInterface.addCallback("api_seek", setSeek);
|
||||
ExternalInterface.addCallback("api_volume", setVolume);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getAttribute(attribute:String):Float {
|
||||
|
||||
switch (attribute) {
|
||||
case 'isBuffering':
|
||||
return (_isBuffering) ? 1 : 0;
|
||||
|
||||
case 'isPlaying':
|
||||
return (_player.isPlaying()) ? 1 : 0;
|
||||
|
||||
case 'time':
|
||||
return Math.round(_player.getCurrentTime() * 10) / 10;
|
||||
|
||||
case 'loaded':
|
||||
return _player.getBytesLoaded();
|
||||
|
||||
case 'volume':
|
||||
return (_player.getMute()==true) ? 0 : _player.getVolume();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function addJsListener(attribute:String, parameter:String):Void {
|
||||
_externalListeners.set(attribute.toLowerCase(), parameter);
|
||||
}
|
||||
|
||||
public function removeJsListener(attribute:String):Void {
|
||||
if (attribute == '*')
|
||||
{
|
||||
_externalListeners = new Hash<String>();
|
||||
return;
|
||||
}
|
||||
_externalListeners.remove(attribute.toLowerCase());
|
||||
}
|
||||
|
||||
public function onPlayerEvent(event:PlayerEvents):Void
|
||||
{
|
||||
var jsFunction = '';
|
||||
var data = {
|
||||
duration: event.duration,
|
||||
fullscreen: event.fullscreen,
|
||||
mute: event.mute,
|
||||
volume: event.volume,
|
||||
position: event.time,
|
||||
type: event.name,
|
||||
loaded: _player.getBytesLoaded(),
|
||||
total: _player.getBytesTotal()
|
||||
};
|
||||
|
||||
if (_externalListeners.exists(event.name.toLowerCase()))
|
||||
{
|
||||
ExternalInterface.call(_externalListeners.get(event.name.toLowerCase()), data);
|
||||
}
|
||||
|
||||
if (_externalListeners.exists('on*'))
|
||||
{
|
||||
ExternalInterface.call(_externalListeners.get('on*'), data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Toggles pause or play
|
||||
*/
|
||||
private function setPlay():Void
|
||||
{
|
||||
if (_player.isPlaying()!=true) {
|
||||
_player.togglePlay();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles play or pause
|
||||
*/
|
||||
private function setPause():Void
|
||||
{
|
||||
if (_player.isPlaying()==true) {
|
||||
_player.togglePlay();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Seek
|
||||
*/
|
||||
private function setSeek(pos:Float):Void
|
||||
{
|
||||
_player.seek(pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Volume
|
||||
*/
|
||||
private function setVolume(vol:Float):Void
|
||||
{
|
||||
if (vol <= 0 && _player.getMute()!=true) {
|
||||
_player.toggleMute();
|
||||
_player.setVolume(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player.getMute() == true) {
|
||||
_player.toggleMute();
|
||||
}
|
||||
|
||||
if (vol >= 1) {
|
||||
_player.setVolume(1);
|
||||
return;
|
||||
}
|
||||
|
||||
_player.setVolume(vol);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
//{Libraries
|
||||
import jaris.events.PlayerEvents;
|
||||
//}
|
||||
|
||||
/**
|
||||
* Implements a loop mechanism on the player
|
||||
*/
|
||||
class Loop
|
||||
{
|
||||
private var _player:Player;
|
||||
|
||||
public function new(player:Player)
|
||||
{
|
||||
_player = player;
|
||||
_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayerStop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Everytime the player stops, the playback is restarted
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerStop(event:PlayerEvents):Void
|
||||
{
|
||||
_player.togglePlay();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Some constants for the stream types
|
||||
*/
|
||||
class StreamType
|
||||
{
|
||||
public static var FILE:String = "file";
|
||||
public static var PSEUDOSTREAM:String = "http";
|
||||
public static var RTMP:String = "rtmp";
|
||||
public static var YOUTUBE = "youtube";
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/**
|
||||
* @author Jefferson González
|
||||
* @copyright 2010 Jefferson González
|
||||
*
|
||||
* @license
|
||||
* This file is part of Jaris FLV Player.
|
||||
*
|
||||
* Jaris FLV Player is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License or GNU LESSER GENERAL
|
||||
* PUBLIC LICENSE as published by the Free Software Foundation, either version
|
||||
* 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Jaris FLV Player is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE along with Jaris FLV Player. If not,
|
||||
* see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package jaris.player;
|
||||
|
||||
import flash.net.SharedObject;
|
||||
|
||||
|
||||
/**
|
||||
* To store and retrieve user settings so the player can load them next time it loads.
|
||||
* In this way player can remember user selected aspect ratio and volume.
|
||||
*/
|
||||
class UserSettings
|
||||
{
|
||||
private var _settings:SharedObject;
|
||||
|
||||
public function new()
|
||||
{
|
||||
_settings = SharedObject.getLocal("JarisPlayerUserSettings");
|
||||
}
|
||||
|
||||
//{Methods
|
||||
/**
|
||||
* Deletes all user settings
|
||||
*/
|
||||
public function deleteSettings():Void
|
||||
{
|
||||
_settings.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a user setting is available
|
||||
* @param field The name of the setting
|
||||
* @return true if is set false otherwise
|
||||
*/
|
||||
public function isSet(field:String):Bool
|
||||
{
|
||||
return Reflect.hasField(_settings.data, field);
|
||||
}
|
||||
//}
|
||||
|
||||
//{Properties Setters
|
||||
/**
|
||||
* Stores the volume value
|
||||
* @param level
|
||||
*/
|
||||
public function setVolume(level:Float):Void
|
||||
{
|
||||
_settings.data.volume = level;
|
||||
_settings.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the aspect ratio value
|
||||
* @param aspect
|
||||
*/
|
||||
public function setAspectRatio(aspectratio:Float):Void
|
||||
{
|
||||
_settings.data.aspectratio = aspectratio;
|
||||
_settings.flush();
|
||||
}
|
||||
//}
|
||||
|
||||
//{Properties Getters
|
||||
/**
|
||||
* The last user selected volume value
|
||||
* @return Last user selected volume value or default if not set.
|
||||
*/
|
||||
public function getVolume():Float
|
||||
{
|
||||
if (!isSet("volume"))
|
||||
{
|
||||
return 1.0; //The maximum volume value
|
||||
}
|
||||
|
||||
return _settings.data.volume;
|
||||
}
|
||||
|
||||
/**
|
||||
* The last user selected aspect ratio value
|
||||
* @return Last user selected aspect ratio value or default if not set.
|
||||
*/
|
||||
public function getAspectRatio():Float
|
||||
{
|
||||
if (!isSet("aspectratio"))
|
||||
{
|
||||
return 0.0; //Equivalent to original
|
||||
}
|
||||
|
||||
return _settings.data.aspectratio;
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,912 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
//{Libraries
|
||||
import flash.display.GradientType;
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Matrix;
|
||||
import flash.Lib;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.display.MovieClip;
|
||||
import flash.net.NetStream;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.text.AntiAliasType;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
import flash.text.TextFormat;
|
||||
import flash.utils.Timer;
|
||||
import jaris.animation.Animation;
|
||||
import jaris.display.Loader;
|
||||
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;
|
||||
import jaris.utils.Utils;
|
||||
//}
|
||||
|
||||
/**
|
||||
* Default controls for jaris player
|
||||
*/
|
||||
class Controls extends MovieClip {
|
||||
|
||||
//{Member Variables
|
||||
private var _thumb:Sprite;
|
||||
private var _track:Sprite;
|
||||
private var _trackDownloaded:Sprite;
|
||||
private var _scrubbing:Bool;
|
||||
private var _stage:Stage;
|
||||
private var _movieClip:MovieClip;
|
||||
private var _player:Player;
|
||||
private var _darkColor:UInt;
|
||||
private var _brightColor:UInt;
|
||||
private var _controlColor:UInt;
|
||||
private var _hoverColor:UInt;
|
||||
private var _hideControlsTimer:Timer;
|
||||
private var _hideAspectRatioLabelTimer:Timer;
|
||||
private var _currentPlayTimeLabel:TextField;
|
||||
private var _totalPlayTimeLabel:TextField;
|
||||
private var _seekPlayTimeLabel:TextField;
|
||||
private var _percentLoaded:Float;
|
||||
private var _controlsVisible:Bool;
|
||||
private var _seekBar:Sprite;
|
||||
private var _controlsBar: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;
|
||||
private var _aspectRatioLabelContainer:Sprite;
|
||||
private var _aspectRatioLabel:TextField;
|
||||
private var _textFormat:TextFormat;
|
||||
//}
|
||||
|
||||
|
||||
//{Constructor
|
||||
public function new(player:Player)
|
||||
{
|
||||
super();
|
||||
|
||||
//{Main variables
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
_player = player;
|
||||
_darkColor = 0x000000;
|
||||
_brightColor = 0x4c4c4c;
|
||||
_controlColor = 0xFFFFFF;
|
||||
_hoverColor = 0x67A8C1;
|
||||
_percentLoaded = 0.0;
|
||||
_hideControlsTimer = new Timer(500);
|
||||
_hideAspectRatioLabelTimer = new Timer(500);
|
||||
_controlsVisible = false;
|
||||
|
||||
_textFormat = new TextFormat();
|
||||
_textFormat.font = "arial";
|
||||
_textFormat.color = _controlColor;
|
||||
_textFormat.size = 14;
|
||||
//}
|
||||
|
||||
//{Seeking Controls initialization
|
||||
_seekBar = new Sprite();
|
||||
addChild(_seekBar);
|
||||
|
||||
_trackDownloaded = new Sprite( );
|
||||
_trackDownloaded.tabEnabled = false;
|
||||
_seekBar.addChild(_trackDownloaded);
|
||||
|
||||
_track = new Sprite( );
|
||||
_track.tabEnabled = false;
|
||||
_track.buttonMode = true;
|
||||
_track.useHandCursor = true;
|
||||
_seekBar.addChild(_track);
|
||||
|
||||
|
||||
_thumb = new Sprite( );
|
||||
_thumb.buttonMode = true;
|
||||
_thumb.useHandCursor = true;
|
||||
_thumb.tabEnabled = false;
|
||||
_seekBar.addChild(_thumb);
|
||||
|
||||
_currentPlayTimeLabel = new TextField();
|
||||
_currentPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_currentPlayTimeLabel.text = "00:00:00";
|
||||
_currentPlayTimeLabel.tabEnabled = false;
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_seekBar.addChild(_currentPlayTimeLabel);
|
||||
|
||||
_totalPlayTimeLabel = new TextField();
|
||||
_totalPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_totalPlayTimeLabel.text = "00:00:00";
|
||||
_totalPlayTimeLabel.tabEnabled = false;
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_seekBar.addChild(_totalPlayTimeLabel);
|
||||
|
||||
_seekPlayTimeLabel = new TextField();
|
||||
_seekPlayTimeLabel.visible = false;
|
||||
_seekPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_seekPlayTimeLabel.text = "00:00:00";
|
||||
_seekPlayTimeLabel.tabEnabled = false;
|
||||
_seekPlayTimeLabel.setTextFormat(_textFormat);
|
||||
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);
|
||||
|
||||
_aspectRatioLabel = new TextField();
|
||||
_aspectRatioLabel.autoSize = TextFieldAutoSize.CENTER;
|
||||
_aspectRatioLabel.text = "original";
|
||||
_aspectRatioLabel.tabEnabled = false;
|
||||
_aspectRatioLabelContainer.addChild(_aspectRatioLabel);
|
||||
//}
|
||||
|
||||
redrawControls();
|
||||
|
||||
//{Loader bar
|
||||
_loader = new Loader();
|
||||
_loader.hide();
|
||||
|
||||
var loaderColors:Array <String> = ["", "", "", ""];
|
||||
loaderColors[0] = Std.string(_brightColor);
|
||||
loaderColors[1] = Std.string(_controlColor);
|
||||
|
||||
_loader.setColors(loaderColors);
|
||||
|
||||
addChild(_loader);
|
||||
//}
|
||||
|
||||
//{event Listeners
|
||||
_movieClip.addEventListener(Event.ENTER_FRAME, onEnterFrame);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_DOWN, onThumbMouseDown);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_UP, onThumbMouseUp);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OVER, onThumbHover);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OUT, onThumbMouseOut);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_MOVE, onTrackMouseMove);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OUT, onTrackMouseOut);
|
||||
_track.addEventListener(MouseEvent.CLICK, onTrackClick);
|
||||
_track.addEventListener(MouseEvent.MOUSE_MOVE, onTrackMouseMove);
|
||||
_track.addEventListener(MouseEvent.MOUSE_OUT, onTrackMouseOut);
|
||||
_playControl.addEventListener(MouseEvent.CLICK, onPlayClick);
|
||||
_pauseControl.addEventListener(MouseEvent.CLICK, onPauseClick);
|
||||
_aspectRatioControl.addEventListener(MouseEvent.CLICK, onAspectRatioClick);
|
||||
_fullscreenControl.addEventListener(MouseEvent.CLICK, onFullscreenClick);
|
||||
_volumeIcon.addEventListener(MouseEvent.CLICK, onVolumeIconClick);
|
||||
_volumeTrack.addEventListener(MouseEvent.CLICK, onVolumeTrackClick);
|
||||
|
||||
_player.addEventListener(PlayerEvents.MOUSE_HIDE, onPlayerMouseHide);
|
||||
_player.addEventListener(PlayerEvents.MOUSE_SHOW, onPlayerMouseShow);
|
||||
_player.addEventListener(PlayerEvents.MEDIA_INITIALIZED, onPlayerMediaInitialized);
|
||||
_player.addEventListener(PlayerEvents.BUFFERING, onPlayerBuffering);
|
||||
_player.addEventListener(PlayerEvents.NOT_BUFFERING, onPlayerNotBuffering);
|
||||
_player.addEventListener(PlayerEvents.RESIZE, onPlayerResize);
|
||||
_player.addEventListener(PlayerEvents.PLAY_PAUSE, onPlayerPlayPause);
|
||||
_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayerPlaybackFinished);
|
||||
_player.addEventListener(PlayerEvents.CONNECTION_FAILED, onPlayerStreamNotFound);
|
||||
_player.addEventListener(PlayerEvents.ASPECT_RATIO, onPlayerAspectRatio);
|
||||
|
||||
_stage.addEventListener(MouseEvent.MOUSE_UP, onThumbMouseUp);
|
||||
_stage.addEventListener(MouseEvent.MOUSE_OUT, onThumbMouseUp);
|
||||
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
|
||||
_stage.addEventListener(Event.RESIZE, onStageResize);
|
||||
|
||||
_hideControlsTimer.addEventListener(TimerEvent.TIMER, hideControlsTimer);
|
||||
_hideAspectRatioLabelTimer.addEventListener(TimerEvent.TIMER, hideAspectRatioLabelTimer);
|
||||
|
||||
_hideControlsTimer.start();
|
||||
//}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Timers
|
||||
/**
|
||||
* Hides the playing controls when not moving mouse.
|
||||
* @param event The timer event associated
|
||||
*/
|
||||
private function hideControlsTimer(event:TimerEvent):Void
|
||||
{
|
||||
if (_player.isPlaying())
|
||||
{
|
||||
if (_controlsVisible)
|
||||
{
|
||||
if (_stage.mouseX < _controlsBar.x ||
|
||||
_stage.mouseX >= _stage.stageWidth - 1 ||
|
||||
_stage.mouseY >= _stage.stageHeight - 1 ||
|
||||
_stage.mouseY <= 1
|
||||
)
|
||||
{
|
||||
_controlsVisible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hideControls();
|
||||
_hideControlsTimer.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides aspect ratio label
|
||||
* @param event
|
||||
*/
|
||||
private function hideAspectRatioLabelTimer(event:TimerEvent):Void
|
||||
{
|
||||
//wait till fade in effect finish
|
||||
if (_aspectRatioLabelContainer.alpha >= 1)
|
||||
{
|
||||
Animation.fadeOut(_aspectRatioLabelContainer, 300);
|
||||
_hideAspectRatioLabelTimer.stop();
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Events
|
||||
/**
|
||||
* Keeps syncronized various elements of the controls like the thumb and download track bar
|
||||
* @param event
|
||||
*/
|
||||
private function onEnterFrame(event:Event):Void
|
||||
{
|
||||
if(_player.getDuration() > 0) {
|
||||
if (_scrubbing)
|
||||
{
|
||||
_player.seek(((_thumb.x - _track.x) / _track.width) * _player.getDuration());
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentPlayTimeLabel.text = Utils.formatTime(_player.getCurrentTime());
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_thumb.x = _player.getCurrentTime() / _player.getDuration() * (_track.width-_thumb.width) + _track.x;
|
||||
}
|
||||
}
|
||||
|
||||
_volumeSlider.height = _volumeTrack.height * (_player.getVolume() / 1.0);
|
||||
_volumeSlider.y = (_volumeTrack.y + _volumeTrack.height) - _volumeSlider.height;
|
||||
|
||||
drawDownloadProgress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show playing controls on mouse movement.
|
||||
* @param event
|
||||
*/
|
||||
private function onMouseMove(event:MouseEvent):Void
|
||||
{
|
||||
if (_stage.mouseX >= _controlsBar.x)
|
||||
{
|
||||
if (!_hideControlsTimer.running)
|
||||
{
|
||||
_hideControlsTimer.start();
|
||||
}
|
||||
|
||||
_controlsVisible = true;
|
||||
showControls();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function fired by a stage resize eventthat redraws the player controls
|
||||
* @param event
|
||||
*/
|
||||
private function onStageResize(event:Event):Void
|
||||
{
|
||||
redrawControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles pause or play
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.togglePlay();
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles pause or play
|
||||
* @param event
|
||||
*/
|
||||
private function onPauseClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.togglePlay();
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles betewen aspect ratios
|
||||
* @param event
|
||||
*/
|
||||
private function onAspectRatioClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.toggleAspectRatio();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles between window and fullscreen mode
|
||||
* @param event
|
||||
*/
|
||||
private function onFullscreenClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.toggleFullscreen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles between mute and unmute
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeIconClick(event: MouseEvent):Void
|
||||
{
|
||||
_player.toggleMute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect user click on volume track control and change volume according
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeTrackClick(event:MouseEvent):Void
|
||||
{
|
||||
var percent:Float = _volumeTrack.height - _volumeTrack.mouseY;
|
||||
var volume:Float = 1.0 * (percent / _volumeTrack.height);
|
||||
|
||||
_player.setVolume(volume);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display not found message
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerStreamNotFound(event:PlayerEvents):Void
|
||||
{
|
||||
//todo: to work on this
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the loader bar when buffering
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerBuffering(event:PlayerEvents):Void
|
||||
{
|
||||
_loader.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides loader bar when not buffering
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerNotBuffering(event:PlayerEvents):Void
|
||||
{
|
||||
_loader.hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the selected aspect ratio
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerAspectRatio(event:PlayerEvents):Void
|
||||
{
|
||||
_hideAspectRatioLabelTimer.stop();
|
||||
_aspectRatioLabel.text = _player.getAspectRatioString();
|
||||
drawAspectRatioLabel();
|
||||
|
||||
while (_aspectRatioLabelContainer.visible)
|
||||
{
|
||||
//wait till fade out finishes
|
||||
}
|
||||
|
||||
Animation.fadeIn(_aspectRatioLabelContainer, 300);
|
||||
|
||||
_hideAspectRatioLabelTimer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitors playbeack when finishes tu update controls
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerPlaybackFinished(event:PlayerEvents):Void
|
||||
{
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
showControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitors keyboard play pause actions to update icons
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerPlayPause(event:PlayerEvents):Void
|
||||
{
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the video player on windowed mode substracting the seekbar height
|
||||
* @param event
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates media total time duration.
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMediaInitialized(event:PlayerEvents):Void
|
||||
{
|
||||
_totalPlayTimeLabel.text = Utils.formatTime(event.duration);
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides seekbar if on fullscreen.
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMouseHide(event:PlayerEvents):Void
|
||||
{
|
||||
if (_seekBar.visible && _player.isFullscreen())
|
||||
{
|
||||
Animation.slideOut(_seekBar, "bottom", 1000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows seekbar
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMouseShow(event:PlayerEvents):Void
|
||||
{
|
||||
//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)
|
||||
{
|
||||
Animation.slideIn(_seekBar, "bottom",1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
_seekBar.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a user click in to time and seeks to it
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackClick(event:MouseEvent):Void
|
||||
{
|
||||
var clickPosition:Float = _track.mouseX;
|
||||
_player.seek(_player.getDuration() * (clickPosition / _track.width));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a small tooltip showing the time calculated by mouse position
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackMouseMove(event:MouseEvent):Void
|
||||
{
|
||||
var clickPosition:Float = _track.mouseX;
|
||||
_seekPlayTimeLabel.text = Utils.formatTime(_player.getDuration() * (clickPosition / _track.width));
|
||||
_seekPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
_seekPlayTimeLabel.y = _stage.stageHeight - _seekBar.height - _seekPlayTimeLabel.height - 1;
|
||||
_seekPlayTimeLabel.x = clickPosition + (_seekPlayTimeLabel.width / 2);
|
||||
|
||||
_seekPlayTimeLabel.backgroundColor = _brightColor;
|
||||
_seekPlayTimeLabel.background = true;
|
||||
_seekPlayTimeLabel.textColor = _controlColor;
|
||||
_seekPlayTimeLabel.borderColor = _darkColor;
|
||||
_seekPlayTimeLabel.border = true;
|
||||
|
||||
if (!_seekPlayTimeLabel.visible)
|
||||
{
|
||||
Animation.fadeIn(_seekPlayTimeLabel, 300);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the tooltip that shows the time calculated by mouse position
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
Animation.fadeOut(_seekPlayTimeLabel, 300);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables dragging of thumb for seeking media
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseDown(event:MouseEvent):Void
|
||||
{
|
||||
_scrubbing = true;
|
||||
var rectangle:Rectangle = new Rectangle(_track.x, _track.y, _track.width-_thumb.width, 0);
|
||||
_thumb.startDrag(false, rectangle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes thumb seek control to hover color
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbHover(event:MouseEvent):Void
|
||||
{
|
||||
_thumb.graphics.lineStyle();
|
||||
_thumb.graphics.beginFill(_hoverColor);
|
||||
_thumb.graphics.drawRect(0, (_seekBar.height/2)-(10/2), 10, 10);
|
||||
_thumb.graphics.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes thumb seek control to control color
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
_thumb.graphics.lineStyle();
|
||||
_thumb.graphics.beginFill(_controlColor);
|
||||
_thumb.graphics.drawRect(0, (_seekBar.height/2)-(10/2), 10, 10);
|
||||
_thumb.graphics.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables dragging of thumb
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseUp(event:MouseEvent):Void
|
||||
{
|
||||
_scrubbing = false;
|
||||
_thumb.stopDrag( );
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Drawing functions
|
||||
/**
|
||||
* Clears all current graphics a draw new ones
|
||||
*/
|
||||
private function redrawControls():Void
|
||||
{
|
||||
drawSeekControls();
|
||||
drawPlayingControls();
|
||||
drawAspectRatioLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the download progress track bar
|
||||
*/
|
||||
private function drawDownloadProgress():Void
|
||||
{
|
||||
if (_player.getBytesTotal() > 0)
|
||||
{
|
||||
var bytesLoaded:Float = _player.getBytesLoaded();
|
||||
var bytesTotal:Float = _player.getBytesTotal();
|
||||
|
||||
_percentLoaded = bytesLoaded / bytesTotal;
|
||||
}
|
||||
|
||||
var position:Float = _player.getStartTime() / _player.getDuration();
|
||||
//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();
|
||||
_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.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws all seekbar controls
|
||||
*/
|
||||
private function drawSeekControls()
|
||||
{
|
||||
//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;
|
||||
var matrix:Matrix = new Matrix( );
|
||||
matrix.createGradientBox(_seekBarWidth, _seekBarHeight, Utils.degreesToRadians(90), 0, 0);
|
||||
var colors:Array<UInt> = [_brightColor, _darkColor];
|
||||
var alphas:Array<UInt> = [1, 1];
|
||||
var ratios:Array<UInt> = [0, 255];
|
||||
_seekBar.graphics.lineStyle();
|
||||
_seekBar.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
_seekBar.graphics.drawRect(0, 0, _seekBarWidth, _seekBarHeight);
|
||||
_seekBar.graphics.endFill();
|
||||
|
||||
_textFormat.color = _controlColor;
|
||||
|
||||
//Draw current play time label
|
||||
_currentPlayTimeLabel.y = _seekBarHeight - (_seekBarHeight / 2) - (_currentPlayTimeLabel.height / 2);
|
||||
_currentPlayTimeLabel.antiAliasType = AntiAliasType.ADVANCED;
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
//Draw total play time label
|
||||
_totalPlayTimeLabel.x = _seekBarWidth - _totalPlayTimeLabel.width;
|
||||
_totalPlayTimeLabel.y = _seekBarHeight - (_seekBarHeight / 2) - (_totalPlayTimeLabel.height / 2);
|
||||
_totalPlayTimeLabel.antiAliasType = AntiAliasType.ADVANCED;
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
//Draw download progress
|
||||
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.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;
|
||||
|
||||
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];
|
||||
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);
|
||||
|
||||
//Draw pausebutton
|
||||
_pauseControl.setNormalColor(_controlColor);
|
||||
_pauseControl.setHoverColor(_hoverColor);
|
||||
_pauseControl.setPosition(_playControl.x, topMargin);
|
||||
_pauseControl.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw aspec ratio button
|
||||
_aspectRatioControl.setNormalColor(_controlColor);
|
||||
_aspectRatioControl.setHoverColor(_hoverColor);
|
||||
_aspectRatioControl.setPosition(_playControl.x, (_playControl.y + buttonSize) + topMargin);
|
||||
_aspectRatioControl.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw fullscreen button
|
||||
_fullscreenControl.setNormalColor(_controlColor);
|
||||
_fullscreenControl.setHoverColor(_hoverColor);
|
||||
_fullscreenControl.setPosition(_playControl.x, (_aspectRatioControl.y + _aspectRatioControl.height) + topMargin);
|
||||
_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.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.endFill();
|
||||
_volumeTrack.x = barCenter - (_volumeTrack.width / 2);
|
||||
|
||||
//Draw volume slider
|
||||
_volumeSlider.x = _volumeTrack.x;
|
||||
_volumeSlider.y = _volumeTrack.y;
|
||||
_volumeSlider.graphics.lineStyle();
|
||||
_volumeSlider.graphics.beginFill(_controlColor, 1);
|
||||
_volumeSlider.graphics.drawRect(0, 0, _volumeTrack.width, _volumeTrack.height);
|
||||
_volumeSlider.graphics.endFill();
|
||||
|
||||
}
|
||||
|
||||
private function drawAspectRatioLabel():Void
|
||||
{
|
||||
_aspectRatioLabelContainer.graphics.clear();
|
||||
_aspectRatioLabelContainer.visible = false;
|
||||
|
||||
//Update aspect ratio label
|
||||
var textFormat:TextFormat = new TextFormat();
|
||||
textFormat.font = "arial";
|
||||
textFormat.bold = true;
|
||||
textFormat.size = 40;
|
||||
textFormat.color = _controlColor;
|
||||
|
||||
_aspectRatioLabel.setTextFormat(textFormat);
|
||||
_aspectRatioLabel.x = (_stage.stageWidth / 2) - (_aspectRatioLabel.width / 2);
|
||||
_aspectRatioLabel.y = (_stage.stageHeight / 2) - (_aspectRatioLabel.height / 2);
|
||||
|
||||
//Draw aspect ratio label container
|
||||
_aspectRatioLabelContainer.x = _aspectRatioLabel.x - 10;
|
||||
_aspectRatioLabelContainer.y = _aspectRatioLabel.y - 10;
|
||||
_aspectRatioLabelContainer.graphics.lineStyle(3, _controlColor);
|
||||
_aspectRatioLabelContainer.graphics.beginFill(_brightColor, 1);
|
||||
_aspectRatioLabelContainer.graphics.drawRoundRect(0, 0, _aspectRatioLabel.width + 20, _aspectRatioLabel.height + 20, 15, 15);
|
||||
_aspectRatioLabelContainer.graphics.endFill();
|
||||
|
||||
_aspectRatioLabel.x = 10;
|
||||
_aspectRatioLabel.y = 10;
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Private Methods
|
||||
/**
|
||||
* Hide the play controls bar
|
||||
*/
|
||||
private function hideControls():Void
|
||||
{
|
||||
if(_controlsBar.visible)
|
||||
{
|
||||
drawPlayingControls();
|
||||
Animation.slideOut(_controlsBar, "right", 800);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows play controls bar
|
||||
*/
|
||||
private function showControls():Void
|
||||
{
|
||||
if(!_controlsBar.visible)
|
||||
{
|
||||
drawPlayingControls();
|
||||
Animation.slideIn(_controlsBar, "right", 800);
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Setters
|
||||
/**
|
||||
* Sets the player colors and redraw them
|
||||
* @param colors Array of colors in the following order: darkColor, brightColor, controlColor, hoverColor
|
||||
*/
|
||||
public function setControlColors(colors:Array<String>):Void
|
||||
{
|
||||
_darkColor = colors[0].length > 0? Std.parseInt("0x" + colors[0]) : 0x000000;
|
||||
_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;
|
||||
|
||||
var loaderColors:Array <String> = ["", ""];
|
||||
loaderColors[0] = colors[1];
|
||||
loaderColors[1] = colors[2];
|
||||
_loader.setColors(loaderColors);
|
||||
|
||||
redrawControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* To set the duration label when autostart parameter is false
|
||||
* @param duration in seconds or formatted string in format hh:mm:ss
|
||||
*/
|
||||
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)));
|
||||
}
|
||||
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
}
|
||||
//}
|
||||
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
/**
|
||||
* @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();
|
||||
}
|
||||
}
|
|
@ -1,945 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
//{Libraries
|
||||
import flash.display.GradientType;
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Matrix;
|
||||
import flash.Lib;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.display.MovieClip;
|
||||
import flash.net.NetStream;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.text.AntiAliasType;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
import flash.text.TextFormat;
|
||||
import flash.utils.Timer;
|
||||
import jaris.animation.Animation;
|
||||
import jaris.events.PlayerEvents;
|
||||
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;
|
||||
import jaris.utils.Utils;
|
||||
//}
|
||||
|
||||
/**
|
||||
* Default controls for jaris player
|
||||
*/
|
||||
class NewControls extends MovieClip {
|
||||
|
||||
//{Member Variables
|
||||
private var _thumb:Sprite;
|
||||
private var _track:Sprite;
|
||||
private var _trackDownloaded:Sprite;
|
||||
private var _scrubbing:Bool;
|
||||
private var _stage:Stage;
|
||||
private var _movieClip: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;
|
||||
private var _currentPlayTimeLabel:TextField;
|
||||
private var _totalPlayTimeLabel:TextField;
|
||||
private var _seekPlayTimeLabel:TextField;
|
||||
private var _percentLoaded:Float;
|
||||
private var _controlsVisible:Bool;
|
||||
private var _seekBar:Sprite;
|
||||
private var _controlsBar: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;
|
||||
private var _aspectRatioLabelContainer:Sprite;
|
||||
private var _aspectRatioLabel:TextField;
|
||||
private var _textFormat:TextFormat;
|
||||
//}
|
||||
|
||||
|
||||
//{Constructor
|
||||
public function new(player:Player)
|
||||
{
|
||||
super();
|
||||
|
||||
//{Main variables
|
||||
_stage = Lib.current.stage;
|
||||
_movieClip = Lib.current;
|
||||
_player = player;
|
||||
_darkColor = 0x000000;
|
||||
_brightColor = 0x4c4c4c;
|
||||
_controlColor = 0xFFFFFF;
|
||||
_hoverColor = 0x67A8C1;
|
||||
_seekColor = 0x7c7c7c;
|
||||
_controlSize = 40;
|
||||
_percentLoaded = 0.0;
|
||||
_hideControlsTimer = new Timer(500);
|
||||
_hideAspectRatioLabelTimer = new Timer(500);
|
||||
_controlsVisible = false;
|
||||
|
||||
_textFormat = new TextFormat();
|
||||
_textFormat.font = "arial";
|
||||
_textFormat.color = _controlColor;
|
||||
_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();
|
||||
_controlsBar.addChild(_seekBar);
|
||||
|
||||
_trackDownloaded = new Sprite( );
|
||||
_trackDownloaded.tabEnabled = false;
|
||||
_seekBar.addChild(_trackDownloaded);
|
||||
|
||||
_track = new Sprite( );
|
||||
_track.tabEnabled = false;
|
||||
_track.buttonMode = true;
|
||||
_track.useHandCursor = true;
|
||||
_seekBar.addChild(_track);
|
||||
|
||||
_thumb = new Sprite( );
|
||||
_thumb.buttonMode = true;
|
||||
_thumb.useHandCursor = true;
|
||||
_thumb.tabEnabled = false;
|
||||
_seekBar.addChild(_thumb);
|
||||
|
||||
_currentPlayTimeLabel = new TextField();
|
||||
_currentPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_currentPlayTimeLabel.text = "00:00:00";
|
||||
_currentPlayTimeLabel.tabEnabled = false;
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_seekBar.addChild(_currentPlayTimeLabel);
|
||||
|
||||
_totalPlayTimeLabel = new TextField();
|
||||
_totalPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_totalPlayTimeLabel.text = "00:00:00";
|
||||
_totalPlayTimeLabel.tabEnabled = false;
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_seekBar.addChild(_totalPlayTimeLabel);
|
||||
|
||||
_seekPlayTimeLabel = new TextField();
|
||||
_seekPlayTimeLabel.visible = false;
|
||||
_seekPlayTimeLabel.autoSize = TextFieldAutoSize.LEFT;
|
||||
_seekPlayTimeLabel.text = "00:00:00";
|
||||
_seekPlayTimeLabel.tabEnabled = false;
|
||||
_seekPlayTimeLabel.setTextFormat(_textFormat);
|
||||
addChild(_seekPlayTimeLabel);
|
||||
//}
|
||||
|
||||
//{Aspect ratio label
|
||||
_aspectRatioLabelContainer = new Sprite();
|
||||
addChild(_aspectRatioLabelContainer);
|
||||
|
||||
_aspectRatioLabel = new TextField();
|
||||
_aspectRatioLabel.autoSize = TextFieldAutoSize.CENTER;
|
||||
_aspectRatioLabel.text = "original";
|
||||
_aspectRatioLabel.tabEnabled = false;
|
||||
_aspectRatioLabelContainer.addChild(_aspectRatioLabel);
|
||||
//}
|
||||
|
||||
redrawControls();
|
||||
|
||||
//{Loader bar
|
||||
_loader = new Loader();
|
||||
_loader.hide();
|
||||
|
||||
var loaderColors:Array <String> = ["", "", "", ""];
|
||||
loaderColors[0] = Std.string(_darkColor);
|
||||
loaderColors[1] = Std.string(_controlColor);
|
||||
loaderColors[2] = Std.string(_seekColor);
|
||||
|
||||
_loader.setColors(loaderColors);
|
||||
|
||||
addChild(_loader);
|
||||
//}
|
||||
|
||||
//{event Listeners
|
||||
_movieClip.addEventListener(Event.ENTER_FRAME, onEnterFrame);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_DOWN, onThumbMouseDown);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_UP, onThumbMouseUp);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OVER, onThumbHover);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OUT, onThumbMouseOut);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_MOVE, onTrackMouseMove);
|
||||
_thumb.addEventListener(MouseEvent.MOUSE_OUT, onTrackMouseOut);
|
||||
_track.addEventListener(MouseEvent.CLICK, onTrackClick);
|
||||
_track.addEventListener(MouseEvent.MOUSE_MOVE, onTrackMouseMove);
|
||||
_track.addEventListener(MouseEvent.MOUSE_OUT, onTrackMouseOut);
|
||||
_playControl.addEventListener(MouseEvent.CLICK, onPlayClick);
|
||||
_pauseControl.addEventListener(MouseEvent.CLICK, onPauseClick);
|
||||
_aspectRatioControl.addEventListener(MouseEvent.CLICK, onAspectRatioClick);
|
||||
_fullscreenControl.addEventListener(MouseEvent.CLICK, onFullscreenClick);
|
||||
_volumeIcon.addEventListener(MouseEvent.CLICK, onVolumeIconClick);
|
||||
_volumeTrack.addEventListener(MouseEvent.CLICK, onVolumeTrackClick);
|
||||
|
||||
_player.addEventListener(PlayerEvents.MOUSE_HIDE, onPlayerMouseHide);
|
||||
_player.addEventListener(PlayerEvents.MOUSE_SHOW, onPlayerMouseShow);
|
||||
_player.addEventListener(PlayerEvents.MEDIA_INITIALIZED, onPlayerMediaInitialized);
|
||||
_player.addEventListener(PlayerEvents.BUFFERING, onPlayerBuffering);
|
||||
_player.addEventListener(PlayerEvents.NOT_BUFFERING, onPlayerNotBuffering);
|
||||
_player.addEventListener(PlayerEvents.RESIZE, onPlayerResize);
|
||||
_player.addEventListener(PlayerEvents.PLAY_PAUSE, onPlayerPlayPause);
|
||||
_player.addEventListener(PlayerEvents.PLAYBACK_FINISHED, onPlayerPlaybackFinished);
|
||||
_player.addEventListener(PlayerEvents.CONNECTION_FAILED, onPlayerStreamNotFound);
|
||||
_player.addEventListener(PlayerEvents.ASPECT_RATIO, onPlayerAspectRatio);
|
||||
|
||||
_stage.addEventListener(MouseEvent.MOUSE_UP, onThumbMouseUp);
|
||||
_stage.addEventListener(MouseEvent.MOUSE_OUT, onThumbMouseUp);
|
||||
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
|
||||
_stage.addEventListener(Event.RESIZE, onStageResize);
|
||||
|
||||
_hideControlsTimer.addEventListener(TimerEvent.TIMER, hideControlsTimer);
|
||||
_hideAspectRatioLabelTimer.addEventListener(TimerEvent.TIMER, hideAspectRatioLabelTimer);
|
||||
|
||||
_hideControlsTimer.start();
|
||||
//}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Timers
|
||||
/**
|
||||
* Hides the playing controls when not moving mouse.
|
||||
* @param event The timer event associated
|
||||
*/
|
||||
private function hideControlsTimer(event:TimerEvent):Void
|
||||
{
|
||||
if (_player.isPlaying())
|
||||
{
|
||||
if (_controlsVisible)
|
||||
{
|
||||
if (_stage.mouseX < _controlsBar.x ||
|
||||
_stage.mouseX >= _stage.stageWidth - 1 ||
|
||||
_stage.mouseY >= _stage.stageHeight - 1 ||
|
||||
_stage.mouseY <= 1
|
||||
)
|
||||
{
|
||||
_controlsVisible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hideControls();
|
||||
_hideControlsTimer.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides aspect ratio label
|
||||
* @param event
|
||||
*/
|
||||
private function hideAspectRatioLabelTimer(event:TimerEvent):Void
|
||||
{
|
||||
//wait till fade in effect finish
|
||||
if (_aspectRatioLabelContainer.alpha >= 1)
|
||||
{
|
||||
Animation.fadeOut(_aspectRatioLabelContainer, 300);
|
||||
_hideAspectRatioLabelTimer.stop();
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Events
|
||||
/**
|
||||
* Keeps syncronized various elements of the controls like the thumb and download track bar
|
||||
* @param event
|
||||
*/
|
||||
private function onEnterFrame(event:Event):Void
|
||||
{
|
||||
if(_player.getDuration() > 0) {
|
||||
if (_scrubbing)
|
||||
{
|
||||
_player.seek(((_thumb.x - _track.x) / _track.width) * _player.getDuration());
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentPlayTimeLabel.text = Utils.formatTime(_player.getCurrentTime());
|
||||
_currentPlayTimeLabel.setTextFormat(_textFormat);
|
||||
_thumb.x = _player.getCurrentTime() / _player.getDuration() * (_track.width-_thumb.width) + _track.x;
|
||||
}
|
||||
}
|
||||
|
||||
_volumeSlider.height = _volumeTrack.height * (_player.getVolume() / 1.0);
|
||||
_volumeSlider.y = (_volumeTrack.y + _volumeTrack.height) - _volumeSlider.height;
|
||||
|
||||
drawDownloadProgress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show playing controls on mouse movement.
|
||||
* @param event
|
||||
*/
|
||||
private function onMouseMove(event:MouseEvent):Void
|
||||
{
|
||||
if (_stage.mouseX >= _controlsBar.x)
|
||||
{
|
||||
if (!_hideControlsTimer.running)
|
||||
{
|
||||
_hideControlsTimer.start();
|
||||
}
|
||||
|
||||
_controlsVisible = true;
|
||||
showControls();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function fired by a stage resize eventthat redraws the player controls
|
||||
* @param event
|
||||
*/
|
||||
private function onStageResize(event:Event):Void
|
||||
{
|
||||
redrawControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles pause or play
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.togglePlay();
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles pause or play
|
||||
* @param event
|
||||
*/
|
||||
private function onPauseClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.togglePlay();
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles betewen aspect ratios
|
||||
* @param event
|
||||
*/
|
||||
private function onAspectRatioClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.toggleAspectRatio();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles between window and fullscreen mode
|
||||
* @param event
|
||||
*/
|
||||
private function onFullscreenClick(event:MouseEvent):Void
|
||||
{
|
||||
_player.toggleFullscreen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles between mute and unmute
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeIconClick(event: MouseEvent):Void
|
||||
{
|
||||
if (_volumeSlider.visible) {
|
||||
_volumeSlider.visible = false;
|
||||
_volumeTrack.visible = false;
|
||||
} else {
|
||||
_volumeSlider.visible = true;
|
||||
_volumeTrack.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect user click on volume track control and change volume according
|
||||
* @param event
|
||||
*/
|
||||
private function onVolumeTrackClick(event:MouseEvent):Void
|
||||
{
|
||||
var percent:Float = _volumeTrack.height - _volumeTrack.mouseY;
|
||||
var volume:Float = 1.0 * (percent / _volumeTrack.height);
|
||||
|
||||
_player.setVolume(volume);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display not found message
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerStreamNotFound(event:PlayerEvents):Void
|
||||
{
|
||||
//todo: to work on this
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the loader bar when buffering
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerBuffering(event:PlayerEvents):Void
|
||||
{
|
||||
_loader.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides loader bar when not buffering
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerNotBuffering(event:PlayerEvents):Void
|
||||
{
|
||||
_loader.hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the selected aspect ratio
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerAspectRatio(event:PlayerEvents):Void
|
||||
{
|
||||
_hideAspectRatioLabelTimer.stop();
|
||||
_aspectRatioLabel.text = _player.getAspectRatioString();
|
||||
drawAspectRatioLabel();
|
||||
|
||||
while (_aspectRatioLabelContainer.visible)
|
||||
{
|
||||
//wait till fade out finishes
|
||||
}
|
||||
|
||||
Animation.fadeIn(_aspectRatioLabelContainer, 1);
|
||||
|
||||
_hideAspectRatioLabelTimer.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitors playbeack when finishes tu update controls
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerPlaybackFinished(event:PlayerEvents):Void
|
||||
{
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
showControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitors keyboard play pause actions to update icons
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerPlayPause(event:PlayerEvents):Void
|
||||
{
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the video player on windowed mode substracting the seekbar height
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerResize(event:PlayerEvents):Void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates media total time duration.
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMediaInitialized(event:PlayerEvents):Void
|
||||
{
|
||||
_totalPlayTimeLabel.text = Utils.formatTime(event.duration);
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
_playControl.visible = !_player.isPlaying();
|
||||
_pauseControl.visible = _player.isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides seekbar if on fullscreen.
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMouseHide(event:PlayerEvents):Void
|
||||
{
|
||||
if (_controlsBar.visible && _player.isFullscreen())
|
||||
{
|
||||
hideControls();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows seekbar
|
||||
* @param event
|
||||
*/
|
||||
private function onPlayerMouseShow(event:PlayerEvents):Void
|
||||
{
|
||||
//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() && !_controlsBar.visible)
|
||||
{
|
||||
_controlsBar.visible = true;
|
||||
}
|
||||
else if (!_controlsBar.visible)
|
||||
{
|
||||
_controlsBar.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a user click in to time and seeks to it
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackClick(event:MouseEvent):Void
|
||||
{
|
||||
var clickPosition:Float = _track.mouseX;
|
||||
_player.seek(_player.getDuration() * (clickPosition / _track.width));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a small tooltip showing the time calculated by mouse position
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackMouseMove(event:MouseEvent):Void
|
||||
{
|
||||
var clickPosition:Float = _track.mouseX;
|
||||
_seekPlayTimeLabel.text = Utils.formatTime(_player.getDuration() * (clickPosition / _track.width));
|
||||
_seekPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
_seekPlayTimeLabel.y = _stage.stageHeight - _seekBar.height - _seekPlayTimeLabel.height - 1;
|
||||
_seekPlayTimeLabel.x = clickPosition + (_seekPlayTimeLabel.width / 2) + (_playControl.width + 10) * 2;
|
||||
_seekPlayTimeLabel.backgroundColor = _darkColor;
|
||||
_seekPlayTimeLabel.background = true;
|
||||
_seekPlayTimeLabel.textColor = _controlColor;
|
||||
_seekPlayTimeLabel.borderColor = _darkColor;
|
||||
_seekPlayTimeLabel.border = true;
|
||||
|
||||
if (!_seekPlayTimeLabel.visible)
|
||||
{
|
||||
_seekPlayTimeLabel.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the tooltip that shows the time calculated by mouse position
|
||||
* @param event
|
||||
*/
|
||||
private function onTrackMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
_seekPlayTimeLabel.visible = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables dragging of thumb for seeking media
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseDown(event:MouseEvent):Void
|
||||
{
|
||||
_scrubbing = true;
|
||||
var rectangle:Rectangle = new Rectangle(_track.x, _track.y, _track.width-_thumb.width, 0);
|
||||
_thumb.startDrag(false, rectangle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes thumb seek control to hover color
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbHover(event:MouseEvent):Void
|
||||
{
|
||||
_thumb.graphics.lineStyle();
|
||||
_thumb.graphics.beginFill(_hoverColor);
|
||||
_thumb.graphics.drawRoundRect(0, (_seekBar.height/2)-(11/2), 11, 11, 10, 10);
|
||||
_thumb.graphics.endFill();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes thumb seek control to control color
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseOut(event:MouseEvent):Void
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables dragging of thumb
|
||||
* @param event
|
||||
*/
|
||||
private function onThumbMouseUp(event:MouseEvent):Void
|
||||
{
|
||||
_scrubbing = false;
|
||||
_thumb.stopDrag( );
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Drawing functions
|
||||
/**
|
||||
* Clears all current graphics a draw new ones
|
||||
*/
|
||||
private function redrawControls():Void
|
||||
{
|
||||
drawControls();
|
||||
drawAspectRatioLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the download progress track bar
|
||||
*/
|
||||
private function drawDownloadProgress():Void
|
||||
{
|
||||
if (_player.getBytesTotal() > 0)
|
||||
{
|
||||
var bytesLoaded:Float = _player.getBytesLoaded();
|
||||
var bytesTotal:Float = _player.getBytesTotal();
|
||||
|
||||
_percentLoaded = bytesLoaded / bytesTotal;
|
||||
}
|
||||
|
||||
var position:Float = _player.getStartTime() / _player.getDuration();
|
||||
var startPosition:Float = (position > 0?(position * _track.width):0) + _track.x;
|
||||
|
||||
_trackDownloaded.graphics.clear();
|
||||
_trackDownloaded.graphics.lineStyle();
|
||||
_trackDownloaded.x = startPosition;
|
||||
_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 NEW control bar player/seek controls
|
||||
*/
|
||||
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 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(barWidth, barHeight, Utils.degreesToRadians(-90), barWidth, 0);
|
||||
var colors:Array<UInt> = [_brightColor, _darkColor];
|
||||
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.beginFill(_darkColor, 0);
|
||||
_seekBar.graphics.drawRect(0, 0, _seekBarWidth, _seekBarHeight);
|
||||
_seekBar.graphics.endFill();
|
||||
|
||||
//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);
|
||||
|
||||
//Draw total play time label
|
||||
_totalPlayTimeLabel.x = _seekBarWidth - _totalPlayTimeLabel.width;
|
||||
_totalPlayTimeLabel.y = _seekBarHeight - (_seekBarHeight / 2) - (_totalPlayTimeLabel.height / 2);
|
||||
_totalPlayTimeLabel.antiAliasType = AntiAliasType.ADVANCED;
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
|
||||
//Draw download progress
|
||||
drawDownloadProgress();
|
||||
|
||||
//Draw track place holder for drag
|
||||
_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();
|
||||
|
||||
_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(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.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 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(_volumeIcon.x + _volumeIcon.width + barMargin, _playControl.y+1);
|
||||
_aspectRatioControl.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw fullscreen button
|
||||
_fullscreenControl.setNormalColor(_controlColor);
|
||||
_fullscreenControl.setHoverColor(_hoverColor);
|
||||
_fullscreenControl.setPosition(_aspectRatioControl.x + _aspectRatioControl.width + barMargin, _playControl.y+1);
|
||||
_fullscreenControl.setSize(buttonSize, buttonSize);
|
||||
|
||||
//Draw volume track
|
||||
_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, buttonSize, _controlsBar.height);
|
||||
_volumeTrack.graphics.endFill();
|
||||
|
||||
//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.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
|
||||
//_volumeSlider.graphics.beginFill(_hoverColor, 1);
|
||||
_volumeSlider.graphics.drawRect(0, 0, _volumeTrack.width, _volumeTrack.height);
|
||||
_volumeSlider.graphics.endFill();
|
||||
|
||||
}
|
||||
|
||||
private function drawAspectRatioLabel():Void
|
||||
{
|
||||
_aspectRatioLabelContainer.graphics.clear();
|
||||
_aspectRatioLabelContainer.visible = false;
|
||||
|
||||
//Update aspect ratio label
|
||||
var textFormat:TextFormat = new TextFormat();
|
||||
textFormat.font = "arial";
|
||||
textFormat.bold = true;
|
||||
textFormat.size = 40;
|
||||
textFormat.color = _controlColor;
|
||||
|
||||
_aspectRatioLabel.setTextFormat(textFormat);
|
||||
_aspectRatioLabel.x = (_stage.stageWidth / 2) - (_aspectRatioLabel.width / 2);
|
||||
_aspectRatioLabel.y = (_stage.stageHeight / 2) - (_aspectRatioLabel.height / 2);
|
||||
|
||||
//Draw aspect ratio label container
|
||||
_aspectRatioLabelContainer.x = _aspectRatioLabel.x - 10;
|
||||
_aspectRatioLabelContainer.y = _aspectRatioLabel.y - 10;
|
||||
_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();
|
||||
|
||||
_aspectRatioLabel.x = 10;
|
||||
_aspectRatioLabel.y = 10;
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Private Methods
|
||||
/**
|
||||
* Hide the play controls bar
|
||||
*/
|
||||
private function hideControls():Void
|
||||
{
|
||||
if(_controlsBar.visible)
|
||||
{
|
||||
drawControls();
|
||||
Animation.slideOut(_controlsBar, "bottom", 800);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows play controls bar
|
||||
*/
|
||||
private function showControls():Void
|
||||
{
|
||||
if(!_controlsBar.visible)
|
||||
{
|
||||
drawControls();
|
||||
_controlsBar.visible = true;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//{Setters
|
||||
/**
|
||||
* Sets the player colors and redraw them
|
||||
* @param colors Array of colors in the following order: darkColor, brightColor, controlColor, hoverColor
|
||||
*/
|
||||
public function setControlColors(colors:Array<String>):Void
|
||||
{
|
||||
_darkColor = colors[0].length > 0? Std.parseInt("0x" + colors[0]) : 0x000000;
|
||||
_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[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
|
||||
*/
|
||||
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)));
|
||||
}
|
||||
|
||||
_totalPlayTimeLabel.setTextFormat(_textFormat);
|
||||
}
|
||||
//}
|
||||
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
//}
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Some utility functions
|
||||
*/
|
||||
class Utils
|
||||
{
|
||||
|
||||
/**
|
||||
* Converts degrees to radians for easy rotation where applicable
|
||||
* @param value A radian value to convert
|
||||
* @return conversion of degree to radian
|
||||
*/
|
||||
public static function degreesToRadians(value:Float):Float
|
||||
{
|
||||
return (Math.PI / 180) * value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a float value representing seconds to a readale string
|
||||
* @param time A given time in seconds
|
||||
* @return A string in the format 00:00:00
|
||||
*/
|
||||
public static function formatTime(time:Float):String
|
||||
{
|
||||
var seconds:String = "";
|
||||
var minutes:String = "";
|
||||
var hours:String = "";
|
||||
var timeString:String = "";
|
||||
|
||||
if (((time / 60) / 60) >= 1)
|
||||
{
|
||||
if (Math.floor((time / 60)) / 60 < 10)
|
||||
{
|
||||
hours = "0" + Math.floor((time / 60) / 60) + ":";
|
||||
}
|
||||
else
|
||||
{
|
||||
hours = Math.floor((time / 60) / 60) + ":";
|
||||
}
|
||||
|
||||
if (Math.floor((time / 60) % 60) < 10)
|
||||
{
|
||||
minutes = "0" + Math.floor((time / 60) % 60) + ":";
|
||||
}
|
||||
else
|
||||
{
|
||||
minutes = Math.floor((time / 60) % 60) + ":";
|
||||
}
|
||||
|
||||
if (Math.floor(time % 60) < 10)
|
||||
{
|
||||
seconds = "0" + Math.floor(time % 60);
|
||||
}
|
||||
else
|
||||
{
|
||||
seconds = Std.string(Math.floor(time % 60));
|
||||
}
|
||||
}
|
||||
else if((time / 60) >= 1)
|
||||
{
|
||||
hours = "00:";
|
||||
|
||||
if (Math.floor(time / 60) < 10)
|
||||
{
|
||||
minutes = "0" + Math.floor(time / 60) + ":";
|
||||
}
|
||||
else
|
||||
{
|
||||
minutes = Math.floor(time / 60) + ":";
|
||||
}
|
||||
|
||||
if (Math.floor(time % 60) < 10)
|
||||
{
|
||||
seconds = "0" + Math.floor(time % 60);
|
||||
}
|
||||
else
|
||||
{
|
||||
seconds = Std.string(Math.floor(time % 60));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hours = "00:";
|
||||
|
||||
minutes = "00:";
|
||||
|
||||
if (Math.floor(time) < 10)
|
||||
{
|
||||
seconds = "0" + Math.floor(time);
|
||||
}
|
||||
else
|
||||
{
|
||||
seconds = Std.string(Math.floor(time));
|
||||
}
|
||||
}
|
||||
|
||||
timeString += hours + minutes + seconds;
|
||||
|
||||
return timeString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a given rtmp source to a valid format for NetStream
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public static function rtmpSourceParser(source:String):String
|
||||
{
|
||||
if (source.indexOf(".flv") != -1)
|
||||
{
|
||||
return source.split(".flv").join("");
|
||||
}
|
||||
else if (source.indexOf(".mp3") != -1)
|
||||
{
|
||||
return "mp3:" + source.split(".mp3").join("");
|
||||
}
|
||||
else if (source.indexOf(".mp4") != -1)
|
||||
{
|
||||
return "mp4:" + source;
|
||||
}
|
||||
else if (source.indexOf(".f4v") != -1)
|
||||
{
|
||||
return "mp4:" + source;
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes a youtube url to the format youtube.com/v/video_id
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public static function youtubeSourceParse(source:String):String
|
||||
{
|
||||
return source.split("watch?v=").join("v/");
|
||||
}
|
||||
}
|
Reference in a new issue