13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Using digital rights managem<strong>en</strong>t<br />

}<br />

}<br />

trace( "Auth<strong>en</strong>ticated to: " + ev<strong>en</strong>t.serverURL + ", domain: " + ev<strong>en</strong>t.domain );<br />

getVoucher();<br />

}<br />

private function onDRMStatus( ev<strong>en</strong>t:DRMStatusEv<strong>en</strong>t ):void<br />

{<br />

trace( "DRM Status: " + ev<strong>en</strong>t.detail);<br />

trace("--Voucher allows offline playback = " + ev<strong>en</strong>t.isAvailableOffline );<br />

trace("--Voucher already cached = " + ev<strong>en</strong>t.isLocal );<br />

trace("--Voucher required auth<strong>en</strong>tication = " + !ev<strong>en</strong>t.isAnonymous );<br />

}<br />

private function onDRMError( ev<strong>en</strong>t:DRMErrorEv<strong>en</strong>t ):void<br />

{<br />

trace( "DRM error ev<strong>en</strong>t: " + ev<strong>en</strong>t.errorID + ", " + ev<strong>en</strong>t.subErrorID + ", " + ev<strong>en</strong>t.text );<br />

}<br />

public function onPlayStatus( info:Object ):void<br />

{<br />

preloadStream.close();<br />

}<br />

DRM-related members and ev<strong>en</strong>ts of the NetStream<br />

class<br />

Flash Player 10.1 and later, Adobe AIR 1.0 and later<br />

The NetStream class provides a one-way streaming connection betwe<strong>en</strong> Flash Player or an AIR application, and either<br />

Flash Media Server or the local file system. (The NetStream class also supports progressive download.) A NetStream<br />

object is a channel within a NetConnection object. The NetStream class dispatches four DRM-related ev<strong>en</strong>ts:<br />

Ev<strong>en</strong>t Description<br />

drmAuth<strong>en</strong>ticate<br />

(AIR only)<br />

Defined in the DRMAuth<strong>en</strong>ticateEv<strong>en</strong>t class. This ev<strong>en</strong>t is dispatched wh<strong>en</strong> a NetStream object tries to play<br />

protected cont<strong>en</strong>t that requires a user cred<strong>en</strong>tial for auth<strong>en</strong>tication before playback.<br />

The properties of this ev<strong>en</strong>t include header, usernamePrompt, passwordPrompt, and urlPrompt properties<br />

that can be used in obtaining and setting the user’s cred<strong>en</strong>tials. This ev<strong>en</strong>t occurs repeatedly until the<br />

NetStream object receives valid user cred<strong>en</strong>tials.<br />

drmError Defined in the DRMErrorEv<strong>en</strong>t class and dispatched wh<strong>en</strong> a NetStream object tries to play protected cont<strong>en</strong>t<br />

and <strong>en</strong>counters a DRM-related error. For example, DRM error ev<strong>en</strong>t object is dispatched wh<strong>en</strong> the user<br />

authorization fails. This error could occur because the user has not purchased the rights to view the cont<strong>en</strong>t.<br />

It could also occur because the cont<strong>en</strong>t provider does not support the viewing application.<br />

drmStatus Defined in the DRMStatusEv<strong>en</strong>t class. This ev<strong>en</strong>t is dispatched wh<strong>en</strong> the protected cont<strong>en</strong>t begins playing<br />

(wh<strong>en</strong> the user is auth<strong>en</strong>ticated and authorized to play the cont<strong>en</strong>t). The DRMStatusEv<strong>en</strong>t object contains<br />

information related to the voucher. Voucher information includes whether the cont<strong>en</strong>t can be made available<br />

offline or wh<strong>en</strong> the voucher expires and the cont<strong>en</strong>t can no longer be viewed.<br />

status Defined in ev<strong>en</strong>ts.StatusEv<strong>en</strong>t and only dispatched wh<strong>en</strong> the application attempts to play protected cont<strong>en</strong>t,<br />

by invoking the NetStream.play() method. The value of the status code property is "DRM.<strong>en</strong>cryptedFLV".<br />

The NetStream class includes the following DRM-specific methods, for use in AIR only:<br />

Last updated 6/6/2012<br />

534

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!