mx.controls
Class MediaPlayback


All Implemented Interfaces
           mx.controls.streamingmedia.ICuePointHolder

class MediaPlayback
extends mx.core.View

The MediaPlayback control is a combination of the MediaController and MediaDisplay controls. It provides methods to stream media content, and an interface that lets users control playback.

MXML Syntax

The <mx:MediaPlayback> tag inherits all the properties of its parent classes, and the following properties:

 <MediaPlayback
aspectRatio = "true|false"
autoPlay = "true|false"
autoSize = "false|true"
contentPath = "No default.
controllerPolicy = "auto|on|off"
controlPlacement = "bottom|top|left|right"
cuePoints = "No default."
fps = "30"
volume = "75"
change = "Event handler. No default."
click = "Event handler. No default."
complete = "Event handler. No default."
cuePoint = "Event handler. No default."
playheadChange = "Event handler. No default."
progress = "Event handler. No default."
volumeChange = "Event handler. No default."
/>



Constructors
MediaPlayback ()
Constructor


Methods
      addCuePoint(aName:String, aTime:Number) : Void
Adds a new cue point to the display instance.
      displayFull() : Void
Displays the player in full screen mode.
      displayNormal() : Void
Displays the player in normal mode, as opposed to full screen mode.
      draw() : Void
Updates the display and sizes the video object.
      getCuePoint(pointName:String) : CuePoint
Gets a cue point name.
      getCuePoints() : Array
Gets the Array of CuePoint objects that includes all the cue points associated with this object.
      handleEvent(ev) : Void
Handles all the events broadcast by the MediaDisplay and MediaController controls.
      hasPreferredHeight() : Boolean
Determines if the display has the preferred height.
      hasPreferredWidth() : Boolean
Determines if the display has the preferred width.
      init() : Void
Initializes the player.
      load() : Void
Loads the media without playing it.
      measure() : Void
Measures the display and sets the preferred sizes.
      pause() : Void
Stops playback of the media without moving the playhead.
      play(startingPoint:Number) : Void
Plays the media beginning at the specified starting point.
      removeAllCuePoints() : Void
Remove all the cue points.
      removeCuePoint(aCuePoint:CuePoint) : Void
Removes a cue point.
      setCuePoints(cp:Array) : Void
Creates and populates an array of CuePoint objects.
      setMedia(aUrl:String, aType:String) : Void
Sets the content path and the media type together.
      stop() : Void
Stops playback of the media and resets the playhead to zero.
      toString() : String
Creates the string representation of this object.

Methods inherited from class mx.core.View
init  draw  createChild  getChildAt  getChildIndex  setChildIndex  destroyAllChildren  destroyChild  destroyChildAt  getViewMetrics 

Methods inherited from class mx.core.UIComponent
getFocus  setFocus  getFocusManager 

Methods inherited from class mx.core.UIObject
createAccessibilityImplementation  measure  doLater  cancelAllDoLaters  invalidate  invalidateStyle  invalidateProperties  invalidateSize  redraw  move  setSize  setSizeNoLayout  drawRect  fillRect  destroyLabel  createClassObject  createEmptyObject  destroyObject  getStyle  setMask  swapDepths 


Properties
staticversion:String  
MediaComponentVersion is for internal use only.
      fps:Number  
The frames per second is used only for video, and only in the configuration user interface.
      autoSize:Boolean   [Read-Write]
If true, the display sizes itself according to the preferred size of the media.
      aspectRatio:Boolean   [Read-Write]
Whether a MediaDisplay or MediaPlayback instance maintains the aspect ratio.
      autoPlay:Boolean   [Read-Write]
Whether the media immediately begins to buffer and play.
      playheadTime:Number   [Read-Write]
Playhead position, measured in seconds since beginning playing.
      contentPath:String   [Read-Write]
Relative path and filename of the media to stream.
      volume:Number   [Read-Write]
Volume setting, from 0 to 100.
      playing:Boolean   [Read-Only]
Whether the media is currently playing.
      preferredWidth:Number   [Read-Only]
Preferred width of the display.
      preferredHeight:Number   [Read-Only]
Preferred height of the display.
      bytesLoaded:Number   [Read-Only]
Number of bytes already loaded.
      bytesTotal:Number   [Read-Only]
Total number of bytes to load.
      mediaType:String   [Read-Write]
Type of media to play, either Flash video (FLV), or MP3 file (MP3).
      totalTime:Number   [Read-Write]
Total length of the media in seconds.
      cuePoints:Array   [Read-Write]
Array of CuePoint objects that includes all the cue points associated with this object.
      mostRecentCuePoint:CuePoint   [Read-Only]
Read-only property that contains the most recently fired cue point.
      mostRecentCuePointName:String   [Read-Only]
Read-only property that contains the name of the most recently fired cue point.
      mostRecentCuePointTime:Number   [Read-Only]
