| Package | com.apdevblog.ui.video |
| Class | public class ApdevVideoPlayer |
| Inheritance | ApdevVideoPlayer flash.display.Sprite |
| Language Version : | ActionScript 3.0 |
| Runtime Versions : | AIR 1.0, Flash Player 9 |
VideoPlayer with controls for play/pause, volume, fullscreen and statusbar.
Player can display every format Flashplayer 9 supports, e.g. flv (sorenson, on2), mov (h.264), mp4.
import com.apdevblog.ui.video.ApdevVideoPlayer;
var video:ApdevVideoPlayer = new ApdevVideoPlayer(320, 240);
video.controlsOverVideo = false;
video.controlsAutoHide = false;
video.videostill = "videostill.jpg";
video.autoPlay = false;
addChild(video);
video.load("video01.mp4");
See also
| Property | Defined By | ||
|---|---|---|---|
| autoPlay : Boolean
start video directly or wait for a call of the play method. | ApdevVideoPlayer | ||
| controlsAutoHide : Boolean
flag that hides the video's controls automatically. | ApdevVideoPlayer | ||
| controlsOverVideo : Boolean
flag that sets the position of the videoplayer's controls
(laying over or at the bottom of the video). | ApdevVideoPlayer | ||
| fadeOutTime : int
time in milliseconds that the controls take to fade out. | ApdevVideoPlayer | ||
| fullscreenTakeover : Boolean
flag whether or not the videoplayer shows in fullscreen when the
displaystate changes to DisplayState.FULLSCREEN. | ApdevVideoPlayer | ||
| videoMetaData : VideoMetadataVo
video's metadata. | ApdevVideoPlayer | ||
| videoPlayerHeight : int
videoplayer's current height. | ApdevVideoPlayer | ||
| videoPlayerWidth : int
videoplayer's current width. | ApdevVideoPlayer | ||
| videoState : String
video's current state. | ApdevVideoPlayer | ||
| videostill : *
set the previewimage's url (or URLRequest)
(shows before video is playing). | ApdevVideoPlayer | ||
| volume : Number
video's current volume. | ApdevVideoPlayer | ||
| Method | Defined By | ||
|---|---|---|---|
ApdevVideoPlayer(width:int, height:int, colors:ApdevVideoPlayerDefaultStyle = null)
creates a new ApdevVideoPlayer with specified dimensions. | ApdevVideoPlayer | ||
clear():void
stops videoplayback and clears screen. | ApdevVideoPlayer | ||
load(videoUrl:String):void
loads videofile and starts playback (if autoplay is set to true). | ApdevVideoPlayer | ||
onMetaData(data:Object):void
called automatically when video's metadata is loaded. | ApdevVideoPlayer | ||
pause():void
pauses video playback. | ApdevVideoPlayer | ||
play():void
starts video playback. | ApdevVideoPlayer | ||
resize(width:int, height:int):void
resizes the whole videoplayer. | ApdevVideoPlayer | ||
seek(seekPercent:Number, scrubbing:Boolean = false):void
seeks to specified position in video. | ApdevVideoPlayer | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Event is fired when STATE of the videoplayer changes. | ApdevVideoPlayer | |||
| Constant | Defined By | ||
|---|---|---|---|
| DEFAULT_CONTROLS_FADE_OUT_TIME : int = 2000 [static] | ApdevVideoPlayer | ||
| MIN_WIDTH : int = 140 [static] | ApdevVideoPlayer | ||
| autoPlay | property |
autoPlay:Booleanstart video directly or wait for a call of the play method.
public function get autoPlay():Boolean public function set autoPlay(value:Boolean):void| controlsAutoHide | property |
controlsAutoHide:Booleanflag that hides the video's controls automatically.
public function get controlsAutoHide():Boolean public function set controlsAutoHide(value:Boolean):void| controlsOverVideo | property |
controlsOverVideo:Booleanflag that sets the position of the videoplayer's controls (laying over or at the bottom of the video).
public function get controlsOverVideo():Boolean public function set controlsOverVideo(value:Boolean):void| fadeOutTime | property |
fadeOutTime:inttime in milliseconds that the controls take to fade out.
public function get fadeOutTime():int public function set fadeOutTime(value:int):void| fullscreenTakeover | property |
fullscreenTakeover:Booleanflag whether or not the videoplayer shows in fullscreen when the displaystate changes to DisplayState.FULLSCREEN.
public function get fullscreenTakeover():Boolean public function set fullscreenTakeover(value:Boolean):void| videoMetaData | property |
videoMetaData:VideoMetadataVovideo's metadata.
public function get videoMetaData():VideoMetadataVo public function set videoMetaData(value:VideoMetadataVo):void| videoPlayerHeight | property |
videoPlayerHeight:intvideoplayer's current height.
public function get videoPlayerHeight():int public function set videoPlayerHeight(value:int):void| videoPlayerWidth | property |
videoPlayerWidth:intvideoplayer's current width.
public function get videoPlayerWidth():int public function set videoPlayerWidth(value:int):void| videoState | property |
videoState:Stringvideo's current state.
public function get videoState():String public function set videoState(value:String):void| videostill | property |
videostill:*set the previewimage's url (or URLRequest) (shows before video is playing).
public function get videostill():* public function set videostill(value:any):void| volume | property |
volume:Numbervideo's current volume.
public function get volume():Number public function set volume(value:Number):void| ApdevVideoPlayer | () | Constructor |
public function ApdevVideoPlayer(width:int, height:int, colors:ApdevVideoPlayerDefaultStyle = null)creates a new ApdevVideoPlayer with specified dimensions.
Parameterswidth:int — width of the videoplayer's video | |
height:int — height of the videoplayer's video
| |
colors:ApdevVideoPlayerDefaultStyle (default = null) |
| clear | () | method |
public function clear():voidstops videoplayback and clears screen.
| load | () | method |
public function load(videoUrl:String):voidloads videofile and starts playback (if autoplay is set to true).
Parameters
videoUrl:String — url to videofile
|
| onMetaData | () | method |
public function onMetaData(data:Object):voidcalled automatically when video's metadata is loaded.
Parameters
data:Object — video's metadata
|
| pause | () | method |
public function pause():voidpauses video playback.
| play | () | method |
public function play():voidstarts video playback.
| resize | () | method |
public function resize(width:int, height:int):voidresizes the whole videoplayer.
Parameters
width:int — new width of the videoplayer
| |
height:int — new height of the videoplayer
|
| seek | () | method |
public function seek(seekPercent:Number, scrubbing:Boolean = false):voidseeks to specified position in video.
Parameters
seekPercent:Number — percent to jump to in video
| |
scrubbing:Boolean (default = false) — if user is scrubbing on timeline
|
| stateUpdate | Event |
com.apdevblog.events.video.VideoControlsEventcom.apdevblog.events.video.VideoControlsEvent.STATE_UPDATE| Language Version : | ActionScript 3.0 |
| Runtime Versions : | AIR 1.0, Flash Player 9 |
Event is fired when STATE of the videoplayer changes.
| DEFAULT_CONTROLS_FADE_OUT_TIME | Constant |
public static const DEFAULT_CONTROLS_FADE_OUT_TIME:int = 2000| MIN_WIDTH | Constant |
public static const MIN_WIDTH:int = 140