| Package | com.soma.view.video.skin |
| Class | public class SomaVideoTimeBarSkin |
| Inheritance | SomaVideoTimeBarSkin flash.display.Sprite |
| Implements | ISomaVideoTimeBarSkin |
Author: Romuald Quantin - www.soundstep.com
Information:
Blog page - SomaUI
How does it work - Soma Protest
Project Host - Google Code
Documentation - Soma ASDOC
Class version: 2.0
Actionscript version: 3.0
Copyright:
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and
limitations under the License.
The Original Code is Soma.
The Initial Developer of the Original Code is Romuald Quantin.
Initial Developer are Copyright (C) 2008-2009 Soundstep. All Rights Reserved.
Usage:
Default control skin for a SomaVideoPlayer time/preloading/buffering bar, automatically instantiated by the SomaVideoControls class if you dont specify one in the SomaVideoPlayer instance.
How to add controls to the player
The following code is reproducing how the default controls are added in the SomaVideoControls class (by default).
var controls:SomaVideoControls = new SomaVideoControls();
controls.addControl(new SomaVideoPlaySkin());
controls.addControl(new SomaVideoTimeBarSkin());
controls.addControl(new SomaVideoMuteSkin());
controls.addControl(new SomaVideoFullscreenSkin());
var player:SomaVideoPlayer = new SomaVideoPlayer("video/video.flv", controls);
addChild(player);
package {
import com.soma.view.video.SomaVideoPlayer;
import com.soma.view.video.skin.ISomaVideoTimeBarSkin;
import flash.display.Sprite;
public class CustomTimeBarSkin extends Sprite implements ISomaVideoTimeBarSkin {
private var _player:SomaVideoPlayer;
public function CustomTimeBarSkin() {
createSkinElements();
}
private function createSkinElements():void {
// create elements here and use:
// _player.seek(10);
}
public function registerPlayer(player:SomaVideoPlayer):void {
_player = player;
}
public function dispose():void {
// remove skin elements and events listeners for cleaning when the SomaVideoPlayer instance is disposed.
}
public function timeCallBack(time:Number, duration:Number):void {
// here the controller will indicate when the time and duration of the video.
trace("TIME > time: ", time, ", duration: ", duration);
}
public function preloadingCallBack(bytesLoaded:Number, bytesTotal:Number):void {
// here the controller will indicate when the bytes loaded and the bytes total of the video .
trace("PRELOADING > bytesLoaded: ", bytesLoaded, ", bytesTotal: ", bytesTotal);
}
public function bufferCallBack(length:Number, time:Number):void {
// here the controller will indicate the current length of the buffer and the time it has to reach.
trace("BUFFERING > length: ", length, ", time: ", time);
}
}
}
var controls:SomaVideoControls = new SomaVideoControls();
controls.addControl(new CustomTimeBarSkin());
var player:SomaVideoPlayer = new SomaVideoPlayer("video/video.flv", controls);
addChild(player);
var player:SomaVideoPlayer = new SomaVideoPlayer("video/video.flv");
addChild(player);
var skin:SomaVideoTimeBarSkin = player.controls.getControl(SomaVideoTimeBarSkin) as SomaVideoTimeBarSkin;
skin.backgroundColor = 0xFF0000;
skin.backgroundAlpha = .5;
skin.barHeight = 3;
See also
| Property | Defined by | ||
|---|---|---|---|
| backgroundAlpha : Number Specifies the background transparency of the skin (default alpha 0).
| SomaVideoTimeBarSkin | ||
| backgroundColor : uint Specifies the background color of the skin (default is black).
| SomaVideoTimeBarSkin | ||
| barHeight : Number Specifies the height of the bars.
| SomaVideoTimeBarSkin | ||
| durationBar : Sprite [read-only] Get the duration bar.
| SomaVideoTimeBarSkin | ||
| durationBarAlpha : Number Specifies the transparency of the duration bar (default is alpha 0.2).
| SomaVideoTimeBarSkin | ||
| durationBarColor : uint Specifies the color of the duration bar (default is white).
| SomaVideoTimeBarSkin | ||
| preloadingBar : Sprite [read-only] Get the preloading bar.
| SomaVideoTimeBarSkin | ||
| preloadingBarAlpha : Number Specifies the transparency of the time bar (default is alpha 0.4).
| SomaVideoTimeBarSkin | ||
| preloadingBarColor : uint Specifies the color of the preloading bar (default is white).
| SomaVideoTimeBarSkin | ||
| timeBar : Sprite [read-only] Get the time bar.
| SomaVideoTimeBarSkin | ||
| timeBarAlpha : Number Specifies the transparency of the time bar (default is alpha 1).
| SomaVideoTimeBarSkin | ||
| timeBarColor : uint Specifies the color of the time bar (default is white).
| SomaVideoTimeBarSkin | ||
| Method | Defined by | ||
|---|---|---|---|
|
Creates a SomaVideoPlaySkin instance.
| SomaVideoTimeBarSkin | ||
|
bufferCallBack(length:Number, time:Number):void
Methods called whenever the video is buffering.
| SomaVideoTimeBarSkin | ||
|
dispose():void
This method is internally called when you dispose a SomaVideoPlayer to remove children, the event listeners or whatever that needs to be destroyed to free the memory (make the instance elligible to the Garbage Collection).
| SomaVideoTimeBarSkin | ||
|
preloadingCallBack(bytesLoaded:Number, bytesTotal:Number):void
Methods called whenever the video is preloading.
| SomaVideoTimeBarSkin | ||
|
registerPlayer(player:SomaVideoPlayer):void
Register the SomaVideoPlayer instance that will be used with the skin class
| SomaVideoTimeBarSkin | ||
|
timeCallBack(time:Number, duration:Number):void
Methods called whenever the video playhead is updated to display the current time and duration in seconds of the video.
| SomaVideoTimeBarSkin | ||
| backgroundAlpha | property |
backgroundAlpha:Number [read-write]Specifies the background transparency of the skin (default alpha 0).
Implementation public function get backgroundAlpha():Number
public function set backgroundAlpha(value:Number):void
| backgroundColor | property |
backgroundColor:uint [read-write]Specifies the background color of the skin (default is black).
Implementation public function get backgroundColor():uint
public function set backgroundColor(value:uint):void
| barHeight | property |
barHeight:Number [read-write]Specifies the height of the bars.
Implementation public function get barHeight():Number
public function set barHeight(value:Number):void
| durationBar | property |
durationBar:Sprite [read-only]Get the duration bar.
Implementation public function get durationBar():Sprite
| durationBarAlpha | property |
durationBarAlpha:Number [read-write]Specifies the transparency of the duration bar (default is alpha 0.2).
Implementation public function get durationBarAlpha():Number
public function set durationBarAlpha(value:Number):void
| durationBarColor | property |
durationBarColor:uint [read-write]Specifies the color of the duration bar (default is white).
Implementation public function get durationBarColor():uint
public function set durationBarColor(value:uint):void
| preloadingBar | property |
preloadingBar:Sprite [read-only]Get the preloading bar.
Implementation public function get preloadingBar():Sprite
| preloadingBarAlpha | property |
preloadingBarAlpha:Number [read-write]Specifies the transparency of the time bar (default is alpha 0.4).
Implementation public function get preloadingBarAlpha():Number
public function set preloadingBarAlpha(value:Number):void
| preloadingBarColor | property |
preloadingBarColor:uint [read-write]Specifies the color of the preloading bar (default is white).
Implementation public function get preloadingBarColor():uint
public function set preloadingBarColor(value:uint):void
| timeBar | property |
timeBar:Sprite [read-only]Get the time bar.
Implementation public function get timeBar():Sprite
| timeBarAlpha | property |
timeBarAlpha:Number [read-write]Specifies the transparency of the time bar (default is alpha 1).
Implementation public function get timeBarAlpha():Number
public function set timeBarAlpha(value:Number):void
| timeBarColor | property |
timeBarColor:uint [read-write]Specifies the color of the time bar (default is white).
Implementation public function get timeBarColor():uint
public function set timeBarColor(value:uint):void
| SomaVideoTimeBarSkin | () | constructor |
public function SomaVideoTimeBarSkin()Creates a SomaVideoPlaySkin instance.
| bufferCallBack | () | method |
public function bufferCallBack(length:Number, time:Number):voidMethods called whenever the video is buffering.
Parameterslength:Number — A Number indicating the current length of the buffer, this value must reach the time (max value) of the buffer to start to play.
|
|
time:Number — A Number indicating the time of the buffer to reach in seconds (you can set this buffer time property with the SomaVideoPlayer instance property: bufferTime).
|
| dispose | () | method |
public function dispose():voidThis method is internally called when you dispose a SomaVideoPlayer to remove children, the event listeners or whatever that needs to be destroyed to free the memory (make the instance elligible to the Garbage Collection).
| preloadingCallBack | () | method |
public function preloadingCallBack(bytesLoaded:Number, bytesTotal:Number):voidMethods called whenever the video is preloading.
ParametersbytesLoaded:Number — A Number indicating the number of bytes loaded.
|
|
bytesTotal:Number — A Number indicating the total number of bytes to load.
|
| registerPlayer | () | method |
public function registerPlayer(player:SomaVideoPlayer):voidRegister the SomaVideoPlayer instance that will be used with the skin class
Parametersplayer:SomaVideoPlayer — A SomaVideoPlayer instance.
|
| timeCallBack | () | method |
public function timeCallBack(time:Number, duration:Number):voidMethods called whenever the video playhead is updated to display the current time and duration in seconds of the video.
Parameterstime:Number — A Number indicating the current time of the video playhead in seconds.
|
|
duration:Number — A Number indicating the duration of the video (time length) in seconds.
|