Packagecom.brightcove.api.modules
Classpublic class ContentModule
InheritanceContentModule Inheritance APIModule Inheritance flash.events.EventDispatcher

API class for handling content retrieval.



Public Properties
 PropertyDefined By
 Inheritedmodule : Object
[read-only] Returns the instance of the module that is wrapped by this instance.
APIModule
Public Methods
 MethodDefined By
  
ContentModule(module:Object)
Constructor.
ContentModule
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = true):void
[override] Adds a listener for an event.
APIModule
  
appendArgsToMediaRequest(argumentString:String):void
Appends the valid values from the query string to any media request from the player.
ContentModule
  
createRuntimeMediaCollection(collection:Object, type:String):MediaCollectionDTO
Creates a media collection from the data passed in the custom object.
ContentModule
  
getAllMediaCollectionIDs(collectionType:String):Array
Returns an array of ids for the media collections currently in the player.
ContentModule
  
getAllMediaCollections(collectionType:String):Array
Returns an array of media collections currently in the player.
ContentModule
  
getMedia(mediaId:Object, property:String):MediaDTO
Returns the media DTO for the ID or referenceID passed in if it is currently loaded in the player.
ContentModule
  
getMediaAsynch(mediaId:Object, property:String):void
Fetches the media DTO from the server whose value for the specified property that matches the specified value.
ContentModule
  
getMediaCollection(id:Object, property:String, page:uint = 0, recordsPerPage:uint = 50):MediaCollectionDTO
Returns the MediaCollectionDTO whose value for the specified property matches the specified value.
ContentModule
  
getMediaCollectionAsynch(id:Object, property:String, page:uint = 0, recordsPerPage:uint = 50):void
Fetches from the server the MediaCollectionDTO whose value for the specified property matches the specified value.
ContentModule
  
getMediaInGroupAsynch(ids:Array, property:String = id):void
Fetches multiple MediaDTOs from server, returning them in an array.
ContentModule
  
getProgrammingForTarget(target:String):Object
Returns the programmed content for a specific content target in the player.
ContentModule
  
Deletes all content from memory in the player.
ContentModule
  
purgeMedia(... ids):Boolean
Removes the specified media from memory in the player.
ContentModule
  
purgeMediaCollections(... ids):Boolean
Removes the specified media collections from memory in the player.
ContentModule
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
[override] Removes a listener for an event.
APIModule
  
updateMedia(media:Object):MediaDTO
Updates properties on an existing media object.
ContentModule
Events
 Event Summary Defined By
  Dispatched when media is loaded through a call to getMediaCollectionAsynch().ContentModule
  Dispatched when media is loaded through a call to getMediaAsynch().ContentModule
Public Constants
 ConstantDefined By
  AUDIO_TRACK_PLAYLIST : String = audioTrackPlaylist
[static] Value that filters the type returned by the getAllMediaCollections() or getAllMediaCollectionIDs method to only include audio track playlists when passed as the collectionType property.
ContentModule
  ID : String = id
[static] Value that retrieves media or media collections by ID when passed as the property parameter of the getMedia(), getMediaAsync(), getMediaCollection() or getMediaCollectionAsync() method.
ContentModule
  PLAYLIST : String = playlist
[static] Value that filters the type returned by the getAllMediaCollections() or getAllMediaCollectionIDs method to only include video playlists when passed as the collectionType property.
ContentModule
  REFERENCE_ID : String = referenceId
[static] Value that retrieves media or media collections by referenceID when passed as the property parameter of the getMedia(), getMediaAsync(), getMediaCollection() or getMediaCollectionAsync() method.
ContentModule
Constructor Detail
ContentModule()Constructor
public function ContentModule(module:Object)

Constructor.

Parameters
module:Object — module to wrap with this API class.
Method Detail
appendArgsToMediaRequest()method
public function appendArgsToMediaRequest(argumentString:String):void

Appends the valid values from the query string to any media request from the player. The form of the argument should be 'key=value&key=value&key=value'. Invalid keys include playerId, pubId, videoId, lineUpId, affiliateId.

Parameters

argumentString:String — The arguments to append.

