top

AVPlay API

To use Samsung Product API, 

<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>

Should be loaded in index.html

The module defines the functionalities of player that are exposed which could be easily used by app or widget developer to support multimedia playback for audio or video that are provides as the Tizen Samsung TV Product API.

Since : 1.0

Table of Contents

  1. 1. Type Definitions
    1. 1.1. AVPlayPlayerState
    2. 1.2. AVPlayDisplayMode
    3. 1.3. AVPlayStreamingPropertyType
    4. 1.4. AVPlayDrmType
    5. 1.5. AVPlayDrmOperation
    6. 1.6. AVPlayStreamType
    7. 1.7. AVPlayStreamInfo
    8. 1.8. AVPlayBufferingType
    9. 1.9. AVPlayBufferSizeUnit
  2. 2. Interfaces
    1. 2.1. AVPlayManagerObject
    2. 2.2. AVPlayManager
    3. 2.3. AVPlayPlaybackCallback
    4. 2.4. AVPlaySoundAnalysisCallback
  3. 3. Error code and Event Code
  4. 4. Full WebIDL

Summary of Interfaces and Methods

Interface Method
AVPlayManagerObject  
AVPlayManager void open();
void close();
void prepare();
void prepareAsync(opitional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
void setDisplayRect( long x, long y, long width, long height);
void play();
void seekTo(long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
void stop(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
PlayerState getState();
void pause();
void jumpForward(long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
void jumpBackward( long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback );
unsigned long getDuration();
unsigned long getCurrentTime();
bool setTimeoutForBuffering(unsigned long Milliseconds);
void setBufferingParam(AVPlayBufferingType bufferingType, AVPlayBufferSizeUnit bufferingunit, int amount );
void setSpeed(long playbackSpeed);
void setListener(AVPlayPlaybackCallback playbackCallback);
Any setDrm(AVPlayDrmType drmType, AVPlayDrmOperation drmOperation, DOMString jsonParam);
void setSoundAnalysisListener(AVPlaySoundAnalysisCallback soundAnalysisCallback);
void unsetSoundAnalysisListener();
void setSilentSubtitle(bool onoff);
void setExternalSubtitlePath(DOMString pFilePath);
void setSubtitlePosition(unsigned long position);
void setDisplayMethod(AVPlayDisplayMode displayMode);
void setSelectTrack(AVPlayStreamType trackType, long trackIndex);
AVPlayCurrentStreamInfo getCurrentStreamInfo();
AVPlayStreamInfo[] getTotalTrackInfo();
void setStreamingProperty(AVPlayStreamingPropertyType propertyType, Any propparam);
Any getStreamingProperty(AVPlayStreamingPropertyType propertyType);
DOMString getVersion();
void suspend();
void restore(DOMString URL, long resumeTime, boolean bPrepare);
AVPlayPlaybackCallback void onbufferingstart();
void onbufferingprogress(unsigned long percent);
void onbufferingcomplete();
void oncurrentplaytime(unsigned long currentTime );
void onstreamcompleted();
void onevent(long eventid, DOMString data );
void onerror(long eventid);
void ondrmevent(AVPlayDrmType type, long eventid);
void onsubtitlechange(unsigned long duration, DOMString subtitles, unsigned long type, unsigned long attriCount, AVPlaySubtitleAttribute attributes);
AVPlaySoundAnalysisCallback BasePlatformException ongetexception();
void onsetexception(BasePlatformException err);
long[] ongetbandsarray();

1. Type Definitions

1.1. AVPlayPlayerState

This enumeration defines the state of the player.

enum AVPlayPlayerState { "NONE", "IDLE", "READY", "PLAYING", "PAUSED"};

Since : 1.0

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 media
  • PLAYING - Indicates that the player is paying media
  • PAUSED - Indicates that the player is paused

1.2. AVPlayDisplayMode

This enumeration defines the possible values for webapis.avplay.setDisplayMode() method

enum AVPlayDisplayMode { "PLAYER_DISPLAY_MODE_LETTER_BOX", "PLAYER_DISPLAY_MODE_ORIGIN_SIZE", "PLAYER_DISPLAY_MODE_FULL_SCREEN", "PLAYER_DISPLAY_MODE_CROPPED_FULL",
    "PLAYER_DISPLAY_MODE_ZOOM_HALF", "PLAYER_DISPLAY_MODE_ZOOM_THREE_QUARTERS", "PLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER", "PLAYER_DISPLAY_MODE_DST_ROI", 
    "PLAYER_DISPLAY_MODE_ZOOM_16_9", "PLAYER_DISPLAY_MODE_ZOOM", "PLAYER_DISPLAY_MODE_ZOOM_CUSTOM" };

Since : 1.0

The following values are supported

  • PLAYER_DISPLAY_MODE_LETTER_BOX - Letter box
  • PLAYER_DISPLAY_MODE_ORIGIN_SIZE - Origin size
  • PLAYER_DISPLAY_MODE_FULL_SCREEN - Screen
  • PLAYER_DISPLAY_MODE_CROPPED_FULL - Screen
  • PLAYER_DISPLAY_MODE_ZOOM_HALF - Zoom half
  • PLAYER_DISPLAY_MODE_ZOOM_THREE_QUARTERS - Zoom three quarters
  • PLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER - Origin size (if surface size is larger than video size(width/height)) or Letter box (if video size(width/height) is larger than surface size)
  • PLAYER_DISPLAY_MODE_DST_ROI - Dst ROI mode
  • PLAYER_DISPLAY_MODE_ZOOM_16_9 - 6*9
  • PLAYER_DISPLAY_MODE_ZOOM - ZOOM
  • PLAYER_DISPLAY_MODE_ZOOM_CUSTOM - ZOOM CUSTOM

1.3. AVPlayStreamingPropertyType

This enumeration sets the value for specific Feature in the HTTP, MMS & Streaming Engine (Smooth Streaming, HLS, DASH, DivX Plus Streaming, Widevine). When special setting is required in Streaming Engine for the Start Bitrate setting &specific CP, the CUSTOM_MESSAGE Property can be set.

enum AVPlayStreamingPropertyType { "COOKIE", "USER_AGENT", "PREBUFFER_MODE" , "ADAPTIVE_INFO", "SET_MODE_3D", "SET_MODE_4K", "HD_AUDIO", "WIDEVINE" };

Since : 1.0

The following values are supported

  • COOKIE - sets http cookie
  • USER_AGENT - sets http user agent
  • PREBUFFER_MODE - Number of milliseconds to resume position
  • ADAPTIVE_INFO - BITRATES or "STARTBITRATE" or "SKIPBITRATE"
  • SET_MODE_3D - for setting 3D mode
  • SET_MODE_4K - for setting 4K mode
  • HD_AUDIO - for HD audio
  • WIDEVINE - refer DrmType

1.4. AVPlayDrmType

This enumeration specifies the different DrmTypes defined by the player.

enum AVPlayDrmType {"PLAYREADY", "VERIMATRIX", "WIDEVINE_CLASSIC", "SECUREMEDIA", "SDRM"};

Since : 1.0

The following values are supported

  • PLAYREADY - indicates drm type is PlayReady
  • VERIMATRIX - indicates drm type is verimatrix
  • WIDEVINE_CLASSIC - indicates drm type is widevine classic
  • SECUREMEDIA - indicates drm type is secure media
  • SDRM - indicates drm type is sdrm

1.5. AVPlayDrmOperation

This enumeration defines the different DrmOperations by the player.

enum AVPlayDrmOperation { "SetProperties", "InstallLicense", "GetUID", "Initialize", "Finalize" };

Since : 1.0

The following values are supported

  • SetProperties - setting properties of a DRM instance for playready
  • InstallLicense - installing a License for playready
  • GetUID - et a Unique identifier from Verimatrix
  • Initialize - initialize Verimatrix
  • Finalize - finalize Verimatrix

1.6. AVPlayStreamType

This enumeration defines the Stream Types defined by the player.

enum AVPlayStreamType { "VIDEO", "AUDIO", "TEXT" };

Since : 1.0

The following values are supported

  • VIDEO - indicates video track.
  • AUDIO - indicates audio track.
  • TEXT - indicates text track.

1.7. AVPlayStreamInfo

The AVPlayStreamInfo dictionary specifies streaming media related information for video, audio and subtitle. e.g. for smooth streaming.

dictionary AVPlayStreamInfo {
    unsigned long index;
    AVPlayStreamType type;
    DOMString extra_info;
};

Since : 1.0

The following values are supported

  • index - unsigned long
  • type - AVPlayStreamInfo
  • extra_info - DOMString (Json)

1.8. AVPlayBufferingType

This enumeration defines the Buffering Types defined by the player.

    enum AVPlayBufferingType {"PLAYER_BUFFER_FOR_PLAY", "PLAYER_BUFFER_FOR_RESUME"};

Since : 1.0

The following values are supported

  • PLAYER_BUFFER_FOR_PLAY - indicates Buffering param is for first play case.
  • PLAYER_BUFFER_FOR_RESUME - indicates Buffering param is for resume case.

1.9. AVPlayBufferSizeUnit

This enumeration defines the Buffering param's Unit defined by the player.

    enum AVPlayBufferSizeUnit { "PLAYER_BUFFER_SIZE_IN_BYTE", "PLAYER_BUFFER_SIZE_IN_SECOND"};

Since : 1.0

The following values are supported

  • PLAYER_BUFFER_SIZE_IN_BYTE - indicates Buffering param's unit is bytes.
  • PLAYER_BUFFER_SIZE_IN_SECOND - indicates Buffering param's unit is seconds.

2. Interfaces

2.1. AVPlayManagerObject

The interface defines what is instantiated by the WebApi object of Tizen 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;

Since : 1.0

Attributes

  • readonly AVPlayManager avplay
    Namespace for AVPlay API.

    Since : 1.0

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( long x, long y, long width, long height );
    void play();
    void seekTo(long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    void stop();
    AVPlayPlayerState getState();
    void pause();
    void jumpForward(long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    void jumpBackward( long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback );
    unsigned long getDuration();
    unsigned long getCurrentTime();
    bool setTimeoutForBuffering(unsigned long Milliseconds);
    void setBufferingParam(AVPlayBufferingType bufferingType, AVPlayBufferSizeUnit bufferingunit, int amount );
    void setSpeed(long playbackSpeed);
    void setListener(AVPlayPlaybackCallback playbackCallback);
    Any setDrm(AVPlayDrmType drmType, AVPlayDrmOperation drmOperation, DOMString jsonParam);
    void setSoundAnalysisListener(AVPlaySoundAnalysisCallback soundAnalysisCallback);
    void unsetSoundAnalysisListener();
    void setSilentSubtitle(bool onoff);
    void setExternalSubtitlePath(DOMString pFilePath);
    void setSubtitlePosition(unsigned long position);
    void setDisplayMethod(AVPlayDisplayMode displayMode);
    void setSelectTrack(AVPlayStreamType trackType, long trackIndex);
    AVPlayCurrentStreamInfo getCurrentStreamInfo();
    AVPlayStreamInfo[] getTotalTrackInfo();
    void setStreamingProperty(AVPlayStreamingPropertyType propertyType, Any propparam);
    Any getStreamingProperty(AVPlayStreamingPropertyType propertyType);
    DOMString getVersion();
    void suspend();
    void restore(DOMString URL, long resumeTime, boolean bPrepare);
};

Since : 1.0

Methods

open
This method instantiates the player object and take input url as input paramter.

void open(DOMString url);

Since : 1.0

Parameters:

  • url: The url of the Stream Server decided to be played. Basic Streaming. It is base URL. No other information needs to be concatenated to it. HTTP(S)/MMS

Constraint

  • To be called in this state - "NONE"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


try {
    webapis.avplay.open(url);
} catch (e) {
    console.error(e);
}
close
This method destroys the avplay object.

        void close();

Since : 1.0

Constraint

  • To be called in these states - "NONE", "IDLE", "READY", "PAUSED" , "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


try {
    webapis.avplay.close();
} catch (e) {
    console.error(e);
}
prepare
This method prepare the media player for playback. Player must have been created before this with a valid URI.

void prepare();

Since : 1.0

Constraint

  • To be called in this state - "IDLE"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


try {
    webapis.avplay.prepare();
} catch (e) {
    console.error(e);
}
prepareAsync
This method prepares the media player for playback, asynchronously. Samsung recommend to use prepareAsync instead of prepare which is synchronous api which would block the entire application during its execution.

void prepareAsync(opitional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);

Since : 1.0

Parameters:

  • successCallback [optional]: Callback method to be invoked when this api success.
  • errorCallback [optional]: Callback method to be invoked when an error occurs.

Constraint

  • To be called in this state - "IDLE"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.prepareAsync(successCallback, errorCallback);
setDisplayRect
This method sets the display area for playing video content on TV screen. It should be called for showing video after calling open method. When all the value set as rect are set as 0, the Video Screen in the App disappears. Hide Function replacement.

void setDisplayRect( long x, long y, long width, long height );

Since : 1.0

Parameters:

  • x: Specifies the initial x-coordinate of display area in TV screen coordinates. This x value is smaller than TV screen width.
  • y: Specifies the initial y-coordinate of display area in TV screen coordinates. This y value is smaller than TV screen height.
  • width: The width of display area. This value is smaller than width of TV screen
  • height: The height of display area from source image. This value is smaller than height of source image. If all members of display_rect is 0, video is hided

Constraint

  • To be called in these states - "IDLE", "PAUSE", "PLAYING"
  • This API should be called before prepare (in IDLE state)
  • After calling this API once, you can call it in PAUSE, PLAYING state.

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


try {
    webapis.avplay.setDisplayRect(0, 0, 1920, 1080);
} catch (e) {
    console.error(e);
}
play
This method starts the playback of the stream.

void play();

Since : 1.0

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


try {
    webapis.avplay.play();
} catch (e) {
    console.error(e);
}
seekTo
This method used for the seeking. If you give the seconds value, then it plays by jumping to the position desired to play. It fails when you input the value outside the total Playback Time scope

void seekTo(long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);

Since : 1.0

Parameters:

  • milliseconds: position relevant to the specific duration value
  • successCallback [optional]: Callback method to be invoked when this api success.
  • errorCallback [optional]: Callback method to be invoked when an error occurs.

Constraint

  • To be called in these states - "IDLE", "PAUSE" (Buffered Data gets Flushed and the Buffering starts again from the beginning.)

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


try {
    webapis.avplay.seekTo(10000,successCallback, errorCallback);
} catch (e) {
    console.error(e);
}
stop
This method stops the player and hence any video currently being played. Also this function should be called after the video completes playing.

void stop();

Since : 1.0

Constraint

  • To be called in these states - "IDLE", "PAUSE", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


try {
    webapis.avplay.stop();
} catch (e) {
    console.error(e);
}
getState
This method return the current state of underlying player which is associated with AVPLAY object.

  AVPlayPlayerState getState();

Since : 1.0

Return value:

AVPlayPlayerState
- "NONE", "IDLE", "READY", "PLAYING", "PAUSED".

Constraint

  • To be called in these states - "NONE", "IDLE", "READY", "PLAYING", "PAUSED".

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


console.log("Player state: " + webapis.avplay.getState());
//"NONE", "IDLE", "READY", "PLAYING" or "PAUSED" is logged.
pause
This method pauses the playback.

 void pause();

Since : 1.0

Constraint

  • To be called in this state - "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


try {
    webapis.avplay.pause();
} catch (e) {
    console.error(e);
}
jumpForward
This method forwards the currently played video by the specified number of milliseconds. While playing maintaining the State mode, it plays again after the jumpfoward, and in the pause, it gets paused after the jumpfoward.

 void jumpForward(long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);

Since : 1.0

Parameters:

  • milliseconds: The number of milliseconds to be forwarded.
  • successCallback [optional]: Callback method to be invoked when this api success.
  • errorCallback [optional]: Callback method to be invoked when an error occurs.

Constraint

  • To be called in these states - "PAUSE", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.jumpForward(5000,  successCallback, errorCallback);
jumpBackward
This method rewinds the currently played video by the specified number of milliseconds.

  void jumpBackward( long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback );

Since : 1.0

Parameters:

  • milliseconds: The number of milliseconds to be backwarded.
  • successCallback [optional]: Callback method to be invoked when this api success.
  • errorCallback [optional]: Callback method to be invoked when an error occurs.

Constraint

  • To be called in these states - "PAUSE", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.jumpBackward(5000,  successCallback, errorCallback); 
getDuration
This method gets the duration time in milliseconds.

   unsigned long getDuration();

Since : 1.0

Return value:

unsigned long number Total duration time in milliseconds

Constraint

  • To be called in these states - "PAUSE", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


duration = calcPlaytime(webapis.avplay.getDuration())

var calcPlaytime = function (totalMilisec) {
    var hours = Math.floor(totalMilisec/3600000);
    var minutes = Math.floor((totalMilisec - (hours * 3600000)) / 60000);
    var seconds = Math.floor((totalMilisec - (hours * 3600000) - (minutes * 60000)) / 1000);
    var milisec = totalMilisec - (hours * 3600000) - (minutes * 60000) - (seconds * 1000);
    return {
        hours: hours,
        minutes: minutes,
        seconds: seconds,
        milisec: milisec,
        totalMilisec: totalMilisec
    }
}
getCurrentTime
This method returns the current play time in milliseconds.

  unsigned long getCurrentTime();

Since : 1.0

Return value:

unsigned long number Current Playback time in milliseconds.

Constraint

  • To be called in these states - "PAUSE", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


console.log("Current Time : " + webapis.avplay.getCurrentTime());
setTimeoutForBuffering
This method sets the streaming bufferring time of player. When the desired amount of Buffering completes before the time set as milliseconds, the success returns. if it is the time set in milliseconds even if the desired amount of Buffering is not done.

bool setTimeoutForBuffering(unsigned long Milliseconds);

Since : 1.1

Parameters

  • Milliseconds: Milliseconds

Return value:

bool bool

Constraint

  • To be called in these states - "IDLE"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.setTimeoutForBuffering(10000);
setBufferingParam
This method sets the buffering parameters for play and resume scenarios. caller must be aware that this API would override the default buffering behaviour of player. It is recommended not to use this API. Default values are 10sec and 32MB.

void setBufferingParam(AVPlayBufferingType bufferingType, AVPlayBufferSizeUnit bufferingunit, int amount ) ;

Since : 1.2

Parameters

  • bufferingType: "PLAYER_BUFFER_FOR_PLAY", "PLAYER_BUFFER_FOR_RESUME"
  • bufferingunit: "PLAYER_BUFFER_SIZE_IN_BYTE", "PLAYER_BUFFER_SIZE_IN_SECOND"
  • amount: integer value for set Buffering Param

Constraint

  • "IDLE" ==> PLAY scenario "IDLE", "READY", "PLAYING", "PAUSED".==> Resume scenario

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.setBufferingParam("PLAYER_BUFFER_FOR_RESUME","PLAYER_BUFFER_SIZE_IN_BYTE", 32*1024*1024);
setSpeed
This method sets the current playback speed. This value can be positive or negative. If the value is set to negative, the video starts playing in the reverse direction.

 void setSpeed(long playbackSpeed);

Since : 1.0

Parameters:

  • playbackSpeed: -32x, -16x, -8x, -4x, -2x, -1x, 1x, 2x, 4x, 8x, 16x, 32x

Constraint

  • To be called in these states - "PAUSE", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

    • Limitation

      • Widevine : -32 ~ 32

      • Smooth Streaming : -16 ~ 16

      • HLS : depends on contents

      • HTTP(s) : -8 ~ 8

      • Dash : -16 ~ 16 (needs high speed network performance)

Code example:


try {
    webapis.avplay.setSpeed(2)
} catch (e) {
    console.error(e);
} 
setListener
This method is used in order to obtain the Buffering, Playback Time, Playback mode, DRM mode information etc., the Callback Function is registered. When the relevant Event is occurred, the relevant Callback Function gets called asynchronouly, Invoked during playback.

void setListener(AVPlayPlaybackCallback playbackCallback);

Since : 1.0

Parameters:

  • playbackCallback: AVPlayPlaybackCallback

Constraint

  • To be called in this state - "IDLE"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


var listener = {
    onbufferingstart: function() {
        console.log("Buffering start.");
    },
    onbufferingprogress: function(percent) {
        console.log("Buffering progress percent : " + percent);
    },
    onbufferingcomplete: function() {
        console.log("Buffering complete.");
    },
    oncurrentplaytime: function(currentTime) {
        console.log("Current Playtime : " + currentTime);
    },
    onbufferingcomplete: function() {
        console.log("Buffering complete.");
    },
    onevent: function(eventType, eventData) {
        console.log("event type error : " + eventType + ", data: " + eventData);
    },
    onerror: function(eventType) {
        console.log("event type error : " + eventType);
    },
    onsubtitlechange: function(duration, text, data3, data4) {
        console.log("Subtitle Changed.");
    },
    ondrmevent: function(drmEvent, drmData) {
        console.log("DRM callback: " + drmEvent + ", data: " + drmData);
    },
    onstreamcompleted: function() {
        console.log("Stream Completed");
    }
}

webapis.avplay.setListener(listener);
setDrm
This method updates DRM information, such as SetProperties etc. It changes the DRM mode, and runs the Control Feature. Every DRM has difference between AVPlayDrmOperation and jsonParam

Any setDrm(AVPlayDrmType drmType, AVPlayDrmOperation drmOperation, DOMString jsonParam);

Since : 1.0

Privilege level: public

Privilege: http://developer.samsung.com/privilege/drmplay

Parameters

  • drmType: AVPlayDrmType
    "PLAYREADY", "VERIMATRIX"
  • drmOperation: AVPlayDrmOperation
    "SetProperties"
  • jsonParam: DOMString

Return value:

any

Constraint

  • To be called in these states - "IDLE", "PAUSED"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


Support the All DRM

//Example of PlayReady
var drmParam = new Object();
drmParam.LicenseServer = "http://license.company.com";
drmParam.CustomData = "mycustom";
playerObj.setDrm("PLAYREADY", "SetProperties", JSON.stringify(drmParam));
setSoundAnalysisListener
This method gets the analysis result of the playing Audio's Spectrum is called in a cycle of 30ms by using the CallbackFunction. It can be used in the Equalizer effect video or in the App for PartyTV. Bands return in 31 Arrays, and among the Bands Array, the Bands[14]~Bands[18] value is the area that occupies the Sound's effect most.

void setSoundAnalysisListener(AVPlaySoundAnalysisCallback soundAnalysisCallback);

Since : 1.0

Parameters:

  • soundAnalysisCallback: AVPlaySoundAnalysisCallback

Constraint

  • To be called in this state - "IDLE"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.setSoundAnalysisListener(soundAnalysisListener);

var soundAnalysisListener = function (dataArray) {
    var barHeight = 0;
    var absValue = 0;
    var threshold = 70;
    for (var i = 0; i < dataArray.length; i++) {
        absValue = Math.abs(dataArray[i]);
        if (absValue > threshold) {
            barHeight = Main.barContainerHeight;
        }
        else {
            barHeight = Math.round((absValue/threshold) * Main.barContainerHeight);
        }
        if (barHeight == 0) barHeight = 1;
        document.getElementById('frequencyBar' + i).style.height = barHeight + 'px';
    }
    console.log("Sound analysis: " + dataArray.toString());
}
unsetSoundAnalysisListener
This method unregister the soundAnalysisListener callback.

void unsetSoundAnalysisListener();

Since : 1.0

Constraint

  • To be called in this state - "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.unsetSoundAnalysisListener();
setSilentSubtitle
This method is used in the case of Stream with Subtitle when you want to show or hide the Subtitle. In the case of ExternalSubtitle, when the setExternalSubtitlePath Function is called, it is shown by default even if the setSilentSubtitle is not called

void setSilentSubtitle(bool onoff);

Since : 1.0

Parameters:

  • onoff: false Subtitle is shown. true : It hides the playing Subtitle.

Constraint

  • To be called in these states - "PAUSE", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.setSilentSubtitle(true);
setExternalSubtitlePath
This method is used in the case of Stream that uses External Subtitle, you should put the Local URI having Subtitle File. In the case of URL, you should put the Local URL after downloading it by using the DOWNLOAD WebApi

void setExternalSubtitlePath(DOMString pFilePath);

Since : 1.0

Parameters:

  • pFilePath: URI of Local File with Subtitle

Constraint

  • To be called in these states - "IDLE" , "PAUSE"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.setExternalSubtitlePath(uri);
setSubtitlePosition
This method is used for matching the A/V and sync when you play the ExternalSubtitle.

void setSubtitlePosition(unsigned long position);

Since : 1.0

Parameters:

  • position: The Subtitle output's timing is adjusted as much as the inputted time. (Positive, Negative)

Constraint

  • To be called in this state - "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.setSubtitlePosition(position_millisec,);
setDisplayMethod
This method sets the Video Screen’s Mode within the given DISPLAY area.

void setDisplayMethod(AVPlayDisplayMode displayMode);

Since : 1.0

Parameters:

  • displayMode: e.g. PLAYER_DISPLAY_MODE_FULL_SCREEN

Constraint

  • To be called in this state - "IDLE"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_FULL_SCREEN");
setSelectTrack
This method is used in the case of Multi Audio/Subtitle and when you want to change the Audio& Subtitle while playing. In the case of Video, it can’t be used.

void setSelectTrack(AVPlayStreamType trackType, long trackIndex);

Since : 1.0

Parameters:

  • trackType: It may be AUDIO or TEXT value.
  • trackIndex: It sets the index value of the AVPlayStreamInfo obtained through the webapis.avplay.getTrackInfo Function.

Constraint

  • To be called in these states - "PAUSE", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.setSelectTrack(Type, index); 
getCurrentStreamInfo
This method gets the currently playing Stream’s Video, Audio, Subtitle information. It informs that some Stream is playing.

AVPlayCurrentStreamInfo getCurrentStreamInfo();

Since : 1.0

Return value:

AVPlayCurrentStreamInfo structure containing tracktype, extraInfo and Index of current stream

Constraint

To be called in this state - "PLAYING"

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 contain an invalid value.

    • 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 + '';
}    
getTotalTrackInfo
This method gets the currently playing Stream’s information.

AVPlayStreamInfo[] getTotalTrackInfo();

Since : 1.0

Return value:

AVPlayStreamInfo structure containing tracktype, extraInfo and Index of current stream

Constraint

  • To be called in these states - "READY", "PLAYING"

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 contain an invalid value.

    • 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 specific Feature in the HTTP, MMS & Streaming Engine (Smooth Streaming, HLS, DASH, DivX Plus Streaming, Widevine). When special setting is required in Streaming Engine for the Start Bitrate setting &specific CP, the CUSTOM_MESSAGE Property can be set

void setStreamingProperty(AVPlayStreamingPropertyType propertyType, Any propparam);

Since : 1.0

Parameters:

  • propertyType: "COOKIE", "USER_AGENT", "PREBUFFER_MODE", "ADAPTIVE_INFO", "SET_MODE_3D", "SET_MODE_4K", "HD_AUDIO", "WIDEVINE"
  • propparam: Value according to the propertyType. e.g. "ADAPTIVE_INFO" PropetyTypes are "BITRATES","CUSTOM_MESSAGE", "AD_MODE", "STARTBITRATE", "START_TIME", "FAST_START", "SKIPBITRATE".

Constraint

  • To be called in these states - "IDLE"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


// Smooth Streaming example:
webapis.avplay.setStreamingProperty("ADAPTIVE_INFO", "|BITRATES=" + 50000 + '~' + $('#BITRATE_TO').val() + '|STARTBITRATE=' + $('#START_BITRATE').val() + '|STARTBITRATE=' + $('#START_BITRATE').val() + '|SKIPBITRATE=' + $('#SKIP_BITRATE').val()); //Note: streaming properties would be different for different kinds of streaming e.g. http, hls, dash etc. //Widevine : webapis.avplay.setStreamingProperty
("WIDEVINE","DEVICE_ID=null|DEVICET_TYPE_ID=60|DRM_URL=https://~~~|I_SEEK=TIME|CUR_TIME=PTS|PORTAL=~~");
getStreamingProperty
This method gets the Specific Property value is obtained through the Streaming Engine (Smooth Streaming, HLS, DASH, DivX Plus Streaming, Widevine).

Any getStreamingProperty(AVPlayStreamingPropertyType propertyType);

Since : 1.0

Parameters:

Return value:

Any It returns the value according to the Property decided to obtain

Constraint

  • To be called in these states - "PAUSE" "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


var text = 'getStreamingProperty: 
'; text += 'IS_LIVE: ' + Player.getStreamingProperty("IS_LIVE") + '<br />'; text += 'AVAILABLE_BITRATE: ' + Player.getStreamingProperty("AVAILABLE_BITRATE") + '<br />'; // GET_LIVE_DURATION is available from 2016 TV text += 'GET_LIVE_DURATION: ' + Player.getStreamingProperty("GET_LIVE_DURATION") + '<br />'; text += 'CURRENT_BANDWITH: ' + Player.getStreamingProperty("CURRENT_BANDWITH") + '<br />'; console.log(text);

Code example:


//GET_LIVE_DURATION is available from 2016 TV
var startTime = webapis.avplay.getStreamingProperty("GET_LIVE_DURATION").split('|')[0];
var endTime = webapis.avplay.getStreamingProperty("GET_LIVE_DURATION").split('|')[1];

if(targetSeekTime > startTime && targetSeekTime < endTime) {
 webapis.avplay.seekTo(targetSeekTime);  //ms
}
getVersion
This method gets the version of avplay.

DOMString getVersion();

Since : 1.0

Return value:

DOMString current version

Constraint

  • To be called in these states - "NONE", "IDLE", "READY", "PAUSED", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


console.log("Module Version : " + webapis.avplay.getVersion());
suspend
It is used to go to background during multitasking use case.

void suspend();

Since : 1.0

Constraint

  • To be called in these states - "PAUSED", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


webapis.avplay.suspend();
restore
It is used to come to foreground during multitasking use case.

void restore(DOMString URL, long resumeTime, boolean bPrepare);

Since : 1.0

Parameters

  • URL: updated URL after suspend
  • resumeTime [optional]: Specifies the specific position value after suspend.
  • bPrepare [optional]: false skip the prepare. true prepare behaves aga internally

Constraint

  • To be called in these states - "PAUSED", "PLAYING"

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


document.addEventListener('visibilitychange', function() {
    if(document.hidden) {
        webapis.avplay.suspend();
        // Something you want to do when hide
    } else {
        if(Current content is clean) {
            webapis.avplay.restore(url, resumeposition, false); 
        } else if(Current content is using Drm) {
            webapis.avplay.restore(url, resumeposition, true); 
            webapis.avplay.setDrm("","",""); // Fill out your DRM info.
            Player.prepareAsync(function() {
                Player.play();
            });
        }
        // Something you want to do when resume
    }
});

2.3. AVPlayPlaybackCallback

This callback interface defines subscriptions for any notification on the buffering, playback.

[Callback=FunctionOnly, NoInterfaceObject] interface AVPlayPlaybackCallback{
    void onbufferingstart();
    void onbufferingprogress(unsigned long percent);
    void onbufferingcomplete();
    void oncurrentplaytime(unsigned long currentTime );
    void onstreamcompleted();
    void onevent(long eventid, DOMString data );
    void onerror(long eventid);
    void ondrmevent(AVPlayDrmType type, long eventid);
    void onsubtitlechange(unsigned long duration, DOMString subtitles, unsigned long type, unsigned long attriCount, AVPlaySubtitleAttribute attributes);
};

Since : 1.0

Methods

onbufferingstart
This method gets called async while the buffering starts.

void onbufferingstart();

Since : 1.0

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


onbufferingstart: function() {
    console.log("Buffering start.");
}
onbufferingprogress
This method gets called async while the buffering is in progress.

void onbufferingprogress(unsigned long percent);

Since : 1.0

Parameters:

  • percent: unsigned long

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


onbufferingprogress: function(percent) {
    console.log("Buffering progress data : " + percent);
}
onbufferingcomplete
This method gets called async when the buffering gets completed.

void onbufferingcomplete();

Since : 1.0

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


onbufferingcomplete: function() {
    console.log("Buffering complete.");
}
oncurrentplaytime
This method gets called async to provide the current playback time.

void oncurrentplaytime(unsigned long currentTime );

Since : 1.0

Parameters:

  • currentTime: unsigned long

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


oncurrentplaytime: function(currentTime) {
    console.log("Current playtime: " + currentTime);
}
onstreamcompleted
This method gets called async while the playback gets completed.

void onstreamcompleted();

Since : 1.0

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


onstreamcompleted: function(currentTime) {
    console.log("Stream Completed");
}
onevent
This method gets called async when some kind of event (other event) received from the player.

void onevent(long eventid, DOMString data );

Since : 1.0

Parameters:

  • eventid: long
  • data: DOMString

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


onevent: function(eventType, eventData) {
    console.log("OnEvent Callback with eventType: " + eventType);
}
onerror
This method gets called when error event received from the player.

void onerror(long eventid);

Since : 1.0

Parameters:

  • eventid: long

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


onerror: function(eventType) {
    console.log("OnError Event Callback with eventType: " + eventType);
}
ondrmevent
This method gets aysnc called when the drm information notified from the player.

void ondrmevent(AVPlayDrmType type, long eventid);

Since : 1.0

Parameters:

  • type: AVPlayDrmType
  • eventid: long

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


ondrmevent: function(drmEvent, drmData) {
    console.log("DRM callback: " + drmEvent + ", data: " + drmData);
}  
onsubtitlechange
This method gets called async when the subtitle is updated.

void onsubtitlechange(unsigned long duration, DOMString subtitles, unsigned long type, unsigned long attriCount, AVPlaySubtitleAttribute attributes);

Since : 1.0

Parameters:

  • duration: unsigned long
  • subtitles: DOMString
  • type: unsigned long
  • attriCount: unsigned long
  • attributes: AVPlaySubtitleAttribute

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


onsubtitlechange: function(duration, text, data3, data4) {
    console.log("Subtitle Changed.");
}

2.4. AVPlaySoundAnalysisCallback

This callback interface defines subscriptions for any notification for sound Analysis.

[Callback=FunctionOnly, NoInterfaceObject] interface AVPlaySoundAnalysisCallback{ 
	BasePlatformException ongetexception();
    void onsetexception(BasePlatformException err);
	long[] ongetbandsarray();
};

Since : 1.0

Methods

ongetexception
This method gets called aysnc if any exception occurs in sound analysis.

BasePlatformException ongetexception();

Since : 1.0

Return value:

BasePlatformException

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 contain an invalid value.

    • with error type UnknownError in any other error case.

onsetexception
This method specifies subscriptions for any notification for sound Analysis.
 

void onsetexception(BasePlatformException err);

Since : 1.0

Parameters:

  • err: BasePlatformException

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 contain an invalid value.

    • with error type UnknownError in any other error case.

ongetbandsarray
This method returns the Band Array[32] having sound effect information.

long[] ongetbandsarray();

Since : 1.0

Return value:

long

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 contain an invalid value.

    • with error type UnknownError in any other error case.

Error Code from PLAYER Meaning of error scenario
PLAYER_ERROR_CONNECTION_FAILED This error would be generated, when after several re-tries connection to given content server is not possible.
PLAYER_ERROR_GENEREIC If PLAYER fails to create display window, this error would be posted.
PLAYER_ERROR_INVALID_OPERATION If player creation fails, this error would be generated.
PLAYER_ERROR_INVALID_PARAMETER If PLAYER finds any parameter (which caller is trying to configure on it) to be incorrect, this error would be generated.
PLAYER_ERROR_INVALID_STATE This error would be generated when any API called in a state where it is not suggested to be called. Refer to APIs description for valid states.
PLAYER_ERROR_INVALID_URI Generated when input URI is invalid format.
PLAYER_ERROR_NO_SUCH_FILE If PLAYER finds that given location of content is not correct, this error would be posted.
PLAYER_ERROR_NONE This means operation has successfully completed
PLAYER_ERROR_NOT_SUPPORTED_FILE This error would be generated, when required multimedia components are not available to play the given content.
PLAYER_ERROR_SEEK_FAILED This would also be generated in case when SEEK operation executed in wrong states (for example, previous seek was on-going and new seek issued). Also, this would be generated if player could not perform seek operation.
Event Name from PLAYER Meaning of events
PLAYER_MSG_NONE If some message is posted by any multimedia component but that is not recognized by PLAYER, in such case this message would be posted.
PLAYER_MSG_RESOLUTION_CHANGED During adaptive streaming playback, when resolution of video changes, this message is posted.
PLAYER_MSG_RENDER_DONE This message would be posted when rendering of frames starts. [TBD: player.c does not support this as of now]
PLAYER_MSG_BITRATE_CHANGE During adaptive streaming playback, change in BW specific URL based on network heuristics is reported through this message. Current BW is also notified in this message.
PLAYER_MSG_FRAGMENT_INFO All the details of downloaded fragment are updated to caller through this message in callback function. Following information would be updated:
--fragment number, stream-type, current bitrate, download time for this fragment
PLAYER_SPARSE_TRACK_DETECT During adaptive streaming playback, when sparse track is encountered, player will inform to caller through this event.
PLAYER_STREAMING_EVENT Any type of streaming data that caller needs would be posted through this event
PLAYER_MSG_HTTP_ERROR_CODE Describe the detailed HTTP network situation information.

module AVPlay {
    enum AVPlayPlayerState { "NONE", "IDLE", "READY", "PLAYING", "PAUSED"};

    enum AVPlayDisplayMode { "PLAYER_DISPLAY_MODE_LETTER_BOX", "PLAYER_DISPLAY_MODE_ORIGIN_SIZE", "PLAYER_DISPLAY_MODE_FULL_SCREEN", "PLAYER_DISPLAY_MODE_CROPPED_FULL",
    "PLAYER_DISPLAY_MODE_ZOOM_HALF", "PLAYER_DISPLAY_MODE_ZOOM_THREE_QUARTERS", "PLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER", "PLAYER_DISPLAY_MODE_DST_ROI", 
    "PLAYER_DISPLAY_MODE_ZOOM_16_9", "PLAYER_DISPLAY_MODE_ZOOM", "PLAYER_DISPLAY_MODE_ZOOM_CUSTOM" };

    enum AVPlayStreamingPropertyType { "COOKIE", "USER_AGENT", "PREBUFFER_MODE" , "ADAPTIVE_INFO", "SET_MODE_3D", "SET_MODE_4K", "HD_AUDIO", "WIDEVINE" };

    enum AVPlayDrmType {"PLAYREADY", "VERIMATRIX", "WIDEVINE_CLASSIC", "SECUREMEDIA", "SDRM"};

    enum AVPlayDrmOperation { "SetProperties", "InstallLicense", "GetUID", "Initialize", "Finalize" };

    enum AVPlayStreamType { "VIDEO", "AUDIO", "TEXT" };

    dictionary AVPlayStreamInfo {
        unsigned long index;
        AVPlayStreamType type;
        DOMString extra_info;
    };

    [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( long x, long y, long width, long height );
        void play();
        void seekTo(long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
        void stop();
        AVPlayPlayerState getState();
        void pause();
        void jumpForward(long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
        void jumpBackward( long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback );
        unsigned long getDuration();
        unsigned long getCurrentTime();
        bool setTimeoutForBuffering(unsigned long Milliseconds);
        void setBufferingParam(AVPlayBufferingType bufferingType, AVPlayBufferSizeUnit bufferingunit, int amount );
        void setSpeed(long playbackSpeed);
        void setListener(AVPlayPlaybackCallback playbackCallback);
        Any setDrm(AVPlayDrmType drmType, AVPlayDrmOperation drmOperation, DOMString jsonParam);
        void setSoundAnalysisListener(AVPlaySoundAnalysisCallback soundAnalysisCallback);
        void unsetSoundAnalysisListener();
        void setSilentSubtitle(bool onoff);
        void setExternalSubtitlePath(DOMString pFilePath);
        void setSubtitlePosition(unsigned long position);
        void setDisplayMethod(AVPlayDisplayMode displayMode);
        void setSelectTrack(AVPlayStreamType trackType, long trackIndex);
        AVPlayCurrentStreamInfo getCurrentStreamInfo();
        AVPlayStreamInfo[] getTotalTrackInfo();
        void setStreamingProperty(AVPlayStreamingPropertyType propertyType, Any propparam);
        Any getStreamingProperty(AVPlayStreamingPropertyType propertyType);
        DOMString getVersion();
        void suspend();
        void restore(DOMString URL, long resumeTime, boolean bPrepare);
    };

    [Callback=FunctionOnly, NoInterfaceObject] interface AVPlayPlaybackCallback{
        void onbufferingstart();
        void onbufferingprogress(unsigned long percent);
        void onbufferingcomplete();
        void oncurrentplaytime(unsigned long currentTime );
        void onstreamcompleted();
        void onevent(long eventid, DOMString data );
        void onerror(long eventid);
        void ondrmevent(AVPlayDrmType type, long eventid);
        void onsubtitlechange(unsigned long duration, DOMString subtitles, unsigned long type, unsigned long attriCount, AVPlaySubtitleAttribute attributes);
    };

    [Callback, NoInterfaceObject] interface AVPlaySoundAnalysisCallback{
        BasePlatformException ongetexception();
        void onsetexception(BasePlatformException err);
        long[] ongetbandsarray();
    };
};