Packagecom.apdevblog.ui.video
Classpublic class ApdevVideoPlayer
InheritanceApdevVideoPlayer Inheritance flash.display.Sprite

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9

Custom actionscript-only videoplayer.

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

ApdevVideoControls


Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
Events
 Event Summary Defined By
  Event is fired when STATE of the videoplayer changes.ApdevVideoPlayer
Public Constants
 ConstantDefined By
  DEFAULT_CONTROLS_FADE_OUT_TIME : int = 2000
[static]
ApdevVideoPlayer
  MIN_WIDTH : int = 140
[static]
ApdevVideoPlayer
Property Detail
autoPlayproperty
autoPlay:Boolean

start video directly or wait for a call of the play method.


Implementation
    public function get autoPlay():Boolean
    public function set autoPlay(value:Boolean):void
controlsAutoHideproperty 
controlsAutoHide:Boolean

flag that hides the video's controls automatically.


Implementation
    public function get controlsAutoHide():Boolean
    public function set controlsAutoHide(value:Boolean):void
controlsOverVideoproperty 
controlsOverVideo:Boolean

flag that sets the position of the videoplayer's controls (laying over or at the bottom of the video).


Implementation
    public function get controlsOverVideo():Boolean
    public function set controlsOverVideo(value:Boolean):void
fadeOutTimeproperty 
fadeOutTime:int

time in milliseconds that the controls take to fade out.


Implementation
    public function get fadeOutTime():int
    public function set fadeOutTime(value:int):void
fullscreenTakeoverproperty 
fullscreenTakeover:Boolean

flag whether or not the videoplayer shows in fullscreen when the displaystate changes to DisplayState.FULLSCREEN.


Implementation
    public function get fullscreenTakeover():Boolean
    public function set fullscreenTakeover(value:Boolean):void
videoMetaDataproperty 
videoMetaData:VideoMetadataVo

video's metadata.


Implementation
    public function get videoMetaData():VideoMetadataVo
    public function set videoMetaData(value:VideoMetadataVo):void
videoPlayerHeightproperty 
videoPlayerHeight:int

videoplayer's current height.


Implementation
    public function get videoPlayerHeight():int
    public function set videoPlayerHeight(value:int):void
videoPlayerWidthproperty 
videoPlayerWidth:int

videoplayer's current width.


Implementation
    public function get videoPlayerWidth():int
    public function set videoPlayerWidth(value:int):void
videoStateproperty 
videoState:String

video's current state.


Implementation
    public function get videoState():String
    public function set videoState(value:String):void
videostillproperty 
videostill:*

set the previewimage's url (or URLRequest) (shows before video is playing).


Implementation
    public function get videostill():*
    public function set videostill(value:any):void
volumeproperty 
volume:Number

video's current volume.


Implementation
    public function get volume():Number
    public function set volume(value:Number):void
Constructor Detail
ApdevVideoPlayer()Constructor
public function ApdevVideoPlayer(width:int, height:int, colors:ApdevVideoPlayerDefaultStyle = null)

creates a new ApdevVideoPlayer with specified dimensions.

Parameters
width:int — width of the videoplayer's video
 
height:int — height of the videoplayer's video
 
colors:ApdevVideoPlayerDefaultStyle (default = null)
Method Detail
clear()method
public function clear():void

stops videoplayback and clears screen.

load()method 
public function load(videoUrl:String):void

loads videofile and starts playback (if autoplay is set to true).

Parameters

videoUrl:String — url to videofile

onMetaData()method 
public function onMetaData(data:Object):void

called automatically when video's metadata is loaded.

Parameters

data:Object — video's metadata

pause()method 
public function pause():void

pauses video playback.

play()method 
public function play():void

starts video playback.

resize()method 
public function resize(width:int, height:int):void

resizes 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):void

seeks to specified position in video.

Parameters

seekPercent:Number — percent to jump to in video
 
scrubbing:Boolean (default = false) — if user is scrubbing on timeline

Event Detail
stateUpdate Event
Event Object Type: com.apdevblog.events.video.VideoControlsEvent
VideoControlsEvent.type property = com.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.

Constant Detail
DEFAULT_CONTROLS_FADE_OUT_TIMEConstant
public static const DEFAULT_CONTROLS_FADE_OUT_TIME:int = 2000

MIN_WIDTHConstant 
public static const MIN_WIDTH:int = 140