createRuntimeMediaCollection()method 
public function createRuntimeMediaCollection(collection:Object, type:String):MediaCollectionDTO

Creates a media collection from the data passed in the custom object. The following properties can be set in the collection: mediaIds, displayName, shortDescription, longDescription, thumbnailURL

Parameters

collection:Object — object containing the values to populate in the new media collection.
 
type:String — type of media collection to create.

Returns
MediaCollectionDTO — The new MediaCollectionDTO stored player side.
getAllMediaCollectionIDs()method 
public function getAllMediaCollectionIDs(collectionType:String):Array

Returns an array of ids for the media collections currently in the player.

Parameters

collectionType:String — The ID collection type to return ("playlist" or "audioTrackPlaylist"). Not setting this parameter will return all media collection IDs in the player.

Returns
Array — An array of media collection ids.
getAllMediaCollections()method 
public function getAllMediaCollections(collectionType:String):Array

Returns an array of media collections currently in the player.

Parameters

collectionType:String — The media collection type to return ("playlist" or "audioTrackPlaylist"). Not setting this parameter will return all media collections in the player.

Returns
Array — An array of MediaCollectionDTOs.
getMedia()method 
public function getMedia(mediaId:Object, property:String):MediaDTO

Returns the media DTO for the ID or referenceID passed in if it is currently loaded in the player.

Parameters

mediaId:Object — ID (Number) or referenceID (String) for the media to retrieve.
 
property:String — property of the media DTO in which to check for the specified ID ("id" or "referenceId").

Returns
MediaDTO
getMediaAsynch()method 
public function getMediaAsynch(mediaId:Object, property:String):void

Fetches the media DTO from the server whose value for the specified property that matches the specified value. Since this happens asynchronously, add a listener for the ContentEvent.MEDIA_LOAD event to know when this has completed.

Parameters

mediaId:Object — ID (Number) or referenceID (String) for the media to retrieve.
 
property:String — property of the media DTO in which to check for the specified ID ("id" or "referenceId").

getMediaCollection()method 
public function getMediaCollection(id:Object, property:String, page:uint = 0, recordsPerPage:uint = 50):MediaCollectionDTO

Returns the MediaCollectionDTO whose value for the specified property matches the specified value.

Parameters

id:Object — ID (Number) or referenceID (String) for the media to retrieve.
 
property:String — property of the media collections in which to check for the specified ID ("id" or "referenceId").
 
page:uint (default = 0) — page to fetch in the array of media records. (Deprecated. See Media API docs for full paging support.)
 
recordsPerPage:uint (default = 50) — number of records that should be fetched per page. The maximum and default number is 50. (Deprecated. See Media API docs for full paging support.)

Returns
MediaCollectionDTO — The MediaCollectionDTO that matches the search requirements.
getMediaCollectionAsynch()method 
public function getMediaCollectionAsynch(id:Object, property:String, page:uint = 0, recordsPerPage:uint = 50):void

Fetches from the server the MediaCollectionDTO whose value for the specified property matches the specified value. Since this happens asynchronously, add a listener for the ContentEvent.MEDIA_COLLECTION_LOAD event to know when this has completed. Download code examples for this method from the article, Dynamically Loading Media into Players for ActionScript and JavaScript.

Parameters

id:Object — ID (Number) or referenceID (String) for the media to retrieve.
 
property:String — property of the media collections in which to check for the specified ID ("id" or "referenceId").
 
page:uint (default = 0) — page to fetch in the array of media records. (Deprecated. See Media API docs for full paging support.)
 
recordsPerPage:uint (default = 50) — number of records that should be fetched per page. The maximum and default number is 50. (Deprecated. See Media API docs for full paging support.)

getMediaInGroupAsynch()method 
public function getMediaInGroupAsynch(ids:Array, property:String = id):void

Fetches multiple MediaDTOs from server, returning them in an array. Since this happens asynchronously, add a listener for the ContentEvent.MEDIA_COLLECTION_LOAD event to know when this has completed. List must be completely ids or referenceIds, not a mixture of both. Download code examples for this method from the article, Dynamically Loading Media into Players for ActionScript and JavaScript.

Parameters

ids:Array — IDs of the media to retrieve and place in an array.
 
