Packagecom.brightcove.api.events
Classpublic class MediaEvent
InheritanceMediaEvent Inheritance flash.events.Event

Events to be broadcast for media loading and playback. MediaEvents specify position and duration properties. For more information on media events and the returned constants and media event behavior, see Player API MediaEvents. Use MediaEvents instead of the deprecated VideoEvents class.



Public Properties
 PropertyDefined By
  code : String
[read-only] Returns the additional string code, if any, sent with the event.
MediaEvent
  data : Object
[read-only] Returns the data, if any, sent with the event.
MediaEvent
  duration : Number
[read-only] Returns the duration of the media in seconds.
MediaEvent
  media : MediaDTO
[read-only] Returns the video associated with the event.
MediaEvent
  position : Number
[read-only] Returns the current position of the media played back in seconds.
MediaEvent
  rendition : RenditionAssetDTO
[read-only] Returns the rendition associated with the event.
MediaEvent
Public Methods
 MethodDefined By
  
MediaEvent(type:String, position:Number = 0, duration:Number = 0, media:MediaDTO = null, rendition:RenditionAssetDTO = null, code:String = null, data:Object = null)
Constructor.
MediaEvent
  
clone():Event
[override] Returns a copy of the event instance.
MediaEvent
Public Constants
 ConstantDefined By
  AUTH_NEEDED : String = authNeeded
[static]
MediaEvent
  BEGIN : String = mediaBegin
[static] The MediaEvent.BEGIN constant defines the value of the type property of the event object for a mediaBegin event.
MediaEvent
  BUFFER_BEGIN : String = mediaBufferBegin
[static] The MediaEvent.BUFFER_BEGIN constant defines the value of the type property of the event object for a mediaBufferBegin event.
MediaEvent
  BUFFER_COMPLETE : String = mediaBufferComplete
[static] The MediaEvent.BUFFER_COMPLETE constant defines the value of the type property of the event object for a mediaBufferComplete event.
MediaEvent
  CHANGE : String = mediaChange
[static] The MediaEvent.CHANGE constant defines the value of the type property of the event object for a mediaChange event.
MediaEvent
  COMPLETE : String = mediaComplete
[static] The MediaEvent.COMPLETE constant defines the value of the type property of the event object for a mediaComplete event.
MediaEvent
  EDGE : String = mediaEdge
[static] The MediaEvent.EDGE constant defines the value of the type property of the event object for a edge event.
MediaEvent
  ERROR : String = mediaError
[static] The MediaEvent.ERROR constant defines the value of the type property of the event object for a mediaError event.
MediaEvent
  MUTE_CHANGE : String = mediaMuteChange
[static] The MediaEvent.MUTE_CHANGE constant defines the value of the type property of the event object for a mediaMuteChange event.
MediaEvent
  PLAY : String = mediaPlay
[static] The MediaEvent.PLAY constant defines the value of the type property of the event object for a mediaPlay event.
MediaEvent
  PROGRESS : String = mediaProgress
[static] The MediaEvent.PROGRESS constant defines the value of the type property of the event object for a mediaProgress event.
MediaEvent
  RENDITION_CHANGE_COMPLETE : String = mediaRenditionChangeComplete
[static] The MediaEvent.RENDITION_CHANGE_COMPLETE constant defines the value of the type property of the event object for a mediaRenditionChangeComplete event.
MediaEvent
  RENDITION_CHANGE_REQUEST : String = mediaRenditionChangeRequest
[static] The MediaEvent.RENDITION_CHANGE_REQUEST constant defines the value of the type property of the event object for a mediaRenditionChangeRequest event.
MediaEvent
  SEEK : String = mediaSeek
[static] The MediaEvent.SEEK constant defines the value of the type property of the event object for a seek event.
MediaEvent
  SEEK_NOTIFY : String = mediaSeekNotify
[static] The MediaEvent.SEEK_NOTIFY constant defines the value of the type property of the event object for a seek event.
MediaEvent
  STOP : String = mediaStop
[static] The MediaEvent.STOP constant defines the value of the type property of the event object for a mediaStop event.
MediaEvent
  VOLUME_CHANGE : String = mediaVolumeChange
[static] The MediaEvent.VOLUME_CHANGE constant defines the value of the type property of the event object for a mediaVolumeChange event.
MediaEvent
Property Detail
codeproperty
code:String  [read-only]

Returns the additional string code, if any, sent with the event. This is low-level stream error details, the code property returned in NetStatusEvent.info.


Implementation
    public function get code():String
dataproperty 
data:Object  [read-only]

Returns the data, if any, sent with the event. This includes onEdge event data including a timeSpan property for usage with Akamai HD DVR functionality.


Implementation
    public function get data():Object
durationproperty 
duration:Number  [read-only]

Returns the duration of the media in seconds. Note that for the MediaEvent.CHANGE event, the duration is reported in milliseconds. This is an unfortunate discrepancy, but to support backwards compatibility for custom players that expect this erroneous behavior this will remain the case. To convert this milliseconds value to seconds, simply divide the value by 1000. For all other MediaEvent types the duration is correctly represented in seconds.


Implementation
    public function get duration():Number
mediaproperty 
media:MediaDTO  [read-only]

Returns the video associated with the event.


Implementation
    public function get media():MediaDTO
positionproperty 
position:Number  [read-only]

