Package | impression.players |
Class | public class SWFVideoPlayer |
Inheritance | SWFVideoPlayer ![]() ![]() ![]() |
These storyboards display a single animation. They typically include student text to accompany the animation and some type of control mechanism to manage (stop/restart) the animation. The shell handles this functionality -- the SWFVideoPlayer object itself is only responsible for playback of the animation. A number of methods and events are provided to allow the shell author to easily create custom playback controllers.
The SWFVideoPlayer supports both stepped and non-stepped ("traditional") animations. A stepped animation is a single file that contains several related movie clips, each occupying one frame on the root timeline of the main video file. These animations can be played individually (stepped mode) or continuously (one after the other).
The SWFVideoPlayer injects a reference to itself into the animation (as the
.player
property) at the root level of the .SWF. This gives animation
creators additional control over the player allowing for advanced manipulation of
the display.
Property | Defined By | ||
---|---|---|---|
![]() | alwaysCheckComplete : Boolean
Specifies how the object should handle storyboard completion. | BasePlayer | |
currentStep : int
Specifies the current step number. | SWFVideoPlayer | ||
isPlayable : Boolean [read-only]
Indicates whether the current state of the animation can be manipulated by the playback methods. | SWFVideoPlayer | ||
isSteppedVideo : Boolean [read-only]
Indicates whether the current storyboard is a stepped animation. | SWFVideoPlayer | ||
![]() | narrationComplete : Boolean
Indicates whether narration has finished playing. | BasePlayer | |
renderingSurface : Sprite [override]
The object to render content on. | SWFVideoPlayer | ||
![]() | resolver : AssetResolver
The AssetResolver to use to request external assets. | RenderingPlayer | |
status : String [read-only]
Identifies the current status of the animation. | SWFVideoPlayer | ||
storyboard : Storyboard [override]
The storyboard associated with the player. | SWFVideoPlayer | ||
totalSteps : int [read-only]
Identifies the total number of steps in the loaded animation. | SWFVideoPlayer |
Method | Defined By | ||
---|---|---|---|
SWFVideoPlayer(renderingSurface:Sprite = null, resolver:AssetResolver = null)
Creates a new instance of the SWFVideoPlayer. | SWFVideoPlayer | ||
![]() | checkForComplete():void
Causes the player to examine the completion criteria for the current storyboard. | BasePlayer | |
![]() | clearStyle(style:String):void
Deletes a style property, reverting it back to its default value. | RenderingPlayer | |
getStoryboardState(sb:Storyboard):String [static]
Creates a string describing the state of the storyboard. | SWFVideoPlayer | ||
![]() | getStyle(style:String):Object
Retrieves a style property. | RenderingPlayer | |
getStyleDefinition():Object [static]
Retrieves the default style map for the SWFVideoPlayer. | SWFVideoPlayer | ||
pause():void
Pauses or resumes playback at the current location. | SWFVideoPlayer | ||
playStep():void
Plays the current step. | SWFVideoPlayer | ||
playToEnd():void
Plays all steps, in sequence, from the current step without stopping. | SWFVideoPlayer | ||
![]() | redraw():void
Forces a complete redraw of the content. | RenderingPlayer | |
resetStoryboard(sb:Storyboard):void [static]
Removes all properties set by the player. | SWFVideoPlayer | ||
setStoryboardState(sb:Storyboard, state:String):void [static]
Modifies the storyboard to match the described state passed. | SWFVideoPlayer | ||
![]() | setStyle(style:String, value:Object):void
Sets a style property. | RenderingPlayer |
Method | Defined By | ||
---|---|---|---|
detachSurface():void [override]
Removes any connections between the rendering surface and the player. | SWFVideoPlayer | ||
eraseSurface():void [override]
Removes all content from the surface. | SWFVideoPlayer | ||
![]() | initializeStoryboard():void
Initializes the storyboard. | BasePlayer | |
loadStoryboard():void [override]
Loads the storyboard. | SWFVideoPlayer | ||
![]() | maskSurface():void
Adds a mask to the rendering surface if the maskRenderingSurface style property value is true. | RenderingPlayer | |
[override]
Removes known completion criteria from the CompleteRemaining storyboard persisted property. | SWFVideoPlayer | ||
![]() | renderBackground():void
Draws the background rectangle onto the rendering surface. | RenderingPlayer | |
renderContent():void [override]
Renders the content onto the surface. | SWFVideoPlayer | ||
unloadStoryboard():void [override]
Performs cleanup actions when a storyboard is unloaded. | SWFVideoPlayer |
Event | Summary | Defined By | ||
---|---|---|---|---|
![]() | Dispatched when the BasePlayer needs to resolve completion criteria beyond those defined for the class. | BasePlayer | ||
![]() | Dispatched when a storyboard is marked as complete. | BasePlayer | ||
![]() | Dispatched when the player begins to load external assets. | RenderingPlayer | ||
![]() | Dispatched when all external assets have finished loading. | RenderingPlayer | ||
![]() | Dispatched when some type of input or output failure occurs. | RenderingPlayer | ||
![]() | Dispatched after a storyboard is initialized. | BasePlayer | ||
![]() | Dispatched when some type of input or output failure occurs. | RenderingPlayer | ||
![]() | Dispatched when storyboard loading is complete. | BasePlayer | ||
![]() | Dispatched when a storyboard is loaded, but before any processing occurs. | BasePlayer | ||
![]() | Dispatched when some type of input or output failure occurs. | RenderingPlayer | ||
![]() | Dispatched before a storyboard is unloaded. | BasePlayer | ||
![]() | Dispatched when some type of input or output failure occurs. | RenderingPlayer | ||
Dispatched when the ENTER_FRAME event of the current step clip is dispatched. | SWFVideoPlayer | |||
Dispatched when the status of the animation changes. | SWFVideoPlayer |
Style | Description | Defined By | ||
---|---|---|---|---|
![]() | Type: Boolean Whether or not the primary asset should be resized when loaded to width x height . | RenderingPlayer | ||
![]() | Type: Number The background color transparency of the rendering surface. | RenderingPlayer | ||
![]() | Type: uint Format: Color The background color of the rendering surface. | RenderingPlayer | ||
beginOnInit | Type: Boolean Specifies when the player should start processing the loaded animation. If this style value is false . | SWFVideoPlayer | ||
![]() | Type: Boolean The value of all assets' cacheAsBitmap property that the player should set once the asset is loaded. | RenderingPlayer | ||
completeRequiresPlay | Type: Boolean Specifies when a storyboard can be marked complete. If this style value is false . | SWFVideoPlayer | ||
![]() | Type: Object The default LoaderContext object to use when assets are loaded. | RenderingPlayer | ||
![]() | Type: Number Format: Length The height of the rendering surface, in pixels. | RenderingPlayer | ||
![]() | Type: Boolean Whether or not the rendering surface should be masked to width x height . | RenderingPlayer | ||
steppedAutoplayType | Type: String Specifies what action should occur if the storyboard contains a stepped animation marked for autoplay. This style value should be either the SWFVideoPlayer.STEPPED_AUTOPLAY_FIRST_STEP . | SWFVideoPlayer | ||
stepsCompleteWhen | Type: String Specifies when a step should be marked complete. If this style value is SWFVideoPlayer.AT_END . | SWFVideoPlayer | ||
stepsStopAt | Type: String Specifies where the playStep() method should stop the playhead when the step has finished
playing.
If this style value is SWFVideoPlayer.AT_END . | SWFVideoPlayer | ||
![]() | Type: Number Format: Length The width of the rendering surface, in pixels. | RenderingPlayer |
Constant | Defined By | ||
---|---|---|---|
AT_END : String = atEnd [static]
The playStep() method should stop playback on the last frame of the current step. | SWFVideoPlayer | ||
AT_START : String = atStart [static]
The playStep() method should stop playback on the first frame of the next step. | SWFVideoPlayer | ||
STEPPED_AUTOPLAY_FIRST_STEP : String = firstStep [static]
A storyboard containing a stepped animation that is marked as autoplay should only play the first
step of the animation when first loaded. | SWFVideoPlayer | ||
STEPPED_AUTOPLAY_PLAY_TO_END : String = playToEnd [static]
A storyboard containing a stepped animation that is marked as autoplay should only all steps of
the animation when first loaded. | SWFVideoPlayer |
currentStep | property |
currentStep:int
Specifies the current step number.
If the storyboard
property value is null
, the isPlayable
property
value is false
, or no file has been loaded, -1
is returned. If the status
property value is VideoPlayerStatusTypes.EOF
, totalSteps + 1
is returned.
When this property value is set to a number in (1 <= [value] <= totalSteps
), the player moves
the playhead to the first frame of the indicated step clip, stops playback, and dispatches a VideoStatusEvent.STATUS_CHANGE
event with a status
property value of VideoPlayerStatusTypes.STOPPPED
. If the property
value is set to totalSteps + 1
, the player moves the playhead to the last frame of the last step clip,
stops playback, and dispatches a VideoStatusEvent.STATUS_CHANGE
event with a status
property
value of VideoPlayerStatusTypes.EOF
.
public function get currentStep():int
public function set currentStep(value:int):void
See also
isPlayable | property |
isPlayable:Boolean
[read-only] Indicates whether the current state of the animation can be manipulated by the playback methods.
public function get isPlayable():Boolean
See also
isSteppedVideo | property |
isSteppedVideo:Boolean
[read-only] Indicates whether the current storyboard is a stepped animation.
public function get isSteppedVideo():Boolean
renderingSurface | property |
renderingSurface:Sprite
[override] The object to render content on.
If the existing rendering surface has existing content, it is not removed prior to setting the new surface. Note that any loading in progress will be cancelled, and all communication with and references to the player are removed.
You must manually invoke the redraw()
method
if you want to render the current storyboard onto the new surface.
If this property value is set to null
, the player will
dispatch a VideoStatusEvent.STATUS_CHANGE
event with a status
property value of VideoPlayerStatusTypes.NO_SURFACE
.
public function get renderingSurface():Sprite
public function set renderingSurface(value:Sprite):void
status | property |
status:String
[read-only]
Identifies the current status of the animation. This value will be one of the
VideoPlayerStatusTypes
constant values.
public function get status():String
See also
storyboard | property |
storyboard:Storyboard
[override] The storyboard associated with the player.
If null
is passed, the current storyboard is
unloaded, the unload
event is dispatched, and
no further action occurs.
If a non-null
storyboard object is passed, the following actions occur, in order:
null
, the unload
event is dispatched. If the event is not cancelled, the current storyboard is unloaded. If the event is cancelled, further processing stops.null
, the loadStart
event is dispatched. If the event is not cancelled, the new storyboard is associated with the player. If the event is cancelled, further processing stops and the value of this property is set to null
. Initialized
persisted property is false
, the storyboard is initialized and the initialize
event is dispatched.contentLoadBegin
event is dispatched.contentLoadEnd
event is dispatched, followed by the loadComplete
event.loadComplete
event was dispatched, the checkForComplete()
method is invoked. If all completion criteria have
been met, the complete
event is dispatched.Note that the SWFVideoPlayer may raise one or move statusChange
events during storyboard load.
If either the renderingSurface
or resolver
properties are null
, the content will not be rendered, and
no error will occur. Processing will continue as if all external assets have been loaded.
public function get storyboard():Storyboard
public function set storyboard(value:Storyboard):void
See also
totalSteps | property |
totalSteps:int
[read-only] Identifies the total number of steps in the loaded animation.
If the storyboard
property value is null
, -1
is returned.
If the isSteppedVideo
property value is false
, 1
is returned.
public function get totalSteps():int
SWFVideoPlayer | () | Constructor |
public function SWFVideoPlayer(renderingSurface:Sprite = null, resolver:AssetResolver = null)
Creates a new instance of the SWFVideoPlayer.
ParametersrenderingSurface:Sprite (default = null ) — The object to render content on.
| |
resolver:AssetResolver (default = null ) — The AssetResolver to use to request external assets.
|
detachSurface | () | method |
override protected function detachSurface():void
Removes any connections between the rendering surface and the player.
This method is invoked by the player when a storyboard is unloaded, the redraw()
method is
invoked, or the renderingSurface
property is changed. When detaching a rendering surface, the
SWFVideoPlayer performs the following actions:
See also
eraseSurface | () | method |
override protected function eraseSurface():void
Removes all content from the surface.
This method is invoked by the player when a storyboard is unloaded or when the redraw()
method is
invoked. When erasing a rendering surface, the FlashObjectPlayer performs the following actions:
See also
getStoryboardState | () | method |
public static function getStoryboardState(sb:Storyboard):String
Creates a string describing the state of the storyboard.
This method returns a single character to describe
the state of the storyboard. If the storyboard is marked complete,
"c
" is returned. If the storyboard has been
initialized, but is not marked complete, "i
" is
returned. Otherwise ".
" is returned.
Note that this string only describes the state that the player is aware of. If the shell stores additional data in the storyboard, it is the shell's responsibility to store the additional data if it is needed.
Parameters
sb:Storyboard — The storyboard to describe the state of.
|
String — The state of the storyboard.
|
getStyleDefinition | () | method |
public static function getStyleDefinition():Object
Retrieves the default style map for the SWFVideoPlayer.
ReturnsObject — Default styles object.
|
loadStoryboard | () | method |
override protected function loadStoryboard():void
Loads the storyboard.
This method is invoked by the storyboard
property set method when a non-null
storyboard object is loaded after initialization (if needed) occurs.
When loading a storyboard, the SWFVideoPlayer performs the following actions:
alwaysCheckComplete
property value is true
, the Complete
persisted property of each ChildElement in the storyboard's children
collection is set to false
.alwaysCheckComplete
property value is true
, the StepComplete
storyboard persisted property is set to false
.See also
pause | () | method |
public function pause():void
Pauses or resumes playback at the current location.
The specific behavior of this method depends on the value of the status
property.
If the status
property value is PLAYING_STEP
, invoking this method will stop
playback on the current frame. The player will dispatch a VideoStatusEvent.STATUS_CHANGE
event
with a status
property value of VideoPlayerStatusTypes.STEP_PAUSED
. If the
status
property value is PLAYING_TO_END
, invoking this method will stop playback
on the current frame. The player will dispatch a VideoStatusEvent.STATUS_CHANGE
event
with a status
property value of VideoPlayerStatusTypes.PAUSED_TO_END
.
If the status
property value is STEP_PAUSED
, invoking this method has the
same effect as invoking the playStep()
method. If the status
property value
is PAUSED_TO_END
, invoking this method has the same effect as invoking the playToEnd()
method.
For all other status
property values, invoking this method has no effect.
See also
playStep | () | method |
public function playStep():void
Plays the current step.
The specific behavior of this method depends on the value of the status
property.
If the status
property value is one of the following, this method begins playback of the
current step from the first frame, and will stop when playback of the current step is complete:
VideoPlayerStatusTypes.INITIALIZED
VideoPlayerStatusTypes.BEGIN_PLAY
VideoPlayerStatusTypes.STOPPED
If the status
property value is one of the following, this method begins playback of the
current step from the current frame, and will stop when playback of the current step is complete:
VideoPlayerStatusTypes.PLAYING_STEP
VideoPlayerStatusTypes.STEP_PAUSED
VideoPlayerStatusTypes.PLAYING_TO_END
VideoPlayerStatusTypes.PAUSED_TO_END
For all other status
property values, invoking this method has no effect.
If this method begins playback, the player will dispatch the VideoStatusEvent.STATUS_CHANGE
event.
See also
playToEnd | () | method |
public function playToEnd():void
Plays all steps, in sequence, from the current step without stopping.
The specific behavior of this method depends on the value of the status
property.
If the status
property value is one of the following, this method begins playback of the
current step from the current frame, and will stop when playback of the current step is complete:
VideoPlayerStatusTypes.INITIALIZED
VideoPlayerStatusTypes.BEGIN_PLAY
VideoPlayerStatusTypes.STOPPED
VideoPlayerStatusTypes.PLAYING_STEP
VideoPlayerStatusTypes.STEP_PAUSED
VideoPlayerStatusTypes.PLAYING_TO_END
VideoPlayerStatusTypes.PAUSED_TO_END
For all other status
property values, invoking this method has no effect.
If this method begins playback, the player will dispatch the VideoStatusEvent.STATUS_CHANGE
event. As the playhead advances from step to step, additional status change events will be dispatched.
See also
removeCompleteRemainingCriteria | () | method |
override protected function removeCompleteRemainingCriteria():void
Removes known completion criteria from the CompleteRemaining
storyboard persisted property.
This method is invoked by the checkForComplete()
method if the value of the storyboard
property is not null
, and the complete
event has not been dispatched since the storyboard
was loaded.
In addition to the substrings processed by the BasePlayer, the SWFVideoPlayer will remove the following substrings from the completeRemaining
persisted property:
Substring | Meaning |
---|---|
allStepsShown; | All steps have been displayed. |
See also
renderContent | () | method |
override protected function renderContent():void
Renders the content onto the surface.
To render content, the SWFVideoPlayer performs the following actions:
Note that the reference to the player is not injected into the animation until
the loader responsible for loading the animation dispatches the Event.INIT
event.
resetStoryboard | () | method |
public static function resetStoryboard(sb:Storyboard):void
Removes all properties set by the player.
Note that this method also removes interim completion properties used by the player, but not necessarily set by the player.
Parameters
sb:Storyboard — The storyboard to remove properties from.
This method removes the following properties from a storyboard:
This method removes the following properties from each ChildElement in the storyboard's
|
setStoryboardState | () | method |
public static function setStoryboardState(sb:Storyboard, state:String):void
Modifies the storyboard to match the described state passed.
If the value of state
is "c
" (indicating a completed
storyboard), interim completion criteria will be marked as complete in addition to the overall
storyboard state.
State values created using a function other than getStoryboardState
may not work.
Parameters
sb:Storyboard — The Storyboard object to modify.
| |
state:String — A String created using the getStoryboardState() method containing the state to restore.
|
unloadStoryboard | () | method |
override protected function unloadStoryboard():void
Performs cleanup actions when a storyboard is unloaded.
This method is invoked by the storyboard
property set method when the current value of the property
is not null
and the unload
event has not been cancelled.
When unloading a storyboard, the SWFVideoPlayer performs the following actions:
See also
videoEnterFrame | Event |
impression.events.VideoFrameEvent
impression.events.VideoFrameEvent.ENTER_FRAME
Dispatched when the ENTER_FRAME event of the current step clip is dispatched.
The VideoFrameEvent.ENTER_FRAME constant defines the value of the type property of a frame event object. This event has the following properties:Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
currentStep | The current step displayed by the player. |
totalSteps | The total number of steps in the video. |
currentStepClip | The MovieClip object that is the current step clip. |
currentFrame | The value of the currentFrame property of the current step clip. |
totalFrames | The value of the totalFrames property of the current step clip. |
videoStatusChange | Event |
impression.events.VideoStatusEvent
impression.events.VideoStatusEvent.STATUS_CHANGE
Dispatched when the status of the animation changes.
The VideoStatusEvent.STATUS_CHANGE constant defines the value of the type property of a status change event object. This event has the following properties:Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
previousStep | The previous step displayed by the player. |
currentStep | The current step displayed by the player. |
totalSteps | The total number of steps in the video. |
status | The status of the player. |
AT_END | Constant |
public static const AT_END:String = atEnd
The playStep()
method should stop playback on the last frame of the current step.
AT_START | Constant |
public static const AT_START:String = atStart
The playStep()
method should stop playback on the first frame of the next step.
STEPPED_AUTOPLAY_FIRST_STEP | Constant |
public static const STEPPED_AUTOPLAY_FIRST_STEP:String = firstStep
A storyboard containing a stepped animation that is marked as autoplay should only play the first step of the animation when first loaded.
STEPPED_AUTOPLAY_PLAY_TO_END | Constant |
public static const STEPPED_AUTOPLAY_PLAY_TO_END:String = playToEnd
A storyboard containing a stepped animation that is marked as autoplay should only all steps of the animation when first loaded.