property:String (default = id) — "id" (default) or "referenceId". Determines how the media is searched for.

getProgrammingForTarget()method 
public function getProgrammingForTarget(target:String):Object

Returns the programmed content for a specific content target in the player.

Parameters

target:String — target key by which the content is stored.

Returns
Object — The content stored by the specified target key.
purgeAllContent()method 
public function purgeAllContent():void

Deletes all content from memory in the player.

purgeMedia()method 
public function purgeMedia(... ids):Boolean

Removes the specified media from memory in the player.

Parameters

... ids — ID(s) of the media to be removed.

Returns
Boolean — Whether the media existed and was successfully removed.
purgeMediaCollections()method 
public function purgeMediaCollections(... ids):Boolean

Removes the specified media collections from memory in the player.

Parameters

... ids — ID(s) of the media collections to be removed.

Returns
Boolean — Whether the media collections existed and were successfully removed.
updateMedia()method 
public function updateMedia(media:Object):MediaDTO

Updates properties on an existing media object. The media id in the given object must match existing media that has been loaded. Media changes will not show up if the media is playing, but it will show up the next time the media is played. The best time to make updates is right after it has been loaded. At this time, only video objects can be updated. The properties that can be changed are a subset of those available on the VideoDTO: FLVFullLengthURL, FLVFullSize, videoStillURL, adKeys, displayName, length, longDescription, shortDescription, thumbnailURL, renditions. Any changes to FLVFullLengthURL, videoStillURL, and thumbnailURL will include the URL's original parameters. For renditions, the existing Array will be overriden. The follow properties can be set on the objects in this Array: defaultURL, encodingRate, frameHeight, frameWidth, size

Parameters

media:Object — The media object to update.

Returns
MediaDTO — The updated MediaDTO object.

See also


Example
The following example shows how this method could be used to change the video URL after the media has been dynamically loaded.
         // event handler used for a getMediaAsync() call  
         private function onMediaLoad(event:ContentEvent):void {
             var media:Object = event.media;
             // Change the video URL to the new location.  If this was a video with renditions,
             // the renditions property would be changed instead.
             media.FLVFullLengthURL = "http://myservername.com/mynewvideo.flv";
             // assumes that the contentModule has been defined elsewhere and calls the API 
             contentModule.updateMedia(media);
         }     
         
Event Detail
mediaCollectionLoad Event
Event Object Type: com.brightcove.api.events.ContentEvent
ContentEvent.type property = com.brightcove.api.events.ContentEvent.MEDIA_COLLECTION_LOAD

Dispatched when media is loaded through a call to getMediaCollectionAsynch(). Download code examples for this event from the article, Dynamically Loading Media into Players for ActionScript and JavaScript.

The ContentEvent.MEDIA_COLLECTION_LOAD constant defines the value of the type property of the event object for a mediaCollectionLoad event.
mediaLoad Event  
Event Object Type: com.brightcove.api.events.ContentEvent
ContentEvent.type property = com.brightcove.api.events.ContentEvent.MEDIA_LOAD

Dispatched when media is loaded through a call to getMediaAsynch().

The ContentEvent.MEDIA_LOAD constant defines the value of the type property of the event object for a mediaLoad event.
Constant Detail
AUDIO_TRACK_PLAYLISTConstant
public static const AUDIO_TRACK_PLAYLIST:String = audioTrackPlaylist

Value that filters the type returned by the getAllMediaCollections() or getAllMediaCollectionIDs method to only include audio track playlists when passed as the collectionType property.

IDConstant 
public static const ID:String = id

Value that retrieves media or media collections by ID when passed as the property parameter of the getMedia(), getMediaAsync(), getMediaCollection() or getMediaCollectionAsync() method.

PLAYLISTConstant 
public static const PLAYLIST:String = playlist

Value that filters the type returned by the getAllMediaCollections() or getAllMediaCollectionIDs method to only include video playlists when passed as the collectionType property.

REFERENCE_IDConstant 
public static const REFERENCE_ID:String = referenceId

Value that retrieves media or media collections by referenceID when passed as the property parameter of the getMedia(), getMediaAsync(), getMediaCollection() or getMediaCollectionAsync() method.