Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
org.osmf.traits 
ContentProtectableTrait 
Packageorg.osmf.traits
Classpublic class ContentProtectableTrait
InheritanceContentProtectableTrait Inheritance MediaTraitBase
Implements IContentProtectable

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

The ContentProtectableTrait class provides a base IContentProtectable implementation. It can be used as the base class for a more specific ContentProtectableTrait subclass or as is by a media element that listens for and handles its change events.



Public Properties
 PropertyDefined By
  authenticationMethod : String
[read-only] The required method of authentication.
ContentProtectableTrait
  endDate : Date
[read-only] Returns the end date for the playback window.
ContentProtectableTrait
  period : Number
[read-only] Returns the length of the playback window, in seconds.
ContentProtectableTrait
  startDate : Date
[read-only] Returns the start date for the playback window.
ContentProtectableTrait
Public Methods
 MethodDefined By
  
Constructor.
ContentProtectableTrait
  
authenticate(username:String, password:String):void
Authenticates the media.
ContentProtectableTrait
  
Authenticates the media using an object which serves as a token.
ContentProtectableTrait
  
processAuthenticateCompletion(success:Boolean, token:Object, error:MediaError):void
Must be called by the implementing media on completing authentication.
ContentProtectableTrait
Protected Methods
 MethodDefined By
  
Called before the processAuthenticate method is called.
ContentProtectableTrait
  
Called before the processAuthenticateWithToken method is called.
ContentProtectableTrait
  
Called immediately before the authenticationState property is changed in response to a call to authenticate.
ContentProtectableTrait
  
Called immediately before the authenticationState property is changed in response to a call to authenticateWithToken.
ContentProtectableTrait
Events
 Event Summary Defined By
  Dispatched when an authentication attempt succeeds.ContentProtectableTrait
  Dispatches when an authentication attempt fails.ContentProtectableTrait
  Dispatched when either anonymous or credential-based authentication is needed in order to playback the media.ContentProtectableTrait
Property Detail

authenticationMethod

property
authenticationMethod:String  [read-only]

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

The required method of authentication. Possible values are "anonymous" and "usernameAndPassword".



Implementation
    public function get authenticationMethod():String

endDate

property 
endDate:Date  [read-only]

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Returns the end date for the playback window. Returns null if authentication hasn't taken place.



Implementation
    public function get endDate():Date

period

property 
period:Number  [read-only]

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Returns the length of the playback window, in seconds. Returns NaN if authentication hasn't taken place. Note that this property will generally be the difference between startDate and endDate, but is included as a property because there may be times where the duration is known up front, but the start or end dates are not (e.g. a one week rental).



Implementation
    public function get period():Number

startDate

property 
startDate:Date  [read-only]

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Returns the start date for the playback window. Returns null if authentication hasn't taken place.



Implementation
    public function get startDate():Date
Constructor Detail

ContentProtectableTrait

()Constructor
public function ContentProtectableTrait()

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Constructor.

Method Detail

authenticate

()method
public function authenticate(username:String, password:String):void

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Authenticates the media. Can be used for both anonymous and credential-based authentication. If the media has already been authenticated, this is a no-op.

Parameters

username:String — The username. Should be null for anonymous authentication.
 
password:String — The password. Should be null for anonymous authentication.

authenticateWithToken

()method 
public function authenticateWithToken(token:Object):void

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Authenticates the media using an object which serves as a token. Can be used for both anonymous and credential-based authentication. If the media has already been authenticated, this is a no-op.

Parameters

token:Object — The token to use for authentication.

canProcessAuthenticate

()method 
protected function canProcessAuthenticate():Boolean

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Called before the processAuthenticate method is called.

Returns
Boolean — Returns true by default. Subclasses that override this method can return false to abort processing.

canProcessAuthenticateWithToken

()method 
protected function canProcessAuthenticateWithToken():Boolean

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Called before the processAuthenticateWithToken method is called.

Returns
Boolean — Returns true by default. Subclasses that override this method can return false to abort processing.

processAuthenticate

()method 
protected function processAuthenticate(username:String, password:String):void

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Called immediately before the authenticationState property is changed in response to a call to authenticate.

Subclasses implement this method to communicate the change to the media.

Parameters

username:String — The username for the authentication request.
 
password:String — The password for the authentication request.

processAuthenticateCompletion

()method 
public final function processAuthenticateCompletion(success:Boolean, token:Object, error:MediaError):void

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Must be called by the implementing media on completing authentication. Dispatches the change event.

Parameters

success:Boolean
 
token:Object
 
error:MediaError

processAuthenticateWithToken

()method 
protected function processAuthenticateWithToken(token:Object):void

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Called immediately before the authenticationState property is changed in response to a call to authenticateWithToken.

Subclasses implement this method to communicate the change to the media.

Parameters

token:Object — The username for the authentication request.

Event Detail

authenticationComplete

Event
Event Object Type: org.osmf.events.ContentProtectionEvent
property ContentProtectionEvent.type = org.osmf.events.ContentProtectionEvent.AUTHENTICATION_COMPLETE

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Dispatched when an authentication attempt succeeds.

authenticationFailed

Event  
Event Object Type: org.osmf.events.ContentProtectionEvent
property ContentProtectionEvent.type = org.osmf.events.ContentProtectionEvent.AUTHENTICATION_FAILED

Language Version: ActionScript 3.0
Product Version: OSMF 4.0
Runtime Versions: Flash Player 10, AIR 1.0

Dispatches when an authentication attempt fails.

authenticationNeeded

Event  
Event Object Type: org.osmf.events.ContentProtectionEvent
property ContentProtectionEvent.type = org.osmf.events.ContentProtectionEvent.AUTHENTICATION_NEEDED

Dispatched when either anonymous or credential-based authentication is needed in order to playback the media.