Returns the current position of the media played back in seconds.


Implementation
    public function get position():Number
renditionproperty 
rendition:RenditionAssetDTO  [read-only]

Returns the rendition associated with the event.


Implementation
    public function get rendition():RenditionAssetDTO
Constructor Detail
MediaEvent()Constructor
public function MediaEvent(type:String, position:Number = 0, duration:Number = 0, media:MediaDTO = null, rendition:RenditionAssetDTO = null, code:String = null, data:Object = null)

Constructor.

Parameters
type:String — event name.
 
position:Number (default = 0) — position of the media, in seconds.
 
duration:Number (default = 0) — duration of the media, in seconds.
 
media:MediaDTO (default = null) — media associated with the event.
 
rendition:RenditionAssetDTO (default = null) — additional string code that should travel with the event.
 
code:String (default = null)
 
data:Object (default = null)
Method Detail
clone()method
override public function clone():Event

Returns a copy of the event instance.

Returns
Event — A copy of the event.
Constant Detail
AUTH_NEEDEDConstant
public static const AUTH_NEEDED:String = authNeeded

BEGINConstant 
public static const BEGIN:String = mediaBegin

The MediaEvent.BEGIN constant defines the value of the type property of the event object for a mediaBegin event. BEGIN events are dispatched when media playback first begins. This will only occur on initial playback, not on replay.

BUFFER_BEGINConstant 
public static const BUFFER_BEGIN:String = mediaBufferBegin

The MediaEvent.BUFFER_BEGIN constant defines the value of the type property of the event object for a mediaBufferBegin event. BUFFER_BEGIN events are dispatched when a buffering window begins for the current media, pausing playback.

BUFFER_COMPLETEConstant 
public static const BUFFER_COMPLETE:String = mediaBufferComplete

The MediaEvent.BUFFER_COMPLETE constant defines the value of the type property of the event object for a mediaBufferComplete event. BUFFER_COMPLETE is dispatched when media finishes a buffering window.

CHANGEConstant 
public static const CHANGE:String = mediaChange

The MediaEvent.CHANGE constant defines the value of the type property of the event object for a mediaChange event. CHANGE is dispatched when new media has been loaded or cued in the player.

COMPLETEConstant 
public static const COMPLETE:String = mediaComplete

The MediaEvent.COMPLETE constant defines the value of the type property of the event object for a mediaComplete event. COMPLETE events are dispatched when the current media finishes. This only occurs on initial playback of media, not on replay.

EDGEConstant 
public static const EDGE:String = mediaEdge

The MediaEvent.EDGE constant defines the value of the type property of the event object for a edge event. EDGE events are dispatched when there is an onEdge event dispatched by the NetStream object.

ERRORConstant 
public static const ERROR:String = mediaError

The MediaEvent.ERROR constant defines the value of the type property of the event object for a mediaError event. ERROR is dispatched when there is a problem connecting to or playing the current media.

MUTE_CHANGEConstant 
public static const MUTE_CHANGE:String = mediaMuteChange

The MediaEvent.MUTE_CHANGE constant defines the value of the type property of the event object for a mediaMuteChange event. MUTE_CHANGE is dispatched when media's audio is muted or unmuted.

PLAYConstant 
public static const PLAY:String = mediaPlay

The MediaEvent.PLAY constant defines the value of the type property of the event object for a mediaPlay event. PLAY is dispatched when media begins or resumes playback.

PROGRESSConstant 
public static const PROGRESS:String = mediaProgress

The MediaEvent.PROGRESS constant defines the value of the type property of the event object for a mediaProgress event. PROGRESS is dispatched periodically while media is being played back.

RENDITION_CHANGE_COMPLETEConstant 
public static const RENDITION_CHANGE_COMPLETE:String = mediaRenditionChangeComplete

The MediaEvent.RENDITION_CHANGE_COMPLETE constant defines the value of the type property of the event object for a mediaRenditionChangeComplete event. RENDITION_CHANGE_COMPLETE is dispatched when the transition to a new rendition is completed.

RENDITION_CHANGE_REQUESTConstant 
public static const RENDITION_CHANGE_REQUEST:String = mediaRenditionChangeRequest

The MediaEvent.RENDITION_CHANGE_REQUEST constant defines the value of the type property of the event object for a mediaRenditionChangeRequest event. RENDITION_CHANGE_REQUEST is dispatched when a new rendition of the current media is requested.

SEEKConstant 
public static const SEEK:String = mediaSeek

The MediaEvent.SEEK constant defines the value of the type property of the event object for a seek event. SEEK is dispatched when media is requested to be sent to a new position.

SEEK_NOTIFYConstant 
public static const SEEK_NOTIFY:String = mediaSeekNotify

The MediaEvent.SEEK_NOTIFY constant defines the value of the type property of the event object for a seek event. SEEK_NOTIFY events are dispatched when media has completed being sent to a new position.

STOPConstant 
public static const STOP:String = mediaStop

The MediaEvent.STOP constant defines the value of the type property of the event object for a mediaStop event. STOP events are dispatched when media is paused or stopped.

VOLUME_CHANGEConstant 
public static const VOLUME_CHANGE:String = mediaVolumeChange

The MediaEvent.VOLUME_CHANGE constant defines the value of the type property of the event object for a mediaVolumeChange event. VOLUME_CHANGE is dispatched when the volume in the player is changed.