To use Samsung Product API,
<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>
Should be loaded in index.html
For RTP/UDP steaming case use B2BAVPlay library,
<script type="text/javascript" src="$B2BAPIS/b2bapis/b2bavplay.js"></script>
Should be loaded in index.html, This library file required from Smart Signage 3.0
Since : 2.4
Product : Smart Signage
Interface | Method |
---|---|
AVPlayManagerObject | |
AVPlayManager | void open(); void close(); void prepare(); void prepareAsync(opitional SuccessCallback? successCallback, optional ErrorCallback? errorCallback); void setDisplayRect(unsigned long x, unsigned long y, unsigned long width, unsigned 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(); void setTimeoutForBuffering(unsigned long seconds); void setBufferingParam(AVPlayBufferOption option, AVPlayBufferSizeUnit unit, unsigned long amount); void setSpeed(long playbackSpeed); void setListener(AVPlayPlaybackCallback playbackCallback); DOMString setDrm(AVPlayDrmType drmType, AVPlayDrmOperation drmOperation, DOMString jsonParam); void setDisplayMethod(AVPlayDisplayMode displayMode); void setDisplayRotation(AVPlayDisplayRotation DisplayRotation); void setVideoStillMode(boolean bStillMode); void setStreamingProperty(AVPlayStreamingPropertyType propertyType, DOMString propertyParam); DOMString getStreamingProperty(AVPlayStreamingPropertyType propertyType); DOMString getVersion(); void suspend(); void restore(DOMString URL, optional unsigned optional long? resumeTime, optional boolean? bPrepare) ; void restoreAsync(DOMString URL, optional unsigned optional long? resumeTime, optioanl optional boolean? bPrepare, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) ; |
AVPlayPlaybackCallback | void onbufferingstart(); void onbufferingprogress(unsigned long percent); void onbufferingcomplete(); void oncurrentplaytime(unsigned long currentTime ); void onstreamcompleted(); void onevent(AVPlayEvent eventid, DOMString data ); void onerror(AVPlayError eventid); void ondrmevent(AVPlayDrmType type, drmData data); |
enum AVPlayPlayerState {
"NONE",
"IDLE",
"READY",
"PLAYING",
"PAUSED"
};
Since : 2.4
The following values are supported
enum AVPlayDisplayMode {
"PLAYER_DISPLAY_MODE_LETTER_BOX",
"PLAYER_DISPLAY_MODE_FULL_SCREEN",
"PLAYER_DISPLAY_MODE_AUTO_ASPECT_RATIO"
};
Since : 2.4
The following values are supported
enum AVPlayBufferOption {
"PLAYER_BUFFER_FOR_PLAY",
"PLAYER_BUFFER_FOR_RESUME"
};
Since : 2.4
The following values are supported
enum AVPlayBufferSizeUnit {
"PLAYER_BUFFER_SIZE_IN_BYTE",
"PLAYER_BUFFER_SIZE_IN_SECOND"
};
Since : 2.4
The following values are supported
Remark :
"PLAYER_BUFFER_SIZE_IN_BYTE" property has been deprecated from Tizen version 5.0
enum AVPlayStreamingPropertyType {
"COOKIE",
"USER_AGENT",
"PREBUFFER_MODE",
"ADAPTIVE_INFO",
"SET_MODE_4K",
"PROPERTY_HD_AUDIO",
"LISTEN_SPARSE_TRACK",
"IS_LIVE",
"AVAILABLE_BITRATE",
"GET_LIVE_DURATION",
"CURRENT_BANDWIDTH",
"WIDEVINE",
"USE_VIDEOMIXER",
"SET_MIXEDFRAME"
};
Since : 2.4
The following values are supported
Remark :
"GET_LIVE_DURATION" is available since Tizen version 2.4.
"WIDEVINE" property has been deprecated from Tizen version 4.0.
"PROPERTY_HD_AUDIO" property has been deprecated from Tizen version 2.4.
"SET_VR360_MODE" property has been deprecated from Tizen version 5.0.
"SET_MODE_4K" property has been deprecated from Tizen version 5.0.
enum AVPlayDrmType {
"LYNK"
};
Since : 2.4
The following values are supported
enum AVPlayDrmOperation {
"Initialize"
};
Since : 2.4
The following values are supported
enum AVPlayError{
"PLAYER_ERROR_NONE",
"PLAYER_ERROR_INVALID_PARAMETER",
"PLAYER_ERROR_NO_SUCH_FILE",
"PLAYER_ERROR_INVALID_OPERATION",
"PLAYER_ERROR_SEEK_FAILED",
"PLAYER_ERROR_INVALID_STATE",
"PLAYER_ERROR_NOT_SUPPORTED_FILE",
"PLAYER_ERROR_INVALID_URI",
"PLAYER_ERROR_CONNECTION_FAILED",
"PLAYER_ERROR_GENEREIC"
};
Since : 2.4
The following values are supported
enum AVPlayEvent {
"PLAYER_MSG_NONE",
"PLAYER_MSG_RESOLUTION_CHANGED",
"PLAYER_MSG_BITRATE_CHANGE",
"PLAYER_MSG_FRAGMENT_INFO",
"PLAYER_SPARSE_TRACK_DETECT",
"PLAYER_STREAMING_EVENT",
"PLAYER_MSG_HTTP_ERROR_CODE",
"PLAYER_MSG_DRM_CHALLENGE_DATA",
"PLAYER_MSG_RENDER_DONE",
"PLAYER_MSG_STREAM_INFO_READY"
};
Since : 2.4
The following values are supported
enum AVPlayDisplayMode {
"PLAYER_DISPLAY_ROTATION_90",
"PLAYER_DISPLAY_ROTATION_180",
"PLAYER_DISPLAY_ROTATION_270",
"PLAYER_DISPLAY_ROTATION_0"
};
Since : 2.4
The following values are supported
[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 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() ;
void setTimeoutForBuffering(unsigned long seconds);
void setBufferingParam(AVPlayBufferOption option, AVPlayBufferSizeUnit unit, unsigned long amount);
void setSpeed(long playbackSpeed) ;
void setListener(AVPlayPlaybackCallback playbackCallback) ;
DOMString setDrm(AVPlayDrmType drmType, AVPlayDrmOperation drmOperation, DOMString jsonParam) ;
void setDisplayMethod(AVPlayDisplayMode displayMode) ;
void setDisplayRotation(AVPlayDisplayRotation DisplayRotation);
void setVideoStillMode(boolean bStillMode);
void setStreamingProperty(AVPlayStreamingPropertyType propertyType, DOMString propertyParam) ;
DOMString getStreamingProperty(AVPlayStreamingPropertyType propertyType) ;
DOMString getVersion() ;
void suspend() ;
void restore(DOMString URL, optional unsigned long? resumeTime, optional boolean? bPrepare);
void restoreAsync(DOMString URL, optional unsigned long? resumeTime, optioanl boolean? bPrepare, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
};
open
void open(DOMString url);
Product : Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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:
try {
webapis.avplay.open(url);
}
catch (e)
{
console.log(e);
}
close
void close();
Product : Smart Signage
Constraint
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
try {
webapis.avplay.close();
}
catch (e)
{
console.log(e);
}
prepare
void prepare();
Product : Smart Signage
Constraint
Exceptions:
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, for any other error.
Code example:
try {
webapis.avplay.prepare();
}
catch (e)
{
console.log(e);
}
prepareAsync
void prepareAsync(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Product : Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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.prepareAsync(successCallback, errorCallback);
setDisplayRect
void setDisplayRect( unsigned long x, unsigned long y, unsigned long width, unsigned long height );
Product : Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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:
try {
webapis.avplay.setDisplayRect(0, 0, 1920, 1080);
}
catch (e)
{
console.log(e);
}
play
void play();
Product : Smart Signage
Constraint
Exceptions:
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, for any other error.
Code example:
try {
webapis.avplay.play();
}
catch (e)
{
console.log(e);
}
Remark :
Adaptive streaming using TS container (for e.g. HLS) with audio sample rate changing across variants may cause audio loss.seekTo
void seekTo(long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Product : Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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:
try {
webapis.avplay.seekTo(10000,successCallback, errorCallback);
}
catch (e)
{
console.log(e);
}
// for live cases, get the live duration as :
var StartTime = webapis.avplay.getStreamingProperty("GET_LIVE_DURATION").split('|')[0];
var EndTime = webapis.avplay.getStreamingProperty("GET_LIVE_DURATION").split('|')[1];
// seekpoint must be between StartTime and Endtime.
stop
void stop();
Product : Smart Signage
Constraint
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
try {
webapis.avplay.stop();
}
catch (e)
{
console.log(e);
}
getState
AVPlayPlayerState getState();
Product : Smart Signage
Return value:
AVPlayPlayerState "NONE", "IDLE", "READY", "PLAYING", "PAUSED".Constraint
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
var BRet = webapis.avplay.getState();
pause
void pause();
Product : Smart Signage
Constraint
Exceptions:
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 InvalidAccessError, if this API couldn't operate at the moment. (E.g. During the async operation such as seekTo, etc.)
with error type UnknownError, for any other error.
Code example:
try {
webapis.avplay.pause();
}
catch (e)
{
console.log(e);
}
jumpForward
void jumpForward(long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Product :Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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.jumpForward(5000, successCallback, errorCallback);
jumpBackward
void jumpBackward( long milliseconds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback );
Product : Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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.jumpBackward(5000, successCallback, errorCallback);
getDuration
unsigned long getDuration();
Product : Smart Signage
Return value:
unsigned long number Duration, in millisecondsConstraint
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
duration = calcPlaytime(webapis.avplay.getDuration());
function calcPlaytime(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
unsigned long getCurrentTime();
Product : Smart Signage
Return value:
unsigned long number Current playback time, in milliseconds.Constraint
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
var CurrentPlayTime = webapis.avplay.getCurrentTime();
setTimeoutForBuffering
void setTimeoutForBuffering(unsigned long seconds);
Product : Smart Signage
Parameters
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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.setTimeoutForBuffering(10);
setBufferingParam
void setBufferingParam(AVPlayBufferOption option, AVPlayBufferSizeUnit unit, unsigned long amount);
Product : Smart Signage
Parameters
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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:
// For the initial buffering
webapis.avplay.setBufferingParam("PLAYER_BUFFER_FOR_PLAY","PLAYER_BUFFER_SIZE_IN_SECOND", 5); // 5 is in seconds
// For the rebuffering
webapis.avplay. setBufferingParam("PLAYER_BUFFER_FOR_RESUME","PLAYER_BUFFER_SIZE_IN_SECOND", 15); // 15 is in seconds
Remark:
unit "PLAYER_BUFFER_SIZE_IN_BYTE" has been deprecated from Tizen version 5.0setSpeed
void setSpeed(long playbackSpeed);
Product :Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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:
try {
webapis.avplay.setSpeed(2);
}
catch (e)
{
console.log(e);
}
setListener
void setListener(AVPlayPlaybackCallback playbackCallback);
Product : Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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 UnknownError, for any other error.
Code example:
var Listener = {
onbufferingstart: function() {
console.log("Buffering start.");
},
onbufferingprogress: function(percent) {
console.log("Buffering progress data : " + data1);
},
onbufferingcomplete: function() {
console.log("Buffering complete.");
},
oncurrentplaytime: function(currentTime) {
console.log("Current Playtime : " + data1);
},
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);
},
ondrmevent: function(drmEvent, drmData) {
console.log("DRM callback: " + drmEvent + ", data: " + drmData);
},
onstreamcompleted: function() {
console.log("Stream Completed");
}
}
webapis.avplay.setListener(Listener);
setDrm
DOMString setDrm(AVPlayDrmType drmType, AVPlayDrmOperation drmOperation, DOMString jsonParam);
Product : Smart Signage
Privilege level: Public
Privilege: http://developer.samsung.com/privilege/drmplay
Parameters
Return value:
DRMStringConstraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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 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.
with error type UnknownError, for any other error.
Examples of exception scenarios include an invalid DRM session, or failure to create the underlying DRM module or configuration. In these scenarios, an exception is thrown and the method call returns FALSE.
Code example:
// LYNK DRM example:
var Player = webapis.avplay;
var url =”udp://Multicast_IP_Address:Port”; // 'rtp://Multicast_IP_Address:Port'
var listener =function() {
onevent: function(eventType, eventData) {
console.log("event type error : " + eventType + ", data: " + eventData);
},
ondrmevent: function(drmEvent, drmData) {
console.log("DRM callback: " + drmEvent + ", data: " + drmData);
},
onerror: function(eventType) {
console.log("event type error : " + eventType);
}
}
var drmParam = {
LYNKServer:"NONE", // No LYNK server required
type: "1"
};
try {
Player.open(url);
Player.setDisplayRect(0, 0, 1920, 1080);
Player.setListener(listener);
Player.setDrm("LYNK", "Initialize", JSON.stringify(drmParam));
Player.prepareAsync(function() {
Player.play();
});
} catch (error) {
console.log("Error name = "+ error.name + ", Error message = " + error.message);
}
Remark :
'LYNK TYPE-1 DRM supported. ONLY UDP/RTP streaming protocol supported. B2BAVPlay.js library file should be included in web application to play multicast streaming. This API start supported from Smart Signage 3.0.setDisplayMethod
void setDisplayMethod(AVPlayDisplayMode displayMode);
Product : Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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.setDisplayMethod("PLAYER_DISPLAY_MODE_FULL_SCREEN");
setDisplayRotation
void setDisplayRotation(AVPlayDisplayRotation displayRotation);
Product : Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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");
setVideoStillMode
void setVideoStillMode(boolean bStillMode);
Product : Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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.setVideoStillMode("true");
// For seamless Example-
var player1 = webapis.avplaystore.getPlayer();
var player2 = webapis.avplaystore.getPlayer();
listener2 = {
onstreamcompleted: function() {
player2.setVideoStillMode("true");
player2.stop();
player1.open(“http://test.com/test1.mp4”);
player1.setListener(listener1);
player1.setDisplayRect(0, 0, 1920, 1080);
player1.prepare();
player1.setVideoStillMode("false");
player1.play();
};
listener1 = {
onstreamcompleted: function() {
player1.setVideoStillMode("true");
player1.stop();
player2.open(“http://test.com/test2.mp4”);
player2.setListener(Listener2);
player2.setDisplayRect(0, 0, 1920, 1080);
player2.prepare();
player2.setVideoStillMode("false");
player2.play();
};
try
{
player1.open(“http://test.com/test1.mp4”);
player1.setListener(listener1);
Player1.setDisplayRect(0, 0, 1920, 1080);
player1.avplay.prepare();
player1.avplay.play();
}
catch (e)
{
console.log(e);
}
Remark :
This API is supported only for http streaming (.mp4). Hence webapis.js must be included for this method. b2bavplay.js doesn’t support this.setStreamingProperty
void setStreamingProperty(AVPlayStreamingPropertyType propertyType, DOMString propertyParam);
Product : Smart Signage
Parameters:
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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:
//Smooth Streaming example:
var BitRateString = "BITRATES=5000~10000|STARTBITRATE=HIGHEST|SKIPBITRATE=LOWEST"; webapis.avplay.setStreamingProperty("ADAPTIVE_INFO", BitRateString);
//Prebuffer mode example:
webapis.avplay.setStreamingProperty("PREBUFFER_MODE", time_in_miliseconds);
Player1 => Playback of Main Content
Player2 => Playback of advertisement (Buffered the ad content before playback).
Player1 = webapis.avplaystore.getPlayer();
Player2 = webapis.avplaystore.getPlayer();
Player1.open('http://www.example.com/example_1.mp4');
Player1.setDisplayRect(x, y, width, height);
Player1.prepare();
Player1.play();
Player2.open('http://www.example.com/example_2.mp4');
Player2.setStreamingProperty("PREBUFFER_MODE", "5000");
Player2.setDisplayRect(x, y, width, height);
Player2.prepare();
Player1.stop();
Player2.play();
//User-agent example:
webapis.avplay.setStreamingProperty("USERAGENT", "samsungsmooth-agent/1.1");
//Setting resolution information for HLS/DASH
webapis.avplay.setStreamingProperty("ADAPTIVE_INFO", "FIXED_MAX_RESOLUTION=7680X4320");
Remark :
"WIDEVINE" unit has been deprecated from Tizen version 4.0getStreamingProperty
DOMString getStreamingProperty(AVPlayStreamingPropertyType propertyType);
Product : Smart Signage
Parameters:
Return value:
DOMString Property valueConstraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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:
var Text = 'AVAILABLE_BITRATE: ' + webapis.avplay.getStreamingProperty ("AVAILABLE_BITRATE") ;
Text += 'CURRENT_BANDWIDTH: ' + webapis.avplay.getStreamingProperty ("CURRENT_BANDWIDTH") + '';
Text += 'IS_LIVE: ' + webapis.avplay.getStreamingProperty ("IS_LIVE") +'';
@endparblock @code
var StartTime = webapis.avplay.getStreamingProperty("GET_LIVE_DURATION").split('|')[0];
var EndTime = webapis.avplay.getStreamingProperty("GET_LIVE_DURATION").split('|')[1];
if (StartTime > targetSeekTime)
{
if (EndTime < targetSeekTime)
{
webapis.avplay.seekTo(targetSeekTime); //ms
}
}
Remark :
GET_SERVER_TIME_SCALE and GET_ABSOLUTE_SERVER_TIME: Supported for Smooth Streaming only.getVersion
DOMString getVersion();
Product :Smart Signage
Return value:
DOMString string current versionConstraint
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
var Version = webapis.avplay.getVersion();
suspend
void suspend();
Product : Smart Signage
Constraint
Exceptions:
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, for any other error.
Code example:
document.addEventListener("visibilitychange", function()
{
if(document.hidden)
{
// Something you want to do when application is paused.
console.log("lifecycle [pause]");
webapis.avplay.suspend();
}
else
{
// Something you want to do when application is resumed.
console.log("lifecycle [resume]");
webapis.avplay.restore();
}
});
restore
void restore(DOMString URL, optional unsigned long? resumeTime, optional boolean? bPrepare);
Product : Smart Signage
Parameters
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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:
document.addEventListener("visibilitychange", function()
{
if(document.hidden)
{
// Something you want to do when application is paused
console.log("lifecycle [pause]");
webapis.avplay.suspend();
}
else
{
// Something you want to do when application is resumed
console.log("lifecycle [resume]");
webapis.avplay.restore(url, 0, false);
}
});
restoreAsync
void restoreAsync(DOMString URL, optional unsigned long? resumeTime, optioanl boolean? bPrepare, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Product : Smart Signage
Parameters
Constraint
Exceptions:
with error type TypeMismatchError, if an input parameter is not compatible with its 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:
document.addEventListener("visibilitychange", function()
{
if(document.hidden)
{
// Something you want to do when application is paused
console.log("lifecycle [pause]");
webapis.avplay.suspend();
}
else
{
// Something you want to do when application is resumed
console.log("lifecycle [resume]");
try
{
var successCallback = function()
{
console.log("success");
}
var errorCallback = function(err)
{
throw new Error('Error:' + err.name);
}
webapis.avplay.restoreAsync(url, 0, false, successCallback, errorCallback);
}
catch (e)
{
console.log(e);
}
}
});
[Callback=FunctionOnly, NoInterfaceObject] interface AVPlayPlaybackCallback{
void onbufferingstart();
void onbufferingprogress(unsigned long percent);
void onbufferingcomplete();
void oncurrentplaytime(unsigned long currentTime );
void onstreamcompleted();
void onevent(AVPlayEvent eventid, DOMString data );
void onerror(AVPlayError eventid);
void ondrmevent(AVPlayDrmType type, drmData data);
void onsubtitlechange(unsigned long duration, DOMString subtitles, unsigned long type, AVPlaySubtitleAttribute attributes);
};
onbufferingstart
void onbufferingstart();
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
onbufferingstart: function()
{
console.log("Buffering start.");
}
onbufferingprogress
void onbufferingprogress(unsigned long percent);
Parameters:
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
onbufferingprogress: function(percent)
{
console.log("Buffering progress data : " + percent);
}
onbufferingcomplete
void onbufferingcomplete();
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
onbufferingcomplete: function()
{
console.log("Buffering complete.");
}
oncurrentplaytime
void oncurrentplaytime(unsigned long currentTime );
Parameters:
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
oncurrentplaytime: function(currentTime)
{
console.log("Current playtime: " + currentTime);
}
onstreamcompleted
void onstreamcompleted();
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
onstreamcompleted: function(currentTime)
{
console.log("Stream Completed");
}
onevent
void onevent(AVPlayEvent eventid, DOMString data );
Parameters:
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
onevent: function(eventType, eventData)
{
console.log("OnEvent Callback with eventType: " + eventType);
}
onerror
void onerror(AVPlayError eventid);
Parameters:
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
onerror: function(eventType)
{
console.log("OnError Event Callback with eventType: " + eventType);
}
ondrmevent
void ondrmevent(AVPlayDrmType type, drmData data);
Parameters:
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
ondrmevent: function(drmType, drmData)
{
console.log("DRM callback, type: " + drmType + ", data: " + drmData);
if(drmData.name === 'Challenge')
{
var ChallengeData =
{
"NAME": drmData.name,
"SESSION_ID": drmData.session_id,
"CHALLENGE": drmData.challenge,
"CHALLENGE_LEN": drmData.challenge_len,
"SERV_URL": drmData.serverurl,
"SERV_URL_LEN": drmData.serverurl_len
}
// Use challenge data to get drm license.
}
else if (drmData.name === 'DrmError')
{
var ErrorInfo =
{
"NAME": drmData.name,
"ERROR_CODE": drmData.code,
"ERROR_MESSAGE": drmData.message // Generally, it's human readable message.
}
}
}
onsubtitlechange
void onsubtitlechange(unsigned long duration, DOMString subtitles, unsigned long type, AVPlaySubtitleAttribute attributes);
Parameters:
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type UnknownError, for any other error.
Code example:
onsubtitlechange: function(duration, text, data3, data4)
{
console.log("Subtitle Changed.");
}
module AVPlay {
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 AVPlayBufferOption {
"PLAYER_BUFFER_FOR_PLAY",
"PLAYER_BUFFER_FOR_RESUME"
};
enum AVPlayBufferSizeUnit {
"PLAYER_BUFFER_SIZE_IN_BYTE",
"PLAYER_BUFFER_SIZE_IN_SECOND"
};
enum AVPlayStreamingPropertyType {
"COOKIE",
"USER_AGENT",
"PREBUFFER_MODE",
"ADAPTIVE_INFO",
"SET_MODE_4K",
"PROPERTY_HD_AUDIO",
"LISTEN_SPARSE_TRACK",
"IS_LIVE",
"AVAILABLE_BITRATE",
"GET_LIVE_DURATION",
"CURRENT_BANDWIDTH",
"WIDEVINE"
};
enum AVPlayDrmType {
"PLAYREADY",
"VERIMATRIX",
"WIDEVINE_CDM"
};
enum AVPlayDrmOperation {
"SetProperties",
"InstallLicense",
"ProcessInitiator",
"GetUID",
"Initialize",
"Finalize",
"widevine_license_data",
"widevine_app_session",
"widevine_data_type"
};
enum AVPlayStreamType {
"VIDEO",
"AUDIO",
"TEXT"
};
enum AVPlayError{
"PLAYER_ERROR_NONE",
"PLAYER_ERROR_INVALID_PARAMETER",
"PLAYER_ERROR_NO_SUCH_FILE",
"PLAYER_ERROR_INVALID_OPERATION",
"PLAYER_ERROR_SEEK_FAILED",
"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_MSG_RESOLUTION_CHANGED",
"PLAYER_MSG_BITRATE_CHANGE",
"PLAYER_MSG_FRAGMENT_INFO",
"PLAYER_SPARSE_TRACK_DETECT",
"PLAYER_STREAMING_EVENT",
"PLAYER_MSG_HTTP_ERROR_CODE",
"PLAYER_MSG_DRM_CHALLENGE_DATA"
};
dictionary AVPlayStreamInfo {
unsigned long index;
unsigned long adaption_index;
unsigned long alternate_index;
AVPlayStreamType type;
DOMString extra_info;
};
dictionary AVPlaySubtitleAttribute {
DOMString attr_type;
long start_pos;
long stop_pos;
};
[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 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() ;
void setTimeoutForBuffering(unsigned long seconds);
void setBufferingParam(AVPlayBufferOption option, AVPlayBufferSizeUnit unit, unsigned long amount);
void setSpeed(long playbackSpeed);
void setListener(AVPlayPlaybackCallback playbackCallback);
DOMString setDrm(AVPlayDrmType drmType, AVPlayDrmOperation drmOperation, DOMString jsonParam);
DOMString getUID ( AVPlayDrmType drmType )
void setSoundAnalysisListener (AVPlaySoundAnalysisCallback soundAnalysisCallback);
void unsetSoundAnalysisListener();
void setSilentSubtitle(boolean onoff);
void setExternalSubtitlePath(DOMString filePath);
void setSubtitlePosition(long position);
void setDisplayMethod(AVPlayDisplayMode displayMode);
void setSelectTrack(AVPlayStreamType trackType, long trackIndex);
AVPlayStreamInfo getCurrentStreamInfo();
AVPlayStreamInfo[] getTotalTrackInfo();
void setStreamingProperty(AVPlayStreamingPropertyType propertyType, DOMString propertyParam);
DOMString getStreamingProperty(AVPlayStreamingPropertyType propertyType);
DOMString getVersion();
void suspend() ;
void restore(DOMString URL, unsigned long resumeTime, boolean bPrepare);
void restoreAsync(DOMString URL, optional unsigned optional long? resumeTime, optioanl optional boolean? bPrepare, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) ;
};
[Callback=FunctionOnly, NoInterfaceObject] interface AVPlayPlaybackCallback{
void onbufferingstart();
void onbufferingprogress(unsigned long percent);
void onbufferingcomplete();
void oncurrentplaytime(unsigned long currentTime );
void onstreamcompleted();
void onevent(AVPlayEvent eventid, DOMString data );
void onerror(AVPlayError eventid);
void ondrmevent(AVPlayDrmType type, drmData data);
void onsubtitlechange(unsigned long duration, DOMString subtitles, unsigned long type, AVPlaySubtitleAttribute attributes);
};
};