Read-only property that contains the time, in seconds, within the playback media when the most recent cue point fired.
      controllerPolicy:String   [Read-Write]
Indicates how the controller behaves upon mouse interaction.
      controlPlacement:String   [Read-Write]
Position of the controls relative to the display component.

Properties inherited from class mx.core.View
version  className  numChildren 

Properties inherited from class mx.core.UIComponent
version  enabled  tabIndex 

Properties inherited from class mx.core.UIObject
version  nestLevel  dispatchEvent  addEventListener  handleEvent  removeEventListener  kStretch  styleName  className  setStyle  parentApplication  isDocument  parentDocument  documentDescriptor  descriptor  instanceIndices  repeaterIndices  getRepeaterItem  id  width  height  x  y  minHeight  minWidth  preferredHeight  preferredWidth  maxHeight  maxWidth  widthFlex  heightFlex  visible  scaleX  scaleY  alpha  depth  mouseX  mouseY  toolTip  baselinePosition 


Effects

Effects inherited from class mx.core.UIComponent
showEffect  hideEffect  focusInEffect  focusOutEffect 

Effects inherited from class mx.core.UIObject
creationCompleteEffect  moveEffect  resizeEffect  mouseDownEffect  mouseOverEffect  mouseOutEffect  mouseUpEffect 


Events
changeBroadcasts continuously while media is playing. Target contains a reference to the component that triggered the event. Type contains the name of the event.
progressBroadcasts continuously while media is playing. Target contains a reference to the component that triggered the event. Type contains the name of the event.
cuePointBroadcasts when the value of a cue point`s time property is equal to that of the playhead location of the MediaPlayback or MediaDisplay control with which it is associated. The event object contains the properties:
--cuePointName, which is a string that contains the name of the cuePoint.
- cuePointTime, which is an integer that contains the frame number or playing duration in seconds.
Target contains a reference to the component that triggered the event. Type contains the name of the event.
completeBroadcasts when the playhead has reached the end of the media. Target contains a reference to the component that triggered the event. Type contains the name of the event.
startBroadcast when enough media has been buffered to begin playing. Target contains a reference to the component that triggered the event. Type contains the name of the event.
clickBroadcasts when the user clicks the Play/Pause button. The event object contains the property detail, which contains the string pause or play. Target contains a reference to the component that triggered the event. Type contains the name of the event.
playheadChangeBroadcasts when a user moves the playback slider or clicks the Go to Beginning or Go to End button. The event object contains the following property detail, which contains a number with the percent completed.
Target contains a reference to the component that triggered the event. Type contains the name of the event.
volumeChangeBroadcasts when the user adjusts the volume. In MXML, use volumeChange as the property name. In ActionScript, use volume. The event object contains the following property detail, which contains an integer between 0 (minimum) and 100 (maximum) to indicate volume. Target contains a reference to the component that triggered the event. Type contains the name of the event.

Events inherited from class: mx.core.View
childCreated  childIndexChanged  childDestroyed 

Events inherited from class: mx.core.UIComponent
focusIn  focusOut  keyDown  keyUp  show  hide  valid  invalid  valueCommitted 

Events inherited from class: mx.core.UIObject
initialize  creationComplete  resize  move  draw  load  unload  mouseDown  mouseUp  mouseMove  mouseOver  mouseOut  mouseDownSomewhere  mouseUpSomewhere  mouseMoveSomewhere  mouseChangeSomewhere  effectStart  effectEnd  dragBegin  dragComplete  dragEnter  dragOver  dragExit  dragDrop 


Styles

Styles inherited from class mx.core.UIComponent
backgroundColor  backgroundDisabledColor  backgroundImage  backgroundAlpha  backgroundSize  barColor  borderCapColor  borderColor  buttonColor  borderStyle  disabledColor  errorColor  highlightColor  lineHeight  modalTransparency  scrollTrackColor  shadowColor  shadowCapColor  symbolColor  symbolBackgroundColor  symbolBackgroundDisabledColor  symbolBackgroundPressedColor  symbolDisabledColor  themeColor 

Styles inherited from class mx.core.UIObject
color  fontFamily  fontSize  fontStyle  fontWeight  textAlign  textDecoration  textIndent  marginLeft  marginRight  horizontalGap  verticalGap 


Constructor Detail

MediaPlayback

MediaPlayback()

Constructor


Method Detail

addCuePoint

addCuePoint(aName:String, aTime:Number) : Void

Adds a new cue point to the display instance.

Parameters
     aName - Name of the cue point.
     aTime - Time in the media where to add the cue point.


displayFull

displayFull() : Void

Displays the player in full screen mode. This makes the player occupy the entire Flash stage, however, it does not change the size of the Flash stage.


displayNormal

displayNormal() : Void

Displays the player in normal mode, as opposed to full screen mode. The original size and position of the player are retained when it toggles between full screen and normal mode.


draw

draw() : Void

Updates the display and sizes the video object.
NOTE: This has no effect on MP3 media.


getCuePoint

getCuePoint(pointName:String) : CuePoint

Gets a cue point name.

Parameters
     pointName - The name of the cue point to find.

Returns
     CuePoint associated with this object that has the given name.


getCuePoints

getCuePoints() : Array

Gets the Array of CuePoint objects that includes all the cue points associated with this object.

Returns
     Array of CuePoint objects.


handleEvent

handleEvent(ev) : Void

Handles all the events broadcast by the MediaDisplay and MediaController controls. Rebroadcasts them. Special attention is paid to a start event from the MediaDisplay control, which listens to determine when playback of the media starts. It resizes the video at that time.

Parameters
     ev - Event.


hasPreferredHeight

hasPreferredHeight() : Boolean

Determines if the display has the preferred height.


hasPreferredWidth

hasPreferredWidth() : Boolean

Determines if the display has the preferred width.


init

init() : Void

Initializes the player.


load

load() : Void

Loads the media without playing it.


measure

measure() : Void

Measures the display and sets the preferred sizes. This is only applicable to video. If the width or height attributes are set, it uses those. Otherwise, it uses the video`s true width and height.


