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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

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

Method Description<br />

resetDRMVouchers() Deletes all the locally cached digital rights managem<strong>en</strong>t (DRM) voucher data. The application<br />

must download the vouchers again for the user to be able to access the <strong>en</strong>crypted cont<strong>en</strong>t.<br />

For example, the following code removes all vouchers from the cache:<br />

NetStream.resetDRMVouchers();<br />

setDRMAuth<strong>en</strong>ticationCred<strong>en</strong>tials() Passes a set of auth<strong>en</strong>tication cred<strong>en</strong>tials, namely user name, password, and auth<strong>en</strong>tication type,<br />

to the NetStream object for auth<strong>en</strong>tication. Valid auth<strong>en</strong>tication types are "drm" and "proxy".<br />

With "drm" auth<strong>en</strong>tication type, the cred<strong>en</strong>tials provided are auth<strong>en</strong>ticated against Flash<br />

Access. With "proxy" auth<strong>en</strong>tication type, the cred<strong>en</strong>tials auth<strong>en</strong>ticate against the proxy server<br />

and must match the cred<strong>en</strong>tials required by the proxy server. For example, an <strong>en</strong>terprise can<br />

require the application to auth<strong>en</strong>ticate against a proxy server before the user can access the<br />

Internet. The proxy option allows this type of auth<strong>en</strong>tication. Unless anonymous auth<strong>en</strong>tication is<br />

used, after the proxy auth<strong>en</strong>tication, the user must still auth<strong>en</strong>ticate against Flash Access to obtain<br />

the voucher and play the cont<strong>en</strong>t. You can use setDRMAuth<strong>en</strong>ticationCred<strong>en</strong>tials() a<br />

second time, with “drm" option, to auth<strong>en</strong>ticate against Flash Access.<br />

preloadEmbeddedMetadata() Parses a local media file for embedded metadata. Wh<strong>en</strong> DRM-related metadata is found, AIR calls<br />

the onDRMCont<strong>en</strong>tData() callback function.<br />

In addition, in AIR, a NetStream object calls the onDRMCont<strong>en</strong>tData() and onPlayStatus() callback functions as a<br />

result of a call to the preloadEmbeddedMetaData() method. The onDRMCont<strong>en</strong>tData() function is called wh<strong>en</strong><br />

DRM metadata is <strong>en</strong>countered in a media file. The onPlayStatus() function is called wh<strong>en</strong> the file has be<strong>en</strong> parsed.<br />

The onDRMCont<strong>en</strong>tData() and onPlayStatus() functions must be defined on the cli<strong>en</strong>t object assigned to the<br />

NetStream instance. If you use the same NetStream object to preload vouchers and play cont<strong>en</strong>t, wait for the<br />

onPlayStatus() call g<strong>en</strong>erated by preloadEmbeddedMetaData() before starting playback.<br />

In the following code for AIR, user name (“administrator”), password (“password”) and the “drm” auth<strong>en</strong>tication type<br />

are set for auth<strong>en</strong>ticating the user. The setDRMAuth<strong>en</strong>ticationCred<strong>en</strong>tials() method must provide cred<strong>en</strong>tials that<br />

match cred<strong>en</strong>tials known and accepted by the cont<strong>en</strong>t provider. These cred<strong>en</strong>tials are the same user cred<strong>en</strong>tials that<br />

permit the user to view the cont<strong>en</strong>t. The code for playing the video and making sure that a successful connection to<br />

the video stream has be<strong>en</strong> made is not included here.<br />

var connection:NetConnection = new NetConnection();<br />

connection.connect(null);<br />

var videoStream:NetStream = new NetStream(connection);<br />

videoStream.addEv<strong>en</strong>tList<strong>en</strong>er(DRMAuth<strong>en</strong>ticateEv<strong>en</strong>t.DRM_AUTHENTICATE,<br />

drmAuth<strong>en</strong>ticateEv<strong>en</strong>tHandler)<br />

private function drmAuth<strong>en</strong>ticateEv<strong>en</strong>tHandler(ev<strong>en</strong>t:DRMAuth<strong>en</strong>ticateEv<strong>en</strong>t):void<br />

{<br />

videoStream.setDRMAuth<strong>en</strong>ticationCred<strong>en</strong>tials("administrator", "password", "drm");<br />

}<br />

Last updated 6/6/2012<br />

535

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

Saved successfully!

Ooh no, something went wrong!