Package | com.akamai.netSession |
Class | public class NetSessionInterface |
Inheritance | NetSessionInterface com.akamai.netSession.BaseInterface |
nsi=new NetSessionInterface(); nsi.addEventListener(NetSessionPresentEvent.NETSESSION_PRESENT, onNSIPresent); nsi.check(); } private function onNSIPresent(evt:NetSessionPresentEvent):void { nsi.removeEventListener(NetSessionPresentEvent.NETSESSION_PRESENT, onNSIPresent); if (!evt.available) { trace("we don't have NetSession (NS)"); nsi.download(); nsi.addEventListener(NetSessionPresentEvent.NETSESSION_PRESENT, onNSPresentLater); nsi.check(35); } else if (evt.available){ trace("we have NS"); nsi.addEventListener(ClientAttributesEvent.CLIENTATTRIBUTES_EVENT, onAttributes); nsi.requestClientAttributes(); nsi.addEventListener(PerformanceAttributesEvent.PERFORMANCEATTRIBUTES_EVENT, onPerf); nsi.requestPerformanceAttributes(); } //fi } //() private function onNSPresentLater(evt:NetSessionPresentEvent):void{ if (evt.available) { nsi.removeEventListener(NetSessionPresentEvent.NETSESSION_PRESENT, onNSPresentLater); trace("now we have NS"); } //fi } //() private function onPerf(evt:PerformanceAttributesEvent):void{ trace('onPerf', evt.cpu);} private function onAttributes(evt:ClientAttributesEvent):void{ trace('onAtt', evt.peerUploadRatio, evt.shareRate, evt.uploadPauseUntil, evt.version);}
Method | Defined By | ||
---|---|---|---|
NetSessionInterface | |||
check(times:uint = 1, interval:uint = 333):void
Checks to see if NS is installed. | NetSessionInterface | ||
destroy():void
Call this when done with this class. | NetSessionInterface | ||
download(type:String = web):void
Start downloading NetSession in the background. | NetSessionInterface | ||
requestClientAttributes():void
This will dispatch ClientAttributesEvent. | NetSessionInterface | ||
requestPerformanceAttributes():void
Dispatches PerofmranceAttributgesEvent with information on CPU utilization. | NetSessionInterface |
Event | Summary | Defined By | ||
---|---|---|---|---|
Find out all the information we have on the installed NetSession client. | NetSessionInterface | |||
Dispatched when the class detects a change in the presence of the Akamai NetSession. | NetSessionInterface | |||
Used to monitor CPU | NetSessionInterface |
NetSessionInterface | () | Constructor |
public function NetSessionInterface()
check | () | method |
public function check(times:uint = 1, interval:uint = 333):void
Checks to see if NS is installed. Default checks once, or you can use arguments to keep checking - for example while downloading the Interface, in order to be notified once the end user has installed NS. Arguments:
Parameters
times:uint (default = 1 ) — if specified, the number of times to check, default is 1 time.
| |
interval:uint (default = 333 ) — how long to wait in ms in between checks, default is 333 ms which is 3 times per second. You should check for at least 5-10 minutes for the install to be done.
|
destroy | () | method |
public function destroy():void
Call this when done with this class.
download | () | method |
public function download(type:String = web):void
Start downloading NetSession in the background. This should be done after a mouse click or similar, for example a user clicked "Install" button. When using Air, you should use the AirNetSessionInstall - currently a separate library. Argument not currently used, but may be used in the future.
Parameters
type:String (default = web )
|
requestClientAttributes | () | method |
public function requestClientAttributes():void
This will dispatch ClientAttributesEvent.
requestPerformanceAttributes | () | method |
public function requestPerformanceAttributes():void
Dispatches PerofmranceAttributgesEvent with information on CPU utilization.
clientAttributes | Event |
com.akamai.netSession.events.ClientAttributesEvent
Find out all the information we have on the installed NetSession client.
netSessionPresent | Event |
com.akamai.netSession.events.NetSessionPresentEvent
Dispatched when the class detects a change in the presence of the Akamai NetSession.
performanceAttributes | Event |