pause

pause() : Void

Stops playback of the media without moving the playhead.


play

play(startingPoint:Number) : Void

Plays the media beginning at the specified starting point. If the media hasn`t been loaded, it loads it.

Parameters
     startingPoint - The number of seconds into the media where the playback should start. This is an optional parameter. If omitted, playing starts at the current playhead position.


removeAllCuePoints

removeAllCuePoints() : Void

Remove all the cue points.


removeCuePoint

removeCuePoint(aCuePoint:CuePoint) : Void

Removes a cue point.

Parameters
     aCuePoint - Cue point to remove.


setCuePoints

setCuePoints(cp:Array) : Void

Creates and populates an array of CuePoint objects.

Parameters
     cp - Array of CuePoint objects.


setMedia

setMedia(aUrl:String, aType:String) : Void

Sets the content path and the media type together.

Parameters
     aUrl -
     aType - Media type.


stop

stop() : Void

Stops playback of the media and resets the playhead to zero.


toString

toString() : String

Creates the string representation of this object.


Property Detail

aspectRatio

aspectRatio:Boolean   [Read-Write]

Whether a MediaDisplay or MediaPlayback instance maintains the aspect ratio.


autoPlay

autoPlay:Boolean   [Read-Write]

Whether the media immediately begins to buffer and play. This is strictly an initialization parameter.


autoSize

autoSize:Boolean   [Read-Write]

If true, the display sizes itself according to the preferred size of the media. The default is true.


bytesLoaded

bytesLoaded:Number   [Read-Only]

Number of bytes already loaded.


bytesTotal

bytesTotal:Number   [Read-Only]

Total number of bytes to load.


contentPath

contentPath:String   [Read-Write]

Relative path and filename of the media to stream.


controllerPolicy

controllerPolicy:String   [Read-Write]

Indicates how the controller behaves upon mouse interaction. Possible settings are on, off, and auto. :
on: The controller is always expanded.
off: The controller is always contracted and can only be expanded programmatically.
auto: The controller is initially contracted. It expands when the user rolls the mouse over, then contracts when the user rolls the mouse off.


controlPlacement

controlPlacement:String   [Read-Write]

Position of the controls relative to the display component.


cuePoints

cuePoints:Array   [Read-Write]

Array of CuePoint objects that includes all the cue points associated with this object.


fps

fps:Number  

The frames per second is used only for video, and only in the configuration user interface. The configuration user interface uses it to calculate milliseconds based on frame number. The default value is 30.


mediaType

mediaType:String   [Read-Write]

Type of media to play, either Flash video (FLV), or MP3 file (MP3).


mostRecentCuePoint

mostRecentCuePoint:CuePoint   [Read-Only]

Read-only property that contains the most recently fired cue point. This is unbindable because binding cannot handle structures.


mostRecentCuePointName

mostRecentCuePointName:String   [Read-Only]

Read-only property that contains the name of the most recently fired cue point.


mostRecentCuePointTime

mostRecentCuePointTime:Number   [Read-Only]

Read-only property that contains the time, in seconds, within the playback media when the most recent cue point fired.


playheadTime

playheadTime:Number   [Read-Write]

Playhead position, measured in seconds since beginning playing.


playing

playing:Boolean   [Read-Only]

Whether the media is currently playing.


preferredHeight

preferredHeight:Number   [Read-Only]

Preferred height of the display.


preferredWidth

preferredWidth:Number   [Read-Only]

Preferred width of the display.


totalTime

totalTime:Number   [Read-Write]

Total length of the media in seconds. For MP3 files, this is a property of the Sound object. For video, it is a property that is manually set by the author.


version

static version:String  

MediaComponentVersion is for internal use only.


volume

volume:Number   [Read-Write]

Volume setting, from 0 to 100.