AVPlayExtension API
avplayextension api to use samsung product api, <script type="text/javascript" src="$webapis/avplayextension/avplayextension js"></script> should be loaded in index html the module defines the functionalities of the player that are exposed and which could be easily used by an application or widget developer to support multimedia rtp/udp playback for audio or video that are provided by the tizen samsung product api since 6 5 product b2b htv remark webapp should include avplayextension js file in index html summary of interfaces and methods interface method avplaymanagerobject avplaymanager void open domstring url ;void close ;void prepare ;void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ;void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ;void play ;void stop ;avplayplayerstate getstate ;unsigned long getcurrenttime ;void setlistener avplayplaybackcallback playbackcallback ;domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ;void setdisplaymethod avplaydisplaymode displaymode ;void setselecttrack avplaystreamtype tracktype, long trackindex ;avplaystreaminfo getcurrentstreaminfo ;avplaystreaminfo[] gettotaltrackinfo ;void setstreamingproperty avplaystreamingpropertytype propertytype, any propparam ;domstring getversion ;void setdisplayrotation domstring displayrotation ; avplayplaybackcallback void onevent avplayevent eventid, domstring data ;void onerror avplayerror eventid ;void ondrmevent avplaydrmtype type, drmdata data ; 1 type definitions 1 1 avplayplayerstate this enumeration defines the player states enum avplayplayerstate { "none", "idle", "ready", "playing", "paused" }; the following values are supported none indicates that the player is not created idle indicates that the player is created but not prepared ready indicates that the player is ready to play a media playing indicates that the player is playing a media paused indicates that the player is paused 1 2 avplaydisplaymode this enumeration defines the possible values for webapis avplay setdisplaymethod enum avplaydisplaymode { "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" }; the following values are supported player_display_mode_letter_box letter box mode player_display_mode_full_screen full screen mode player_display_mode_auto_aspect_ratio use the dar/par from the video info to show video 1 3 avplaystreamingpropertytype this enumeration specifies the values for a specific feature in udp/rtp enum avplaystreamingpropertytype { "enable_ttx", "set_interactive_mode" }; the following values are supported enable_ttx sets the player to handle ttx dataservice in streams it has one string parameter, which is either "true" or "false" for setstreamingproperty set_interactive_mode enables the interactive mode which sets the latency to the player it has two parameters, one is the "mode" and the other is the "latency" for setstreamingproperty the mode value can be 0 off and 1 on , the latency must be given in milliseconds 1 4 avplaydrmtype this enumeration specifies the different drm types defined by the player enum avplaydrmtype { "proidiom", "lynk" }; the following values are supported proidiom indicates drm type is pro idiom lynk indicates drm type is lynkdrm scas 1 5 avplaydrmoperation this enumeration defines the different drm operations by the player enum avplaydrmoperation { "initialize", "finalize" }; the following values are supported initialize initializes the drm instance for further processing finalize finalizes the drm instance which was created earlier this must be done at the end before closing the player instance 1 6 avplaystreamtype this enumeration defines the stream types defined by the player enum avplaystreamtype { "video", "audio", "text" }; the following values are supported video indicates the video track audio indicates the audio track text indicates the subtitle track 1 7 avplayerror this enumeration defines the player error message types defined by the player enum avplayerror { "player_error_none", "player_error_invalid_parameter", "player_error_invalid_operation", "player_error_invalid_state", "player_error_not_supported_file", "player_error_invalid_uri", "player_error_connection_failed", "player_error_genereic" }; the following values are supported player_error_none indicates that the operation is successfully completed player_error_invalid_parameter if the player finds any parameter which a caller is trying to configure on it to be incorrect, this error is generated player_error_invalid_operation indicates an invalid api call at the moment player_error_invalid_state indicates the error that is generated when any api is called in a state where it is not suggested to be called refer to apis description for valid states player_error_not_supported_file indicates the error that is generated, when required multimedia components are not available to play the given content player_error_invalid_uri indicates an error that is generated when an input uri is in the invalid format player_error_connection_failed indicates the error that is generated, when no data is coming from the network player_error_genereic if the player fails to create a display window, this error is generated 1 8 avplayevent this enumeration defines the events that come from the player enum avplayevent { "player_msg_none", "player_streaming_event" }; the following values are supported player_msg_none notifies that a multimedia component message is not recognized by the player player_streaming_event any type of streaming data that the caller needs would be posted through this event 1 9 avplaystreaminfo the avplaystreaminfo dictionary specifies the streaming media-related information for the video, audio, and the subtitles during various streaming scenarios dictionary avplaystreaminfo { unsigned long index; avplaystreamtype type; domstring extra_info; }; the following values are supported index index value of the stream type type of the stream, either video, audio, or text extra_info domstring json string containing all the media-related information all stream types have an extra_info string //video extra_info example "{fourcc "h264","width" "1920","height" "1080","bit_rate" " 477000"}" //audio extra_info example "{"language" "fr","channels" "2","sample_rate" "48000","bit_rate" "256000","fourcc" "mpeg","track_lang" "fra","audio_type" "0"}" //text subtitle extra_info example "{"track_lang" "eng","subtitle_type" "0","pid" "258","subtitle_mode" "0"}" if the stream type is invalid, the domstring becomes null and the index value becomes -1 1 10 drmdata the drmdata dictionary specifies information about the data received from the player via the drm event dictionary drmdata { domstring name; long code; domstring message; long reserved; }; the following values are supported name name for the message received from the player code signifies the drm error code message drm error message generally, it is a human readable message reserved reserved for future use 2 interfaces 2 1 avplaymanagerobject the interface defines what is instantiated by the webapi object of the tizen-based samsung tv product api there will be a webapis object that allows access to the functionality of the avplay api [nointerfaceobject] interface avplaymanagerobject { readonly attribute avplaymanager avplay; }; webapi implements avplaymanagerobject; attributes readonly avplaymanager avplay namespace for the avplay api 2 2 avplaymanager this interface provides methods to use the avplay functionalities [nointerfaceobject] interface avplaymanager { void open domstring url ; void close ; void prepare ; void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; void play ; void stop ; avplayplayerstate getstate ; unsigned long getcurrenttime ; void setlistener avplayplaybackcallback playbackcallback ; domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; void setdisplaymethod avplaydisplaymode displaymode ; void setselecttrack avplaystreamtype tracktype, long trackindex ; avplaystreaminfo getcurrentstreaminfo ; avplaystreaminfo gettotaltrackinfo ; void setstreamingproperty avplaystreamingpropertytype propertytype, any propparam ; domstring getversion ; void setdisplayrotation domstring displayrotation ; }; methods open this method instantiates the player object and takes the content url as the input parameter void open domstring url ; product b2b htv constraint can be called in the following states "none", "idle" privilege level partner privilege http //developer samsung com/privilege/streamingtvplayer parameters url the url of content to play it supports udp and rtp multicast urls exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example try { webapis avplay open url ; } catch e { console log e ; } close this method destroys the avplay object void close ; product b2b htv constraint can be called in the following states "none", "idle", "ready", "paused" , "playing" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example try { webapis avplay close ; } catch e { console log e ; } prepare this method prepares the media player for playback the player must have been created beforehand with a valid uri this prepare method is synchronous hence, the calling context would be blocked until the player is prepared void prepare ; product b2b htv constraint can be called in the following states "idle", "ready" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if the given url through open is invalid //for example, webapis avplay open "invalidurl" with error type invalidaccesserror, if the given url through open is valid but have outside multicast range //for example, webapis avplay open "udp //219 10 10 10" with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example try { webapis avplay prepare ; } catch e { console log e ; } prepareasync this method prepares the media player for playback, asynchronously this api prepares the mm core module, asynchronously it means that the internal media elements will change the state, asynchronously we recommend this asynchronous prepareasync call instead of the prepare call which is synchronous api which blocks the entire application during its execution prepareasync returns immediately, rather than blocking until enough data has been buffered since this works in asynchronous model, this does not block the executing thread and the application is responsive during its execution when prepareasync gets successfully completed, it returns with successcallback and player reached in ready state for some reason, e g network error, it returns with errorcallback with error value void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; product b2b htv constraint can be called in the following states "idle", "ready" parameters successcallback [optional][nullable] callback method to be invoked when this api is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if the given url through open is invalid e g , webapis avplay open "invalidurl" invalidaccesserror, if the given url through open is valid, but does not exist or network issue e g , webapis avplay open "http //abc" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with the expected type code example webapis avplay prepareasync = function successcallback, errorcallback { if typeof successcallback === 'undefined' { successcallback = null; } if typeof errorcallback === 'undefined' { errorcallback = null; } try { webapis epavplay prepareasync successcallback, errorcallback ; } catch e { logerror e ; throw e ; } }; setdisplayrect this method sets the display area for playing the video content on the tv screen it should be called for showing the video after calling an open method app's default resolution is 1920x1080 it needs 4 parameters left,top,width,height that always use 1920 x 1080 coordinate system regardless of your application resolution void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; product b2b htv constraint can be called in the following states "idle", "paused", "ready", "playing" parameters x coordinate of the display area in the tv screen coordinates this x value is smaller than the tv screen width y coordinate of the display area in the tv screen coordinates this y value is smaller than the tv screen height width the width of the display area this value is smaller than the width of the tv screen height the height of the display area from the source image this value is smaller than the height of the source image exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example try { webapis avplay setdisplayrect 0, 0, 1920, 1080 ; } catch e { console log e ; } play this method starts the playback of the stream void play ; product b2b htv constraint can be called in the following states "ready", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example try { webapis avplay play ; } catch e { console log e ; } stop this method stops the player and hence any video that is currently being played void stop ; product b2b htv constraint can be called in the following states "none", "idle", "ready", "paused", "playing" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example try { webapis avplay stop ; } catch e { console log e ; } getstate this method returns the current state of the underlying player which is associated with the avplay object avplayplayerstate getstate ; product b2b htv constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value avplayplayerstate returns the state of the player "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example var bret = webapis avplay getstate ; getcurrenttime this method returns the current play time in milliseconds unsigned long getcurrenttime ; product b2b htv constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value unsigned long current playback time in milliseconds exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example var currentplaytime = webapis avplay getcurrenttime ; setlistener this method is used in order to obtain the player information, the drm mode information etc , and the callback function is registered when the relevant event occurs, the relevant callback function gets called asynchronously void setlistener avplayplaybackcallback playbackcallback ; product b2b htv constraint can be called in the following states "none", "idle" recommended , "ready", "paused", "playing" but it is highly recommended to call this api just after player_status_idle for onerror, onevent, ondrmevent, it must be in player_status_idle i e just after player is created , otherwise the necessary information will be missed parameters playbackcallback avplayplaybackcallback exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type unknownerror in any other error case code example var listener = { onevent function eventtype, eventdata { console log "event type error " + eventtype + ", data " + eventdata ; }, onerror function eventtype { console log "event type error " + eventtype ; }, ondrmevent function drmevent, drmdata { console log "drm callback " + drmevent + ", data " + drmdata ; } } webapis avplay setlistener listener ; setdrm this method updates the drm information, such as setproperties, etc it changes the drm mode, and runs the control feature every drm has difference between avplaydrmoperation and jsonparam domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; product b2b htv constraint can be called in the following states "idle" privilege level public privilege http //developer samsung com/privilege/drmplay parameters drmtype is the type of the drm drmoperation avplaydrmoperation this is a string parameter which specifies the drm operation to be performed for the current playback session it can have these values{"initialize", "finalize" } "setproperties" this operation is used when the drm related information is stringified in "json_string" format and passed along with this operation this is mainly used for setting the drm information like license server, etc //example setting license server some of the code examples are given below jsonparam domstring drm parameter represented by json string not object the application can call json stringify to generate json string in java script the above given drm operation examples could be stringified in this json_string param return value domstring "true" in case of success and "false" if fails exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type securityerror, if the application does not have the privilege to call this method with error type invalidstateerror, if it is called in an invalid state, "none" with error type unknownerror in any other error case during failure scenarios this api would post an exception the following could be the possible exception scenarios drm create failed if creation of the underlying drm module failed, an exception would be sent back with "false" return status of this api call invalid drm session if an invalid drm session is detected, an exception would be sent back with "false" return status of this api call drm configuration failure if a drm configuration failure is detected, an exception would be sent back with "false" return status of this api call note if you use this api, a special privilege level is required insert the http //developer samsung com/privilege/drmplay in the config xml file of the web application check below example <tizen privilege name="http //developer samsung com/privilege/drmplay"/> code example // example proidiom setting forensic data var drmparam = new object ; drmparam forensicdata = "xxxxxxx"; playerobj setdrm "proidiom", "initialize", json stringify drmparam ; // example lynkdrm setting type and lynk server var drmparam = new object ; drmparam type ="2"; drmparam lynkserver="xxx xxx xxx xxx xxxxx"; playerobj setdrm "lynk", "initialize", json stringify drmparam ; setdisplaymethod this method sets the video screen mode within the given display area void setdisplaymethod avplaydisplaymode displaymode ; product b2b htv constraint can be called in the following states "idle", "paused", "ready", "playing" limitation this api works when set as setdisplayrect 0,0,1920,1080 parameters displaymode could be one of "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example webapis avplay setdisplaymethod "player_display_mode_full_screen" ; setselecttrack this method is used with multi audio/subtitle, when you want to change the audio and subtitle while playing void setselecttrack avplaystreamtype tracktype, long trackindex ; product b2b htv constraint can be called in the following state "playing" parameters tracktype it may be audio or text value trackindex it sets the index value of the avplaystreaminfo obtained through the webapis avplay gettotaltrackinfo function exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example var totaltrackinfo = webapis avplay gettotaltrackinfo ; for var i=0; i<totaltrackinfo length; i++ { if totaltrackinfo type == 'text' { console log 'find subtitle track ' ; console log 'subtitle track index is ' + totaltrackinfo index ; console log 'subtitle track language is ' + totaltrackinfo extra_info track_lang ; } } //for example, choose the subtitle track index number 2 webapis avplay setselecttrack 'text',2 ; getcurrentstreaminfo this method gets the currently playing streams video, audio, and subtitle information it informs that a stream is playing avplaystreaminfo getcurrentstreaminfo ; product b2b htv constraint can be called in the following states "playing" return value avplaystreaminfo avplaystreaminfo structure containing tracktype, extrainfo and index of current stream exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example var streaminfo = webapis avplay getcurrentstreaminfo ; var text = ''; for var i = 0; i < streaminfo length; i++ { text += 'index ' + streaminfo[i] index + ''; text += 'type ' + streaminfo[i] type + ''; text += 'extra_info ' + streaminfo[i] extra_info + ''; } all of stream type has extra_info which is jsonstring //video extra_info example "{fourcc "h264","width" "1920","height" "1080","bit_rate" " 477000"}" //audio extra_info example "{"language" "fr","channels" "2","sample_rate" "48000","bit_rate" "256000","fourcc" "mpeg","track_lang" "fra","audio_type" "0"}" //text subtitle extra_info example "{"track_lang" "eng","subtitle_type" "0","pid" "258","subtitle_mode" "0"}" in the case of invalid stream, the domstring becomes null and the index value becomes -1 gettotaltrackinfo this method gets the currently playing streams information avplaystreaminfo[] gettotaltrackinfo ; product b2b htv constraint can be called in the following state "playing" return value avplaystreaminfo avplaystreaminfo[] structure containing the tracktype, extrainfo, and the index of current stream it returns information for all the available tracks for the entire stream that is available in the current playback the following structure is used to send the information back to the caller for video tracks "{"fourcc" "%s","width" "%u","height" "%u","bit_rate" "%u"}" for audio track "{"language" "%s","channels" "%d","sample_rate" "%d","bit_rate" "%d","fourcc" "%s","track_lang" "%s","audio_type" "%d"}" for subtitle tracks "{"track_lang" "%s","subtitle_type" "%d","pid" "%d","subtitle_mode" "%s"}" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example var trackinfo = webapis avplay gettotaltrackinfo ; var text = 'type of track info ' + typeof trackinfo + ''; text += 'length ' + trackinfo length + ''; for var i = 0; i<trackinfo length; i++ { text += 'index ' + trackinfo[i] index + ''; text += 'type ' + trackinfo[i] type + ''; text += 'extra_info ' + trackinfo[i] extra_info + ''; } setstreamingproperty this method sets the value for a specific feature in the udp/rtp playback void setstreamingproperty avplaystreamingpropertytype propertytype, any propparam ; product b2b htv constraint can be called in the following player state "idle" parameters propertytype property type to be set to the player propparam value according to the propertytype e g "enable_ttx" propetytypes are true, false, and for the "set_interactive_mode" mode is 1 with latency in milliseconds exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example //set interactive mode example var propparam = new object ; propparam mode ="1"; propparam latency="100"; //latency in ms webapis avplay setstreamingproperty "set_interactive_mode", propparam ; //enable ttx mode example webapis avplay setstreamingproperty "enable_ttx", true ; getversion this method gets the version of avplay domstring getversion ; product b2b htv constraint can be called in the following states "none", "idle", "ready", "paused", "playing" return value domstring domstring string current version exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example var version = webapis avplay getversion ; setdisplayrotation this method sets the rotation settings of the video surface display if no display is set, no operation is performed use this method to change the video orientation to portrait mode this api call will change the origin of the coordinates hence, the application should call setdisplayrect again after calling this api void setdisplayrotation domstring displayrotation ; product b2b htv constraint can be called in the following states "idle", "ready", "playing", "paused" parameters displayrotation the rotation of the display the valid values for the display rotation are "player_display_rotation_none", "player_display_rotation_90", "player_display_rotation_180", "player_display_rotation_270" exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setdisplayrotation "player_display_rotation_90" ; 2 3 avplayplaybackcallback this callback interface defines subscriptions for any notification on the buffering, playback [callback=functiononly, nointerfaceobject] interface avplayplaybackcallback { void onevent avplayevent eventid, domstring data ; void onerror avplayerror eventid ; void ondrmevent avplaydrmtype type, drmdata data ; }; methods onevent this method gets called async when some kind of event other event is received from the player void onevent avplayevent eventid, domstring data ; parameters eventid id of the event triggered by the player data description of the event received from the player exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example onevent function eventid, data { console log "onevent callback with eventtype " + eventid ; } onerror this method gets called when an error event is received from the player void onerror avplayerror eventid ; parameters eventid id of the error event trigerred by the player exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example onerror function eventid { console log "onerror event callback with eventtype " + eventid ; } ondrmevent this method gets called when the drm information is received from the player void ondrmevent avplaydrmtype type, drmdata data ; parameters type drm type data detailed information about the drm event received from the player { readonly attribute name name for the message, means an error occurred during the drm processing readonly attribute code signifies the drm error code readonly attribute message drm error message readonly attribute reserved not currently applicable } exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example ondrmevent function type, data { console log "drm callback " + type + ", data " + data ; var errorinfo = { "name" data name, "error_code" data code, "error_message" data message // generally, the error message is human readable } } 3 full webidl module avplayextension { enum avplayplayerstate { "none", "idle", "ready", "playing", "paused" }; enum avplaydisplaymode { "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" }; enum avplaystreamingpropertytype { "enable_ttx", "set_interactive_mode" }; enum avplaydrmtype { "proidiom", "lynk" }; enum avplaydrmoperation { "initialize", "finalize" }; enum avplaystreamtype { "video", "audio", "text" }; enum avplayerror { "player_error_none", "player_error_invalid_parameter", "player_error_invalid_operation", "player_error_invalid_state", "player_error_not_supported_file", "player_error_invalid_uri", "player_error_connection_failed", "player_error_genereic" }; enum avplayevent { "player_msg_none", "player_streaming_event" }; dictionary avplaystreaminfo { unsigned long index; avplaystreamtype type; domstring extra_info; }; dictionary drmdata { domstring name; long code; domstring message; long reserved; }; [nointerfaceobject] interface avplaymanagerobject { readonly attribute avplaymanager avplay; }; webapi implements avplaymanagerobject; [nointerfaceobject] interface avplaymanager { void open domstring url ; void close ; void prepare ; void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; void play ; void stop ; avplayplayerstate getstate ; unsigned long getcurrenttime ; void setlistener avplayplaybackcallback playbackcallback ; domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; void setdisplaymethod avplaydisplaymode displaymode ; void setselecttrack avplaystreamtype tracktype, long trackindex ; avplaystreaminfo getcurrentstreaminfo ; avplaystreaminfo[] gettotaltrackinfo ; void setstreamingproperty avplaystreamingpropertytype propertytype, any propparam ; domstring getversion ; void setdisplayrotation domstring displayrotation ; }; [callback=functiononly, nointerfaceobject] interface avplayplaybackcallback { void onevent avplayevent eventid, domstring data ; void onerror avplayerror eventid ; void ondrmevent avplaydrmtype type, drmdata data ; }; };