AnyClip Players‎ > ‎

Reference: Minimal Player

DocumentationAll Packages | All Classes | Index | Frames Adobe Logo
MinimalPlayerProperties | Methods | Constants
 
PackageTop Level
Classpublic class MinimalPlayer
InheritanceMinimalPlayer Inheritance flash.display.Sprite


Protected Properties
 PropertyDefined By
  clipDuration : Number
The video clip's duration returned in getDuration() when called from the Widget, can also be retrieved from the videoMetadata object
MinimalPlayer
  clipStartedEventDispatched : Boolean
Used as a flag to make sure the clipStarted event isn't reported twice per clip
MinimalPlayer
  connection : NetConnection
The video's server connection object
MinimalPlayer
  connectionHasEventListeners : Boolean
A flag used to determine whether the connection object has event listeners (in order to clear them between clips if the video's host is different)
MinimalPlayer
  currentHeight : Number
^the same, for width
MinimalPlayer
  currentWidth : Number
used to identify a change in external dimensions in order to prevent repetitive calls in updateDisplay() method.
MinimalPlayer
  eventsFunc : String
^ditto
MinimalPlayer
  firstPlay : Boolean = true
A flag for deciding if it is the first time that the current clip is played? resets to "true" for each loaded clip.
MinimalPlayer
  lastNetStatusCode : String
Determines the last recieved netstatus code and checked in onNetStatus() in order to prevent "false positives" (i.e.
MinimalPlayer
  muted : Boolean
Current state of muting, returned through isMuted() when called from the Widget.
MinimalPlayer
  muteOnLoad : Boolean
determines whether the player should start in muted mode, defaulted to "true" on initFlashVars() if not specified
MinimalPlayer
  placementId : String
^ditto
MinimalPlayer
  playerId : String
legacy, but might be still used in some parts of the widget.
MinimalPlayer
  ratio : Number = 1
the video ratio, updated once the video metadata is recieved by making a division of the video file's original width and height.
MinimalPlayer
  sprintLabel : String = Jaws
The Right-Click Context menu sprint label value
MinimalPlayer
  sprintVersion : String = 0.1.0
The Right-Click Context menu sprint version value
MinimalPlayer
  stream : NetStream
The video's stream object
MinimalPlayer
  streamFile : String
the file name including extension
MinimalPlayer
  streamHost : String
the video file's url including folder and subfolder
MinimalPlayer
  streamProtocol : String
the video file url's protocol."rtmp"/"http"
MinimalPlayer
  updateViewActive : Boolean
used to prevent simultanious calls to updateView() method.
MinimalPlayer
  video : Video
The video display object
MinimalPlayer
  videoMetadata : Object
A data object from the loaded video file
MinimalPlayer
  _volume : Number = 1
local volume value (for reference only)
MinimalPlayer
Public Methods
 MethodDefined By
  
Constructor
MinimalPlayer
  
addChild(child:DisplayObject):DisplayObject
[override] Overriden the default addChild method in order to force a call to udpateVide();
MinimalPlayer
  
onBWDone(... parameters):void
DO NOT REMOVE! Required by the connection and the stream (since their client propery is set to "this") in order to prevent an error
MinimalPlayer
  
onMetaData(metadata:Object):void
DO NOT REMOVE! Required by the connection and the stream (since their client propery is set to "this") Called by the connection and the stream once the video file's stream has been connected and the video metadata has been loaded
MinimalPlayer
  
onPlayStatus(info:Object):void
Used to determine the absolute real end of the video playback.
MinimalPlayer
Protected Methods
 MethodDefined By
  
Add the connection's event listeners for security, IO, and netstatus object's events
MinimalPlayer
  
addJS(functionName:String, callback:Function):void
Adds an internal callback for external call from JavaScript
MinimalPlayer
  
Adds the stream object's listeners
MinimalPlayer
  
addUI():void
Add any UI related object
MinimalPlayer
  
callJS(functionName:String, ... parameters):void
Calling to the external function specified in "eventsFunc" flashvar supplied externally
MinimalPlayer
  
callJSWithLabel(functionName:String, label:String):void
The same as callJS but with a label parameter for additional info if needed
MinimalPlayer
  
Called if the connection for the current clip's video has failed
MinimalPlayer
  
called once the connection is successful and proceeds to the creation of the stream and attaching it to the video object.
MinimalPlayer
  
consoleJS(str:String, type:String = log):void
Log to the browser's console.
MinimalPlayer
  
error(message:String, id:int):void
Removes the connection and the stream listeners.
MinimalPlayer
  
getDuration():Number
Returns the current clip's total duration, called externally
MinimalPlayer
  
getPlayhead():Number
Returns the current position of the clip
MinimalPlayer
  
getVolume():Number
Returns the current stream's volume, called externally
MinimalPlayer
  
Loading/Resetting the essential for playback flashvars
MinimalPlayer
  
MinimalPlayer
  
isMuted():Boolean
Checked whether the clip is currently muted.
MinimalPlayer
  
loadClip(... parameters):void
Loads a clip, called externally by the widget refer to the parameters on the loadClip call from the widget.
MinimalPlayer
  
mute():void
Mutes the clip, also called externally
MinimalPlayer
  
onAsyncError(event:AsyncErrorEvent):void
MinimalPlayer
  
onIOError(event:IOErrorEvent):void
MinimalPlayer
  
onNetStatus(event:NetStatusEvent):void
The intersection between playback events and events reporting, each net NetStatusEvent is recieved from the stream and the connection objects and contains information about the current state of each of them.
MinimalPlayer
  
onSecurityError(event:SecurityErrorEvent):void
MinimalPlayer
  
pause():void
Pauses the stream, also can be called externally
MinimalPlayer
  
Removes the current connection's event in order to free some resources.
MinimalPlayer
  
Removes the stream object's listeners in order to free some resources
MinimalPlayer
  
resizeVideo(width:Number, height:Number):void
Resizes the video object's dimensions and position while maintains the ratio
MinimalPlayer
  
resume():void
Resumes the stream, also can be called externally
MinimalPlayer
  
seek(value:Number):void
Seeking the stream's playhead to a desired value
MinimalPlayer
  
setStage(event:Event):void
Defining the player's alignment, scale, and connect it to a resizing and positioning "deamon" (updateView)
MinimalPlayer
  
setVolume(value:Number):void
Sets the volume for the current stream, called externally.
MinimalPlayer
  
Called once the video's stream has been closed
MinimalPlayer
  
Called if the video's stream has failed.
MinimalPlayer
  
Called if the video's stream isn't found
MinimalPlayer
  
Called if the video's stream has been rejected.
MinimalPlayer
  
Called once the video's stream has started playing
MinimalPlayer
  
unMute():void
UnMutes the clip, also called externally
MinimalPlayer
  
updateView(event:Event = null, force:Boolean = false):void
Updates the player's objects positioning and sizing, called upon each frame change, child add
MinimalPlayer
  
videoEnded():void
Called once the video playback is completed
MinimalPlayer
Protected Constants
 ConstantDefined By
  CLIP_ENDED : String = clipEnded
[static]
MinimalPlayer
  CLIP_FAILED : String = clipFailed
[static]
MinimalPlayer
  CLIP_READY : String = clipReady
[static]
MinimalPlayer
  CLIP_STARTED : String = clipStarted
[static]
MinimalPlayer
  GET_DURATION : String = getDuration
[static]
MinimalPlayer
  GET_PLAYHEAD : String = getPlayhead
[static]
MinimalPlayer
  GET_VOLUME : String = getVolume
[static]
MinimalPlayer
  IS_MUTED : String = isMuted
[static]
MinimalPlayer
  LOAD_CLIP : String = loadClip
[static]
MinimalPlayer
  MUTE : String = mute
[static]
MinimalPlayer
  PAUSE : String = pause
[static]
MinimalPlayer
  PLAYER_LOADED : String = playerLoaded
[static]
MinimalPlayer
  PLAYER_LOAD_STARTED : String = playerLoadStarted
[static]
MinimalPlayer
  READY_TO_NEXT_CLIP : String = readyToNextClip
[static]
MinimalPlayer
  RESUME : String = resume
[static]
MinimalPlayer
  SEEK : String = seek
[static]
MinimalPlayer
  SET_VOLUME : String = setVolume
[static]
MinimalPlayer
  STREAM_LOADING : String = streamLoading
[static]
MinimalPlayer
  UNMUTE : String = unmute
[static]
MinimalPlayer
Property Detail
_volumeproperty
protected var _volume:Number = 1

local volume value (for reference only)

clipDurationproperty 
protected var clipDuration:Number

The video clip's duration returned in getDuration() when called from the Widget, can also be retrieved from the videoMetadata object

clipStartedEventDispatchedproperty 
protected var clipStartedEventDispatched:Boolean

Used as a flag to make sure the clipStarted event isn't reported twice per clip

connectionproperty 
protected var connection:NetConnection

The video's server connection object

connectionHasEventListenersproperty 
protected var connectionHasEventListeners:Boolean

A flag used to determine whether the connection object has event listeners (in order to clear them between clips if the video's host is different)

currentHeightproperty 
protected var currentHeight:Number

^the same, for width

currentWidthproperty 
protected var currentWidth:Number

used to identify a change in external dimensions in order to prevent repetitive calls in updateDisplay() method.

eventsFuncproperty 
protected var eventsFunc:String

^ditto

firstPlayproperty 
protected var firstPlay:Boolean = true

A flag for deciding if it is the first time that the current clip is played? resets to "true" for each loaded clip. used to decide whether to report if the clip is ready for playback or has actually started playing (on streamStarted() method)

lastNetStatusCodeproperty 
protected var lastNetStatusCode:String

Determines the last recieved netstatus code and checked in onNetStatus() in order to prevent "false positives" (i.e. double "Play" event which might occur and mess the reports)

mutedproperty 
protected var muted:Boolean

Current state of muting, returned through isMuted() when called from the Widget.

muteOnLoadproperty 
protected var muteOnLoad:Boolean

determines whether the player should start in muted mode, defaulted to "true" on initFlashVars() if not specified

placementIdproperty 
protected var placementId:String

^ditto

playerIdproperty 
protected var playerId:String

legacy, but might be still used in some parts of the widget. originally used in callJS() to identify which player made the call to the widget (in case of many widgets).

ratioproperty 
protected var ratio:Number = 1

the video ratio, updated once the video metadata is recieved by making a division of the video file's original width and height.

sprintLabelproperty 
protected var sprintLabel:String = Jaws

The Right-Click Context menu sprint label value

sprintVersionproperty 
protected var sprintVersion:String = 0.1.0

The Right-Click Context menu sprint version value

streamproperty 
protected var stream:NetStream

The video's stream object

streamFileproperty 
protected var streamFile:String

the file name including extension

streamHostproperty 
protected var streamHost:String

the video file's url including folder and subfolder

streamProtocolproperty 
protected var streamProtocol:String

the video file url's protocol."rtmp"/"http"

updateViewActiveproperty 
protected var updateViewActive:Boolean

used to prevent simultanious calls to updateView() method.

videoproperty 
protected var video:Video

The video display object

videoMetadataproperty 
protected var videoMetadata:Object

A data object from the loaded video file

Constructor Detail
MinimalPlayer()Constructor
public function MinimalPlayer()

Constructor

Method Detail
addChild()method
override public function addChild(child:DisplayObject):DisplayObject

Overriden the default addChild method in order to force a call to udpateVide();

Parameters

child:DisplayObject
Returns
DisplayObject
addConnectionListeners()method 
protected function addConnectionListeners():void

Add the connection's event listeners for security, IO, and netstatus object's events

addJS()method 
protected function addJS(functionName:String, callback:Function):void

Adds an internal callback for external call from JavaScript

Parameters

functionName:String — - the name of the function called from JavaScript
 
callback:Function — - the function instance to connect to the functionName

See also

callJS
addStreamListeners()method 
protected function addStreamListeners():void

Adds the stream object's listeners

addUI()method 
protected function addUI():void

Add any UI related object

callJS()method 
protected function callJS(functionName:String, ... parameters):void

Calling to the external function specified in "eventsFunc" flashvar supplied externally

Parameters

functionName:String — - the function name of the actual function you're calling in the widget ...parameters are unlimited and sent in the "parameters" object below
 
... parameters
callJSWithLabel()method 
protected function callJSWithLabel(functionName:String, label:String):void

The same as callJS but with a label parameter for additional info if needed

Parameters

functionName:String — - the function name of the actual function you're calling in the widget
 
label:String — - a custom label to send to the required function
connectionFailed()method 
protected function connectionFailed():void

Called if the connection for the current clip's video has failed

connectionSuccess()method 
protected function connectionSuccess():void

called once the connection is successful and proceeds to the creation of the stream and attaching it to the video object.

See also

loadClip
consoleJS()method 
protected function consoleJS(str:String, type:String = log):void

Log to the browser's console.

Parameters

str:String — - A string for the log
 
type:String (default = log) — - the type of the "log" can be set to "debug", "info" etc..
error()method 
protected function error(message:String, id:int):void

Removes the connection and the stream listeners. might be a good place to send the error over to statistics if needed

Parameters

message:String
 
id:int
getDuration()method 
protected function getDuration():Number

Returns the current clip's total duration, called externally

Returns
Number — The current position of the clip in seconds (or -1 if stream isn't ready). called externally
getPlayhead()method 
protected function getPlayhead():Number

Returns the current position of the clip

Returns
Number — The current position of the clip in seconds (or -1 if stream isn't ready). called externally
getVolume()method 
protected function getVolume():Number

Returns the current stream's volume, called externally

Returns
Number — The current stream's volume (between 0-1)
initFlashVars()method 
protected function initFlashVars():void

Loading/Resetting the essential for playback flashvars

initJSFlashVars()method 
protected function initJSFlashVars():void
isMuted()method 
protected function isMuted():Boolean

Checked whether the clip is currently muted. called externally

Returns
Boolean
loadClip()method 
protected function loadClip(... parameters):void

Loads a clip, called externally by the widget refer to the parameters on the loadClip call from the widget.

Parameters

... parameters
mute()method 
protected function mute():void

Mutes the clip, also called externally

onAsyncError()method 
protected function onAsyncError(event:AsyncErrorEvent):void

Parameters

event:AsyncErrorEvent
onBWDone()method 
public function onBWDone(... parameters):void

DO NOT REMOVE! Required by the connection and the stream (since their client propery is set to "this") in order to prevent an error

Parameters

... parameters
onIOError()method 
protected function onIOError(event:IOErrorEvent):void

Parameters

event:IOErrorEvent
onMetaData()method 
public function onMetaData(metadata:Object):void

DO NOT REMOVE! Required by the connection and the stream (since their client propery is set to "this") Called by the connection and the stream once the video file's stream has been connected and the video metadata has been loaded

Parameters

metadata:Object — - raw metadata of the video
onNetStatus()method 
protected function onNetStatus(event:NetStatusEvent):void

The intersection between playback events and events reporting, each net NetStatusEvent is recieved from the stream and the connection objects and contains information about the current state of each of them. then and responds accordingly with a method.

Parameters

event:NetStatusEvent
onPlayStatus()method 
public function onPlayStatus(info:Object):void

Used to determine the absolute real end of the video playback.

Parameters

info:Object
onSecurityError()method 
protected function onSecurityError(event:SecurityErrorEvent):void

Parameters

event:SecurityErrorEvent
pause()method 
protected function pause():void

Pauses the stream, also can be called externally

removeConnectionListeners()method 
protected function removeConnectionListeners():void

Removes the current connection's event in order to free some resources.

removeStreamListeners()method 
protected function removeStreamListeners():void

Removes the stream object's listeners in order to free some resources

resizeVideo()method 
protected function resizeVideo(width:Number, height:Number):void

Resizes the video object's dimensions and position while maintains the ratio

Parameters

width:Number — - the requiered width for the video in pixels
 
height:Number — - the requiered height for the video in pixels
resume()method 
protected function resume():void

Resumes the stream, also can be called externally

seek()method 
protected function seek(value:Number):void

Seeking the stream's playhead to a desired value

Parameters

value:Number — - the desired value in seconds
setStage()method 
protected function setStage(event:Event):void

Defining the player's alignment, scale, and connect it to a resizing and positioning "deamon" (updateView)

Parameters

event:Event
setVolume()method 
protected function setVolume(value:Number):void

Sets the volume for the current stream, called externally. If the volume is 0, the muted flag is set to true, else it's false.

Parameters

value:Number — - The required volume value (between 0-1, e.g. 0.33 for third of the available volume)
streamClosed()method 
protected function streamClosed():void

Called once the video's stream has been closed

streamFailed()method 
protected function streamFailed():void

Called if the video's stream has failed.

streamNotFound()method 
protected function streamNotFound():void

Called if the video's stream isn't found

streamRejected()method 
protected function streamRejected():void

Called if the video's stream has been rejected.

streamStarted()method 
protected function streamStarted():void

Called once the video's stream has started playing

unMute()method 
protected function unMute():void

UnMutes the clip, also called externally

updateView()method 
protected function updateView(event:Event = null, force:Boolean = false):void

Updates the player's objects positioning and sizing, called upon each frame change, child add

Parameters

event:Event (default = null) — - specified in order to work with the event listener of ADDED_TO_Stage
 
force:Boolean (default = false) — - set to true in order to force positioning and resizing

See also

videoEnded()method 
protected function videoEnded():void

Called once the video playback is completed

Constant Detail
CLIP_ENDEDConstant
protected static const CLIP_ENDED:String = clipEnded
CLIP_FAILEDConstant 
protected static const CLIP_FAILED:String = clipFailed
CLIP_READYConstant 
protected static const CLIP_READY:String = clipReady
CLIP_STARTEDConstant 
protected static const CLIP_STARTED:String = clipStarted
GET_DURATIONConstant 
protected static const GET_DURATION:String = getDuration
GET_PLAYHEADConstant 
protected static const GET_PLAYHEAD:String = getPlayhead
GET_VOLUMEConstant 
protected static const GET_VOLUME:String = getVolume
IS_MUTEDConstant 
protected static const IS_MUTED:String = isMuted
LOAD_CLIPConstant 
protected static const LOAD_CLIP:String = loadClip
MUTEConstant 
protected static const MUTE:String = mute
PAUSEConstant 
protected static const PAUSE:String = pause
PLAYER_LOAD_STARTEDConstant 
protected static const PLAYER_LOAD_STARTED:String = playerLoadStarted
PLAYER_LOADEDConstant 
protected static const PLAYER_LOADED:String = playerLoaded
READY_TO_NEXT_CLIPConstant 
protected static const READY_TO_NEXT_CLIP:String = readyToNextClip
RESUMEConstant 
protected static const RESUME:String = resume
SEEKConstant 
protected static const SEEK:String = seek
SET_VOLUMEConstant 
protected static const SET_VOLUME:String = setVolume
STREAM_LOADINGConstant 
protected static const STREAM_LOADING:String = streamLoading
UNMUTEConstant 
protected static const UNMUTE:String = unmute





Thu Mar 12 2015, 09:17 PM +02:00
Comments