[Pkg-javascript-commits] [jarisplayer] 15/80: fixed seek control drawing issue after fullscreen resize
Jonas Smedegaard
dr at jones.dk
Tue May 10 08:45:31 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository jarisplayer.
commit 3923068ff971b890ba57360ae645992e8e9688d4
Author: jgmylm <jgmylm at edf201c3-a14d-0410-a11e-aa85364efa9f>
Date: Thu Mar 11 17:09:21 2010 +0000
fixed seek control drawing issue after fullscreen resize
git-svn-id: https://jaris.svn.sourceforge.net/svnroot/jaris/trunk@15 edf201c3-a14d-0410-a11e-aa85364efa9f
---
bin/JarisFLVPlayer.swf | Bin 20137 -> 28228 bytes
changes.txt | 7 ++-
src/jaris/animation/AnimationsBase.hx | 63 ++++++++++++++++++-----
src/jaris/display/Logo.hx | 14 ++---
src/jaris/display/Poster.hx | 2 +-
src/jaris/player/controls/Controls.hx | 93 +++++++++++++++-------------------
6 files changed, 105 insertions(+), 74 deletions(-)
diff --git a/bin/JarisFLVPlayer.swf b/bin/JarisFLVPlayer.swf
index 96191fa..ed73c8b 100644
Binary files a/bin/JarisFLVPlayer.swf and b/bin/JarisFLVPlayer.swf differ
diff --git a/changes.txt b/changes.txt
index 55024a6..c8ea103 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,9 @@
-Jaris FLV Player v2.0.3 beta - 03/10/2010
+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
diff --git a/src/jaris/animation/AnimationsBase.hx b/src/jaris/animation/AnimationsBase.hx
index 775e7f1..8f0aebc 100644
--- a/src/jaris/animation/AnimationsBase.hx
+++ b/src/jaris/animation/AnimationsBase.hx
@@ -60,25 +60,29 @@ class AnimationsBase
_movieClip = Lib.current;
}
- private function slideInTimer(event:TimerEvent)
+ /**
+ * 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) { _slideInTimer.stop(); last = true; }
+ if (_currentObject.y >= _slideInOrigY) { last = true; }
_currentObject.y += _slideInIncrements;
case "left":
- if (_currentObject.x >= _slideInOrigX) { _slideInTimer.stop(); last = true; }
+ if (_currentObject.x >= _slideInOrigX) { last = true; }
_currentObject.x += _slideInIncrements;
case "bottom":
- if (_currentObject.y <= _slideInOrigY) { _slideInTimer.stop(); last = true; }
+ if (_currentObject.y <= _slideInOrigY) { last = true; }
_currentObject.y -= _slideInIncrements;
case "right":
- if (_currentObject.x <= _slideInOrigX) { _slideInTimer.stop(); last = true; }
+ if (_currentObject.x <= _slideInOrigX) { last = true; }
_currentObject.x -= _slideInIncrements;
}
@@ -86,10 +90,15 @@ class AnimationsBase
{
_currentObject.x = _slideInOrigX;
_currentObject.y = _slideInOrigY;
+ _slideInTimer.stop();
}
}
- private function slideOutTimer(event:TimerEvent)
+ /**
+ * 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))
{
@@ -126,7 +135,11 @@ class AnimationsBase
}
}
- private function fadeOutTimer(event:TimerEvent)
+ /**
+ * Lower object transparency until not visible
+ * @param event
+ */
+ private function fadeOutTimer(event:TimerEvent):Void
{
if (_currentObject.alpha > 0)
{
@@ -139,7 +152,11 @@ class AnimationsBase
}
}
- private function fadeInTimer(event:TimerEvent)
+ /**
+ * Highers object transparency until visible
+ * @param event
+ */
+ private function fadeInTimer(event:TimerEvent):Void
{
if (_currentObject.alpha < 1)
{
@@ -151,7 +168,13 @@ class AnimationsBase
}
}
- public function slideIn(object:Dynamic, slidePosition:String, speed:Float=1000)
+ /**
+ * 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)
{
@@ -194,7 +217,13 @@ class AnimationsBase
_slideInTimer.start();
}
- public function slideOut(object:Dynamic, slidePosition:String, speed:Float=1000)
+ /**
+ * 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)
{
@@ -233,7 +262,12 @@ class AnimationsBase
_slideOutTimer.start();
}
- public function fadeOut(object:Dynamic, speed:Float=500)
+ /**
+ * 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)
{
@@ -248,7 +282,12 @@ class AnimationsBase
_fadeOutTimer.start();
}
- public function fadeIn(object:Dynamic, speed:Float=500)
+ /**
+ * 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)
{
diff --git a/src/jaris/display/Logo.hx b/src/jaris/display/Logo.hx
index 3351143..48e66c5 100644
--- a/src/jaris/display/Logo.hx
+++ b/src/jaris/display/Logo.hx
@@ -80,7 +80,7 @@ class Logo extends Sprite
* Triggers when the logo image finished loading.
* @param event
*/
- private function onLoaderComplete(event:Event)
+ private function onLoaderComplete(event:Event):Void
{
addChild(_loader);
@@ -96,7 +96,7 @@ class Logo extends Sprite
* Recalculate logo position on stage resize
* @param event
*/
- private function onStageResize(event:Event)
+ private function onStageResize(event:Event):Void
{
setPosition(_position);
}
@@ -105,7 +105,7 @@ class Logo extends Sprite
* Opens the an url when the logo is clicked
* @param event
*/
- private function onLogoClick(event:MouseEvent)
+ private function onLogoClick(event:MouseEvent):Void
{
Lib.getURL(new URLRequest(_link), "_blank");
}
@@ -114,7 +114,7 @@ class Logo extends Sprite
* Position where logo will be showing
* @param position values could be top left, top right, bottom left, bottom right
*/
- public function setPosition(position:String)
+ public function setPosition(position:String):Void
{
switch(position)
{
@@ -144,7 +144,7 @@ class Logo extends Sprite
* To set logo transparency
* @param alpha
*/
- public function setAlpha(alpha:Float)
+ public function setAlpha(alpha:Float):Void
{
this.alpha = alpha;
}
@@ -153,7 +153,7 @@ class Logo extends Sprite
* Sets logo width and recalculates height keeping aspect ratio
* @param width
*/
- public function setWidth(width:Float)
+ public function setWidth(width:Float):Void
{
if (width > 0)
{
@@ -166,7 +166,7 @@ class Logo extends Sprite
* Link that opens when clicked the logo image is clicked
* @param link
*/
- public function setLink(link:String)
+ public function setLink(link:String):Void
{
_link = link;
this.buttonMode = true;
diff --git a/src/jaris/display/Poster.hx b/src/jaris/display/Poster.hx
index dcd3f65..087876c 100644
--- a/src/jaris/display/Poster.hx
+++ b/src/jaris/display/Poster.hx
@@ -47,7 +47,7 @@ class Poster extends Sprite
private var _loading:Bool;
private var _loaderStatus:jaris.display.Loader;
- public function new(source:String):Void
+ public function new(source:String)
{
super();
diff --git a/src/jaris/player/controls/Controls.hx b/src/jaris/player/controls/Controls.hx
index 0dd66f6..7a701d0 100644
--- a/src/jaris/player/controls/Controls.hx
+++ b/src/jaris/player/controls/Controls.hx
@@ -208,7 +208,6 @@ class Controls extends MovieClip {
_volumeIcon.addEventListener(MouseEvent.CLICK, onVolumeIconClick);
_volumeTrack.addEventListener(MouseEvent.CLICK, onVolumeTrackClick);
- _player.addEventListener(PlayerEvents.FULLSCREEN, onPlayerFullScreen);
_player.addEventListener(PlayerEvents.MOUSE_HIDE, onPlayerMouseHide);
_player.addEventListener(PlayerEvents.MOUSE_SHOW, onPlayerMouseShow);
_player.addEventListener(PlayerEvents.MEDIA_INITIALIZED, onPlayerMediaInitialized);
@@ -222,6 +221,7 @@ class Controls extends MovieClip {
_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);
@@ -266,7 +266,7 @@ class Controls extends MovieClip {
* Keeps syncronized various elements of the controls like the thumb and download track bar
* @param event
*/
- private function onEnterFrame(event:Event)
+ private function onEnterFrame(event:Event):Void
{
if(_player.getDuration() > 0) {
if (_scrubbing)
@@ -305,6 +305,15 @@ class Controls extends MovieClip {
}
/**
+ * 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
*/
@@ -339,7 +348,7 @@ class Controls extends MovieClip {
* Toggles between window and fullscreen mode
* @param event
*/
- private function onFullscreenClick(event:MouseEvent)
+ private function onFullscreenClick(event:MouseEvent):Void
{
_player.toggleFullscreen();
}
@@ -348,7 +357,7 @@ class Controls extends MovieClip {
* Toggles between mute and unmute
* @param event
*/
- private function onVolumeIconClick(event: MouseEvent)
+ private function onVolumeIconClick(event: MouseEvent):Void
{
_player.toggleMute();
}
@@ -357,7 +366,7 @@ class Controls extends MovieClip {
* Detect user click on volume track control and change volume according
* @param event
*/
- private function onVolumeTrackClick(event:MouseEvent)
+ private function onVolumeTrackClick(event:MouseEvent):Void
{
var percent:Float = _volumeTrack.height - _volumeTrack.mouseY;
var volume:Float = 1.0 * (percent / _volumeTrack.height);
@@ -407,26 +416,17 @@ class Controls extends MovieClip {
* Monitors keyboard play pause actions to update icons
* @param event
*/
- private function onPlayerPlayPause(event:PlayerEvents)
+ private function onPlayerPlayPause(event:PlayerEvents):Void
{
_playControl.visible = !_player.isPlaying();
_pauseControl.visible = _player.isPlaying();
}
/**
- * Function fired by the player FULLSCREEN event that redraws the player controls
- * @param event
- */
- private function onPlayerFullScreen(event:PlayerEvents)
- {
- redrawControls();
- }
-
- /**
* Resizes the video player on windowed mode substracting the seekbar height
* @param event
*/
- private function onPlayerResize(event:PlayerEvents)
+ private function onPlayerResize(event:PlayerEvents):Void
{
if (!_player.isFullscreen())
{
@@ -438,8 +438,6 @@ class Controls extends MovieClip {
_player.getVideo().x = (_stage.stageWidth / 2) - (_player.getVideo().width / 2);
}
}
-
- redrawControls();
}
/**
@@ -457,7 +455,7 @@ class Controls extends MovieClip {
* Hides seekbar if on fullscreen.
* @param event
*/
- private function onPlayerMouseHide(event:PlayerEvents)
+ private function onPlayerMouseHide(event:PlayerEvents):Void
{
if (_seekBar.visible && _player.isFullscreen())
{
@@ -469,7 +467,7 @@ class Controls extends MovieClip {
* Shows seekbar
* @param event
*/
- private function onPlayerMouseShow(event:PlayerEvents)
+ 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
@@ -487,7 +485,7 @@ class Controls extends MovieClip {
* Translates a user click in to time and seeks to it
* @param event
*/
- private function onTrackClick(event:MouseEvent)
+ private function onTrackClick(event:MouseEvent):Void
{
var clickPosition:Float = _track.mouseX;
_player.seek(_player.getDuration() * (clickPosition / _track.width));
@@ -530,7 +528,7 @@ class Controls extends MovieClip {
* Enables dragging of thumb for seeking media
* @param event
*/
- private function onThumbMouseDown(event:MouseEvent)
+ private function onThumbMouseDown(event:MouseEvent):Void
{
_scrubbing = true;
var rectangle:Rectangle = new Rectangle(_track.x, _track.y, _track.width-_thumb.width, 0);
@@ -541,7 +539,7 @@ class Controls extends MovieClip {
* Changes thumb seek control to hover color
* @param event
*/
- private function onThumbHover(event:MouseEvent)
+ private function onThumbHover(event:MouseEvent):Void
{
_thumb.graphics.lineStyle();
_thumb.graphics.beginFill(_hoverColor);
@@ -553,7 +551,7 @@ class Controls extends MovieClip {
* Changes thumb seek control to control color
* @param event
*/
- private function onThumbMouseOut(event:MouseEvent)
+ private function onThumbMouseOut(event:MouseEvent):Void
{
_thumb.graphics.lineStyle();
_thumb.graphics.beginFill(_controlColor);
@@ -565,7 +563,7 @@ class Controls extends MovieClip {
* Disables dragging of thumb
* @param event
*/
- private function onThumbMouseUp(event:MouseEvent)
+ private function onThumbMouseUp(event:MouseEvent):Void
{
_scrubbing = false;
_thumb.stopDrag( );
@@ -580,16 +578,6 @@ class Controls extends MovieClip {
private function redrawControls():Void
{
drawSeekControls();
-
- var count:UInt = 1;
- //draw until seekbar width == stage width
- while(_seekBar.width != _stage.stageWidth && count <= 3)
- {
- drawSeekControls();
-
- count++;
- }
-
drawPlayingControls();
}
@@ -628,28 +616,28 @@ class Controls extends MovieClip {
_thumb.graphics.clear();
//Draw seek bar
- var _seekBarWidth:Float = _stage.stageWidth;
- var _seekBarHeight:Float = 25;
+ var _seekBarWidth:UInt = _stage.stageWidth;
+ var _seekBarHeight:UInt = 25;
_seekBar.x = 0;
- _seekBar.y = _stage.stageHeight - 25;
+ _seekBar.y = _stage.stageHeight - _seekBarHeight;
var matrix:Matrix = new Matrix( );
- matrix.createGradientBox(_seekBar.width, _seekBar.height, Utils.degreesToRadians(90), 0, 0);
+ 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, _stage.stageWidth, 25);
+ _seekBar.graphics.drawRect(0, 0, _seekBarWidth, _seekBarHeight);
_seekBar.graphics.endFill();
//Draw current play time label
_currentPlayTimeLabel.textColor = _controlColor;
- _currentPlayTimeLabel.y = _seekBar.height - (_seekBar.height/2)-(_currentPlayTimeLabel.height/2);
+ _currentPlayTimeLabel.y = _seekBarHeight - (_seekBarHeight/2)-(_currentPlayTimeLabel.height/2);
//Draw total play time label
_totalPlayTimeLabel.textColor = _controlColor;
- _totalPlayTimeLabel.x = _seekBar.width - _totalPlayTimeLabel.width;
- _totalPlayTimeLabel.y = _seekBar.height - (_seekBar.height / 2) - (_totalPlayTimeLabel.height / 2);
+ _totalPlayTimeLabel.x = _seekBarWidth - _totalPlayTimeLabel.width;
+ _totalPlayTimeLabel.y = _seekBarHeight - (_seekBarHeight / 2) - (_totalPlayTimeLabel.height / 2);
//Draw download progress
drawDownloadProgress();
@@ -658,14 +646,14 @@ class Controls extends MovieClip {
_track.x = _currentPlayTimeLabel.width;
_track.graphics.lineStyle(1, _controlColor);
_track.graphics.beginFill(_darkColor, 0);
- _track.graphics.drawRect(0, (_seekBar.height / 2) - (10 / 2), _seekBar.width - _currentPlayTimeLabel.width - _totalPlayTimeLabel.width, 10);
+ _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, (_seekBar.height/2)-(10/2), 10, 10);
+ _thumb.graphics.drawRect(0, (_seekBarHeight/2)-(10/2), 10, 10);
_thumb.graphics.endFill();
}
@@ -680,26 +668,25 @@ class Controls extends MovieClip {
_volumeSlider.graphics.clear();
//Draw controls bar
- var barWidth = _stage.stageHeight < 330 ? 45 : 60;
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, _stage.stageHeight - 75, Utils.degreesToRadians(0), 0, _stage.stageHeight-75);
+ 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, _stage.stageHeight-_seekBar.height-(barMargin * 2), 20, 20);
+ _controlsBar.graphics.drawRoundRect(0, 0, barWidth, barHeight, 20, 20);
_controlsBar.graphics.endFill();
- _controlsBar.width = barWidth;
- _controlsBar.height = _stage.stageHeight - _seekBar.height - (barMargin * 2);
var topMargin:Float = _stage.stageHeight < 330 ? 5 : 10;
- var barCenter:Float = (_controlsBar.width - 20) / 2;
- var buttonSize:Float = ((80 / 100) * (_controlsBar.width - 20));
+ var barCenter:Float = (barWidth - 20) / 2;
+ var buttonSize:Float = ((80 / 100) * (barWidth - 20));
var buttonX:Float = buttonSize / 2;
//Draw playbutton
@@ -729,7 +716,7 @@ class Controls extends MovieClip {
//Draw volume icon
_volumeIcon.setNormalColor(_controlColor);
_volumeIcon.setHoverColor(_hoverColor);
- _volumeIcon.setPosition(_playControl.x, _controlsBar.height - _playControl.height - topMargin);
+ _volumeIcon.setPosition(_playControl.x, barHeight - _playControl.height - topMargin);
_volumeIcon.setSize(buttonSize, buttonSize);
//Draw volume track
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/jarisplayer.git
More information about the Pkg-javascript-commits
mailing list