Difference between revisions of "Tizen Player"

From MSX - Wiki
Jump to navigation Jump to search
 
(104 intermediate revisions by the same user not shown)
Line 1: Line 1:
The Tizen player is the default player for Samsung TVs (2016+ models) that uses the Media Station X version '''0.1.128''' or higher. It works like a plugin and can be configured via the extended properties of a content item. Please see [[Extended Properties]] for more information. Additionally, you can interact with it using the <code>player:commit</code> actions. Please see [[Internal Actions]] for more information. Some extended properties are dynamic and can be changed via an action at runtime.
+
The Tizen player is used in Media Station X version '''0.1.128''' or higher for all Samsung TVs (2016+ models). In previous versions, the HTML5 player is used. The Tizen player works similar to the HTML5 player, but supports more video formats (e.g. 4k/8k formats) and can be configured via the [[Extended Properties]] of a content item to setup display, buffer, and/or stream settings. Additionally, you can interact with it using the <code>player:commit</code> actions to get the current stream information and/or to select a specific audio/text track. Please see [[#Runtime Usage]] for more information. Some extended properties are dynamic and can also be set via an action at runtime.  
  
Some extended properties are mapped to a corresponding Tizen (i.e. <code>AVPlay</code>) function. For more information, please visit: https://developer.samsung.com/smarttv/develop/api-references/samsung-product-api-references/avplay-api.html
+
Most of the extended properties are directly mapped to a corresponding Tizen (i.e. <code>AVPlay</code> API) function. For more information, please visit following links.
  
'''Note: All properties are reset if a new video/audio is played.'''
+
* <code>AVPlay</code> API: https://developer.samsung.com/smarttv/develop/api-references/samsung-product-api-references/avplay-api.html
 +
* Using <code>AVPlay</code>: https://developer.samsung.com/smarttv/develop/guides/multimedia/media-playback/using-avplay.html
 +
 
 +
'''Note: All properties are reset if a new video/audio is played. Please also note that you can still use the HTML5 player with a plugin (see [[Video/Audio Plugin#Examples]]). It should be mentioned here that setting the speed only works with the HTML5 player, because the <code>AVPlay</code> API does not support the required speed values.'''  
  
 
== Syntax ==
 
== Syntax ==
Line 22: Line 25:
 
| <code>tizen:buffer:timeout</code> || <code>{SECONDS}</code> || <code>"tizen:buffer:timeout": "20"</code> || <code>setTimeoutForBuffering({SECONDS});</code> || '''Yes''' || data-sort-value=128|'''0.1.128'''
 
| <code>tizen:buffer:timeout</code> || <code>{SECONDS}</code> || <code>"tizen:buffer:timeout": "20"</code> || <code>setTimeoutForBuffering({SECONDS});</code> || '''Yes''' || data-sort-value=128|'''0.1.128'''
 
| Sets up the buffer timeout in seconds. The default buffer timeout is <code>"20"</code>. Please see <code>AVPlay</code> API for possible values.
 
| Sets up the buffer timeout in seconds. The default buffer timeout is <code>"20"</code>. Please see <code>AVPlay</code> API for possible values.
|-
 
| <code>tizen:custom:duration</code> || <code>{SECONDS}</code> || <code>"tizen:custom:duration": "60"</code> || n/a || '''Yes''' || data-sort-value=128|'''0.1.128'''
 
| Sets up a custom duration in seconds. If a custom duration is set, only that duration is displayed during playback. It can be used for live data to disable the progress feature. The duration <code>"-1"</code> re-enables the progress feature.
 
|-
 
| <code>tizen:custom:position</code> || <code>{SECONDS}</code> || <code>"tizen:custom:position": "0"</code> || n/a || '''Yes''' || data-sort-value=128|'''0.1.128'''
 
| Sets up a custom position in seconds. If a custom position is set, only that position is displayed during playback and it is not possible to seek to another position (instead a <code>custom:tizen:seek</code> event is triggered). It can be used for live data to disable the seek feature. The position <code>"-1"</code> re-enables the seek feature.
 
|-
 
| <code>tizen:custom:state</code> || <code>{VIDEO_STATE}</code> || <code>"tizen:custom:position": "2"</code> || n/a || '''Yes''' || data-sort-value=128|'''0.1.128'''
 
| Sets up a custom state. If a custom state is set, only that state is displayed during playback and it is not possible to change it (instead a <code>custom:tizen:play</code> or <code>custom:tizen:pause</code> event is triggered). It can be used for live data to disable the play/pause feature.
 
 
* <code>"-1"</code>: Re-enables the play/pause feature
 
* <code>"1"</code>: Stopped (Not supported)
 
* <code>"2"</code>: Playing
 
* <code>"3"</code>: Paused
 
 
|-
 
|-
 
| <code>tizen:display:area</code> || <code>{REL_X},{REL_Y},{REL_W},{REL_H}</code> || <code>"tizen:display:area": "0,0,1,1"</code><br/><code>"tizen:display:area": "0.125,0,0.75,1"</code><br/><code>"tizen:display:area": "0,0.119,1,0.762"</code> || <code>setDisplayRect({ABS_X}, {ABS_Y}, {ABS_W}, {ABS_H});</code> || '''Yes''' || data-sort-value=128|'''0.1.128'''
 
| <code>tizen:display:area</code> || <code>{REL_X},{REL_Y},{REL_W},{REL_H}</code> || <code>"tizen:display:area": "0,0,1,1"</code><br/><code>"tizen:display:area": "0.125,0,0.75,1"</code><br/><code>"tizen:display:area": "0,0.119,1,0.762"</code> || <code>setDisplayRect({ABS_X}, {ABS_Y}, {ABS_W}, {ABS_H});</code> || '''Yes''' || data-sort-value=128|'''0.1.128'''
 
| Sets up the display area with relative coordinates. The default area is <code>"0,0,1,1"</code>, which fills the entire screen. Please see <code>AVPlay</code> API for possible values.
 
| Sets up the display area with relative coordinates. The default area is <code>"0,0,1,1"</code>, which fills the entire screen. Please see <code>AVPlay</code> API for possible values.
  
'''Note: If this property is set, the property <code>tizen:display:mode</code> will be set to <code>"PLAYER_DISPLAY_MODE_FULL_SCREEN"</code>, which fills the entire area (by strechting the video image).'''
+
'''Note: If this property is set, the property <code>tizen:display:mode</code> will be set to <code>"PLAYER_DISPLAY_MODE_FULL_SCREEN"</code>, which fills the entire area (by stretching the video image).'''
 
|-
 
|-
 
| <code>tizen:display:mode</code> || <code>{DISPLAY_MODE}</code> || <code>"tizen:display:mode": "PLAYER_DISPLAY_MODE_LETTER_BOX"</code><br/><code>"tizen:display:mode": "PLAYER_DISPLAY_MODE_FULL_SCREEN"</code><br/><code>"tizen:display:mode": "PLAYER_DISPLAY_MODE_AUTO_ASPECT_RATIO"</code> || <code>setDisplayMethod({DISPLAY_MODE});</code> || '''Yes''' || data-sort-value=128|'''0.1.128'''
 
| <code>tizen:display:mode</code> || <code>{DISPLAY_MODE}</code> || <code>"tizen:display:mode": "PLAYER_DISPLAY_MODE_LETTER_BOX"</code><br/><code>"tizen:display:mode": "PLAYER_DISPLAY_MODE_FULL_SCREEN"</code><br/><code>"tizen:display:mode": "PLAYER_DISPLAY_MODE_AUTO_ASPECT_RATIO"</code> || <code>setDisplayMethod({DISPLAY_MODE});</code> || '''Yes''' || data-sort-value=128|'''0.1.128'''
Line 46: Line 35:
  
 
'''Note: If this property is set, the property <code>tizen:display:area</code> will be set to <code>"0,0,1,1"</code>.'''
 
'''Note: If this property is set, the property <code>tizen:display:area</code> will be set to <code>"0,0,1,1"</code>.'''
 +
|-
 +
| <code>tizen:load</code> || <code>{ACTION}</code> || <code>"tizen:load": "info:Tizen player loaded."</code> || n/a || No || data-sort-value=128|'''0.1.128'''
 +
| Sets up an action that is executed if the player is loaded (i.e. the internal state is <code>"IDLE"</code>). Please see <code>AVPlay</code> API for more information.
 
|-
 
|-
 
| <code>tizen:ready</code> || <code>{ACTION}</code> || <code>"tizen:ready": "info:Tizen player ready."</code> || n/a || '''Yes''' || data-sort-value=128|'''0.1.128'''
 
| <code>tizen:ready</code> || <code>{ACTION}</code> || <code>"tizen:ready": "info:Tizen player ready."</code> || n/a || '''Yes''' || data-sort-value=128|'''0.1.128'''
Line 55: Line 47:
 
| <code>tizen:stream:{STREAM_TYPE}</code> || <code>{STREAM_VALUE}</code> || <code>"tizen:stream:PREBUFFER_MODE": "5000"</code><br/><code>"tizen:stream:ADAPTIVE_INFO": "FIXED_MAX_RESOLUTION=7680X4320"</code><br/><code>"tizen:stream:ADAPTIVE_INFO": "BITRATES=5000~10000{{pipe}}STARTBITRATE=HIGHEST{{pipe}}SKIPBITRATE=LOWEST"</code> || <code>setStreamingProperty({STREAM_TYPE}, {STREAM_VALUE});</code> || No || data-sort-value=128|'''0.1.128'''
 
| <code>tizen:stream:{STREAM_TYPE}</code> || <code>{STREAM_VALUE}</code> || <code>"tizen:stream:PREBUFFER_MODE": "5000"</code><br/><code>"tizen:stream:ADAPTIVE_INFO": "FIXED_MAX_RESOLUTION=7680X4320"</code><br/><code>"tizen:stream:ADAPTIVE_INFO": "BITRATES=5000~10000{{pipe}}STARTBITRATE=HIGHEST{{pipe}}SKIPBITRATE=LOWEST"</code> || <code>setStreamingProperty({STREAM_TYPE}, {STREAM_VALUE});</code> || No || data-sort-value=128|'''0.1.128'''
 
| Sets up a stream specific property. Please see <code>AVPlay</code> API for possible values.
 
| Sets up a stream specific property. Please see <code>AVPlay</code> API for possible values.
 +
|-
 +
| <code>tizen:subtitle:delay</code> || <code>{MILLISECONDS}</code> || <code>"tizen:subtitle:delay": "500"</code> || <code>setSubtitlePosition({MILLISECONDS});</code> || '''Yes''' || data-sort-value=141|'''0.1.141'''
 +
| Sets up a subtitle delay in milliseconds to adjust the synchronization with the video/audio. The default delay is <code>"0"</code>. Please see <code>AVPlay</code> API for more information.
 +
|-
 +
| <code>tizen:subtitle:hidden</code> || <code>{BOOLEAN_VALUE}</code> || <code>"tizen:subtitle:hidden": "true"</code> || n/a || '''Yes''' || data-sort-value=145|'''0.1.145'''
 +
| Shows/Hides the in-app subtitles. The default value is <code>"false"</code>.
 +
|-
 +
| <code>tizen:subtitle:silent</code> || <code>{BOOLEAN_VALUE}</code> || <code>"tizen:subtitle:silent": "true"</code> || <code>setSilentSubtitle({BOOLEAN_VALUE});</code> || '''Yes''' || data-sort-value=141|'''0.1.141'''
 +
| Shows/Hides the subtitles. The default value is <code>"false"</code>. Please see <code>AVPlay</code> API for more information.
 +
 +
'''Note: If the <code>tizen:subtitle:url</code> or <code>tizen:track:text</code> property is set, this property will be set to <code>"false"</code>.'''
 +
|-
 +
| <code>tizen:subtitle:style:color</code> || <code>{STYLE_COLOR}</code> || <code>"tizen:subtitle:style:color": "white"</code><br/><code>"tizen:subtitle:style:color": "yellow"</code><br/><code>"tizen:subtitle:style:color": "black"</code> || n/a || '''Yes''' || data-sort-value=153|'''0.1.153'''
 +
| Sets up the in-app subtitle style color. The default value is <code>"white"</code>.
 +
|-
 +
| <code>tizen:subtitle:style:size</code> || <code>{STYLE_SIZE}</code> || <code>"tizen:subtitle:style:size": "extra-small"</code><br/><code>"tizen:subtitle:style:size": "small"</code><br/><code>"tizen:subtitle:style:size": "medium"</code><br/><code>"tizen:subtitle:style:size": "large"</code><br/><code>"tizen:subtitle:style:size": "extra-large"</code> || n/a || '''Yes''' || data-sort-value=153|'''0.1.153'''
 +
| Sets up the in-app subtitle style size. The default value is <code>"medium"</code>.
 +
|-
 +
| <code>tizen:subtitle:style:type</code> || <code>{STYLE_TYPE}</code> || <code>"tizen:subtitle:style:type": "border"</code><br/><code>"tizen:subtitle:style:type": "shadow"</code><br/><code>"tizen:subtitle:style:type": "box"</code> || n/a || '''Yes''' || data-sort-value=153|'''0.1.153'''
 +
| Sets up the in-app subtitle style type. The default value is <code>"border"</code>.
 +
|-
 +
| <code>tizen:subtitle:type</code> || <code>{SUBTITLE_TYPE}</code> || <code>"tizen:subtitle:type": "html"</code><br/><code>"tizen:subtitle:type": "plain"</code> || n/a || '''Yes''' || data-sort-value=145|'''0.1.145'''
 +
| Sets up the in-app subtitle type. By default, Samsung TVs provide subtitles in the HTML format, therefore, the default type is <code>"html"</code> (which means that subtitles will not be HTML-escaped). However, it is not clear whether this applies to all subtitle files and all TV models. Therefore, it is also possible to set the type to <code>"plain"</code> (which means that subtitles will be HTML-escaped).
 +
|-
 +
| <code>tizen:subtitle:url</code> || <code>{SUBTITLE_URL}</code> || <code>"tizen:subtitle:url": "http://msx.benzac.de/media/sintel/en.srt"</code> || <code>setExternalSubtitlePath({SUBTITLE_FILE});</code> || '''Yes''' || data-sort-value=141|'''0.1.141'''
 +
| Sets up an external subtitle file. Please see <code>AVPlay</code> API for more information.
 +
 +
'''Note: Subtitle files should be specified in the SubRip Text (SRT) format.'''
 
|-
 
|-
 
| <code>tizen:track:audio</code> || <code>{TRACK_INDEX}</code> || <code>"tizen:track:audio": "1"</code> || <code>setSelectTrack("AUDIO", {TRACK_INDEX});</code> || '''Yes''' || data-sort-value=128|'''0.1.128'''
 
| <code>tizen:track:audio</code> || <code>{TRACK_INDEX}</code> || <code>"tizen:track:audio": "1"</code> || <code>setSelectTrack("AUDIO", {TRACK_INDEX});</code> || '''Yes''' || data-sort-value=128|'''0.1.128'''
Line 64: Line 84:
  
 
== Runtime Usage ==
 
== Runtime Usage ==
It is possible to change some extended properties via an action at runtime or to request data from the Tizen player.
+
It is possible to request data from the Tizen player (e.g. from an interaction plugin) and/or to set some extended properties via an action at runtime.
  
 +
=== Actions ===
 
{| class="wikitable sortable"
 
{| class="wikitable sortable"
 
|+ Action syntax for Tizen player
 
|+ Action syntax for Tizen player
 
|-
 
|-
! Syntax & Example !! Data !! Since Version !! Description  
+
! Syntax & Example !! Data !! Tizen Function !! Since Version !! Description  
 
|-
 
|-
 
|  
 
|  
 
<code>player:commit:message:{PROPERTY}:{VALUE}</code><br/>  
 
<code>player:commit:message:{PROPERTY}:{VALUE}</code><br/>  
 
<code>player:commit:message:tizen:buffer:timeout:20</code><br/>
 
<code>player:commit:message:tizen:buffer:timeout:20</code><br/>
<code>player:commit:message:tizen:custom:duration:60</code><br/>
 
 
<code>player:commit:message:tizen:display:area:0,0,1,1</code><br/>
 
<code>player:commit:message:tizen:display:area:0,0,1,1</code><br/>
 +
<code>player:commit:message:tizen:subtitle:hidden:true</code><br/>
 +
<code>player:commit:message:tizen:subtitle:silent:true</code><br/>
 +
<code>player:commit:message:tizen:subtitle:style:size:large</code><br/>
 +
<code>player:commit:message:tizen:subtitle:url:http://msx.benzac.de/media/sintel/en.srt</code><br/>
 +
<code>player:commit:message:tizen:track:audio:1</code><br/>
 +
<code>player:commit:message:tizen:track:text:1</code><br/>
 +
| n/a
 
| n/a
 
| n/a
 
| data-sort-value=128|'''0.1.128'''
 
| data-sort-value=128|'''0.1.128'''
 
| Sets up an extended property during runtime.
 
| Sets up an extended property during runtime.
 +
 +
'''Note: Only the dynamic properties can be set at runtime.'''
 +
 +
Please see [[#Syntax]] for more information.
 
|-
 
|-
 
| <code>player:commit</code> ||  
 
| <code>player:commit</code> ||  
Line 89: Line 120:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
| n/a
 +
| data-sort-value=128|'''0.1.128'''
 +
| Sets up an extended property during runtime and optionally executes an action on completion.
 +
 +
'''Note: Only the dynamic properties can be set at runtime.'''
 +
 +
Please see [[#Syntax]] for more information.
 +
|-
 +
|
 +
<code>interaction:commit:response:request:player:tizen:info</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:info:base</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:info:display</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:info:buffer</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:info:subtitle</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:info:stream</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:info:tracks</code><br/>
 +
| n/a
 +
|
 +
<code>getVersion();</code><br/>
 +
<code>getState();</code><br/>
 +
<code>getCurrentStreamInfo();</code><br/>
 +
<code>getTotalTrackInfo();</code><br/>
 +
| data-sort-value=128|'''0.1.128'''
 +
| Requests info data from the player and commits the response to an interaction plugin. Please see <code>AVPlay</code> API for more information. For the response data structure, please see [[#Response Examples]].
 +
|-
 +
|
 +
<code>interaction:commit:response:request:player:tizen:property:{STREAM_TYPE}</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:property:IS_LIVE</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:property:AVAILABLE_BITRATE</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:property:GET_LIVE_DURATION</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:property:CURRENT_BANDWIDTH</code><br/>
 +
| n/a
 +
| <code>getStreamingProperty({STREAM_TYPE});</code>
 
| data-sort-value=128|'''0.1.128'''
 
| data-sort-value=128|'''0.1.128'''
| Sets up an extended property during runtime.
+
| Requests a stream specific property from the player and commits the response to an interaction plugin. Please see <code>AVPlay</code> API for more information. For the response data structure, please see [[#Response Examples]].
 +
|-
 +
|
 +
<code>interaction:commit:response:request:player:tizen:properties:{STREAM_TYPE}{{pipe}}{STREAM_TYPE}{{pipe}}{STREAM_TYPE}</code><br/>
 +
<code>interaction:commit:response:request:player:tizen:properties:IS_LIVE{{pipe}}AVAILABLE_BITRATE{{pipe}}GET_LIVE_DURATION</code><br/>
 +
| n/a
 +
| <code>getStreamingProperty({STREAM_TYPE});</code>
 +
| data-sort-value=128|'''0.1.128'''
 +
| Requests multiple stream specific properties from the player and commits the response to an interaction plugin. Please see <code>AVPlay</code> API for more information. For the response data structure, please see [[#Response Examples]].
 +
|}
 +
 
 +
=== Response Examples ===
 +
'''Note: Please note that no action-related <code>data</code> property is used for all response examples. Therefore, the committed <code>data</code> property is always <code>null</code>.'''
 +
{| class="wikitable"
 +
|+ Response examples for Tizen player
 +
|-
 +
! Action Example !! Response Example
 +
|-
 +
|
 +
<code>interaction:commit:response:request:player:tizen:info</code><br/>
 +
|
 +
<syntaxhighlight lang="json">
 +
{
 +
    "response": {
 +
        "tizen": {
 +
            "info": {
 +
                "version": "1.0",
 +
                "state": "PLAYING",
 +
                "display": {
 +
                    "area": "0,0,1,1",
 +
                    "mode": "PLAYER_DISPLAY_MODE_LETTER_BOX"
 +
                },
 +
                "buffer": {
 +
                    "timeout": 20,
 +
                    "size": {
 +
                        "init": 10,
 +
                        "resume": 10
 +
                    }
 +
                },
 +
                "subtitle": {
 +
                    "delay": 0,
 +
                    "silent": false,
 +
                    "hidden": false,
 +
                    "type": "html",
 +
                    "style": {
 +
                        "size": "medium",
 +
                        "color": "white",
 +
                        "type": "border"
 +
                    },
 +
                    "url": null
 +
                },
 +
                "stream": {
 +
                    "video": {
 +
                        "index": 0,
 +
                        "info": {
 +
                            "fourCC": "H264",
 +
                            "Width": 1920,
 +
                            "Height": 1080,
 +
                            "Bit_rate": 477000
 +
                        }
 +
                    },
 +
                    "audio": {
 +
                        "index": 1,
 +
                        "info": {
 +
                            "language": "eng",
 +
                            "channels": 2,
 +
                            "sample_rate": 44100,
 +
                            "bit_rate": 96000,
 +
                            "fourCC": "AACL"
 +
                        }
 +
                    },
 +
                    "text": {
 +
                        "index": 2,
 +
                        "info": {
 +
                            "track_num": 0,
 +
                            "track_lang": "eng",
 +
                            "subtitle_type": -1,
 +
                            "fourCC": "TTML"
 +
                        }
 +
                    }
 +
                },
 +
                "tracks": {
 +
                    "video": [{
 +
                            "index": 0,
 +
                            "info": {
 +
                                "fourCC": "H264",
 +
                                "Width": 1920,
 +
                                "Height": 1080,
 +
                                "Bit_rate": 477000
 +
                            }
 +
                        }],
 +
                    "audio": [{
 +
                            "index": 1,
 +
                            "info": {
 +
                                "language": "eng",
 +
                                "channels": 2,
 +
                                "sample_rate": 44100,
 +
                                "bit_rate": 96000,
 +
                                "fourCC": "AACL"
 +
                            }
 +
                        }],
 +
                    "text": [{
 +
                            "index": 2,
 +
                            "info": {
 +
                                "track_num": 0,
 +
                                "track_lang": "eng",
 +
                                "subtitle_type": -1,
 +
                                "fourCC": "TTML"
 +
                            }
 +
                        }]
 +
                }
 +
            }
 +
        }
 +
    },
 +
    "error": null,
 +
    "data": null
 +
}
 +
</syntaxhighlight>
 +
|-
 +
|
 +
<code>interaction:commit:response:request:player:tizen:property:IS_LIVE</code><br/>
 +
|
 +
<syntaxhighlight lang="json">
 +
{
 +
    "response": {
 +
        "tizen": {
 +
            "property": {
 +
                "type": "IS_LIVE",
 +
                "value": "0"
 +
            }
 +
        }
 +
    },
 +
    "error": null,
 +
    "data": null
 +
}
 +
</syntaxhighlight>
 +
|-
 +
|
 +
<code>interaction:commit:response:request:player:tizen:properties:IS_LIVE{{pipe}}AVAILABLE_BITRATE{{pipe}}GET_LIVE_DURATION</code><br/>
 +
|
 +
<syntaxhighlight lang="json">
 +
{
 +
    "response": {
 +
        "tizen": {
 +
            "properties": [{
 +
                    "type": "IS_LIVE",
 +
                    "value": "0"
 +
                }, {
 +
                    "type": "AVAILABLE_BITRATE",
 +
                    "value": ""
 +
                }, {
 +
                    "type": "GET_LIVE_DURATION",
 +
                    "value": ""
 +
                }]
 +
        }
 +
    },
 +
    "error": null,
 +
    "data": null
 +
}
 +
</syntaxhighlight>
 
|}
 
|}
 +
 +
== Example ==
 +
This example uses an interaction plugin to interact with the Tizen player. You can use it as is or integrate it into your existing interaction plugin. Please have a look at following implementation scripts.
 +
* https://msx.benzac.de/interaction/js/tizen.js
 +
* https://msx.benzac.de/interaction/js/tizen-player.js
 +
 +
=== Screenshot ===
 +
[[File:tizen_player.png|thumb|640px|none|Example Screenshot (Tizen Player)]]
 +
 +
=== Code ===
 +
<syntaxhighlight lang="json">
 +
{
 +
    "type": "list",
 +
    "headline": "Tizen Player Test",
 +
    "template": {     
 +
        "type": "separate",
 +
        "layout": "0,0,2,4",     
 +
        "color": "msx-glass",
 +
        "properties": {
 +
            "tizen:buffer:size": "10",
 +
            "tizen:buffer:timeout": "20",         
 +
            "tizen:load": "logger:debug:Tizen player loaded.",
 +
            "tizen:ready": "logger:debug:Tizen player ready.",
 +
            "tizen:start": "logger:debug:Tizen player started.",           
 +
            "button:content:icon": "build",
 +
            "button:content:action": "content:request:interaction:init@http://msx.benzac.de/interaction/tizen.html"
 +
        }
 +
    },
 +
    "items": [{
 +
            "icon": "msx-white-soft:movie",
 +
            "title": "Video 1",
 +
            "playerLabel": "Video 1",
 +
            "action": "video:http://msx.benzac.de/media/video1.mp4"
 +
        }, {
 +
            "icon": "msx-white-soft:movie",
 +
            "title": "Video 2",
 +
            "playerLabel": "Video 2",
 +
            "action": "video:http://msx.benzac.de/media/video2.mp4"
 +
        }, {
 +
            "icon": "msx-white-soft:movie",
 +
            "title": "Video 3",
 +
            "playerLabel": "Video 3",
 +
            "action": "video:http://msx.benzac.de/media/video3.mp4"
 +
        }, {
 +
            "offset": "0,0,0,-1",
 +
            "icon": "msx-white-soft:music-note",
 +
            "background": "http://msx.benzac.de/img/bg1.jpg",
 +
            "title": "Audio 1",
 +
            "playerLabel": "Audio 1",
 +
            "action": "audio:http://msx.benzac.de/media/audio1.mp3"
 +
        }, {
 +
            "offset": "0,0,0,-1",
 +
            "icon": "msx-white-soft:music-note",
 +
            "background": "http://msx.benzac.de/img/bg2.jpg",
 +
            "title": "Audio 2",
 +
            "playerLabel": "Audio 2",
 +
            "action": "audio:http://msx.benzac.de/media/audio2.mp3"
 +
        }, {
 +
            "offset": "0,0,0,-1",
 +
            "icon": "msx-white-soft:music-note",
 +
            "background": "http://msx.benzac.de/img/bg3.jpg",
 +
            "title": "Audio 3",
 +
            "playerLabel": "Audio 3",
 +
            "action": "audio:http://msx.benzac.de/media/audio3.mp3"
 +
        }, {
 +
            "icon": "msx-white-soft:subtitles",
 +
            "title": "Sintel",     
 +
            "titleFooter": "0.1.145+",
 +
            "playerLabel": "Sintel © copyright Blender Foundation | durian.blender.org",
 +
            "action": "video:http://msx.benzac.de/media/sintel/sintel.mp4",
 +
            "properties": {
 +
                "resume:position": "102",
 +
                "label:extension": "{ico:msx-white:subtitles} EN",
 +
                "tizen:subtitle:url": "http://msx.benzac.de/media/sintel/en.srt",         
 +
                "button:content:icon": "build",
 +
                "button:content:action": "content:request:interaction:init@http://msx.benzac.de/interaction/tizen.html",         
 +
                "button:speed:icon": "subtitles",
 +
                "button:speed:action": "panel:http://msx.benzac.de/info/xp/data/tizen_test_subtitles.json"
 +
            }
 +
        }]
 +
}
 +
</syntaxhighlight>
 +
 +
=== Demo ===
 +
* Launch via App: https://msx.benzac.de/?start=content:https://msx.benzac.de/info/xp/data/tizen_test.json
 +
* Launch via Demo Page: https://msx.benzac.de/info/?start=content:https://msx.benzac.de/info/xp/data/tizen_test.json
 +
 +
'''Note: This demo will only work properly on a Samsung TV (2016+ model) with Media Station X 0.1.128 or higher.'''

Latest revision as of 08:45, 2 January 2024

The Tizen player is used in Media Station X version 0.1.128 or higher for all Samsung TVs (2016+ models). In previous versions, the HTML5 player is used. The Tizen player works similar to the HTML5 player, but supports more video formats (e.g. 4k/8k formats) and can be configured via the Extended Properties of a content item to setup display, buffer, and/or stream settings. Additionally, you can interact with it using the player:commit actions to get the current stream information and/or to select a specific audio/text track. Please see #Runtime Usage for more information. Some extended properties are dynamic and can also be set via an action at runtime.

Most of the extended properties are directly mapped to a corresponding Tizen (i.e. AVPlay API) function. For more information, please visit following links.

Note: All properties are reset if a new video/audio is played. Please also note that you can still use the HTML5 player with a plugin (see Video/Audio Plugin#Examples). It should be mentioned here that setting the speed only works with the HTML5 player, because the AVPlay API does not support the required speed values.

Syntax[edit]

Property syntax of extended properties for Tizen player
Property Value Example Tizen Function Dynamic Since Version Description
tizen:buffer:size {SECONDS} "tizen:buffer:size": "10" setBufferingParam("PLAYER_BUFFER_FOR_PLAY", "PLAYER_BUFFER_SIZE_IN_SECOND", {SECONDS});
setBufferingParam("PLAYER_BUFFER_FOR_RESUME", "PLAYER_BUFFER_SIZE_IN_SECOND", {SECONDS});
No 0.1.128 Sets up the initial and resume buffer size in seconds. The default buffer size is "10". Please see AVPlay API for possible values.
tizen:buffer:size:init {SECONDS} "tizen:buffer:size:init": "10" setBufferingParam("PLAYER_BUFFER_FOR_PLAY", "PLAYER_BUFFER_SIZE_IN_SECOND", {SECONDS}); No 0.1.128 Sets up the initial buffer size in seconds. The default buffer size is "10". Please see AVPlay API for possible values.
tizen:buffer:size:resume {SECONDS} "tizen:buffer:size:resume": "10" setBufferingParam("PLAYER_BUFFER_FOR_RESUME", "PLAYER_BUFFER_SIZE_IN_SECOND", {SECONDS}); No 0.1.128 Sets up the resume buffer size in seconds. The default buffer size is "10". Please see AVPlay API for possible values.
tizen:buffer:timeout {SECONDS} "tizen:buffer:timeout": "20" setTimeoutForBuffering({SECONDS}); Yes 0.1.128 Sets up the buffer timeout in seconds. The default buffer timeout is "20". Please see AVPlay API for possible values.
tizen:display:area {REL_X},{REL_Y},{REL_W},{REL_H} "tizen:display:area": "0,0,1,1"
"tizen:display:area": "0.125,0,0.75,1"
"tizen:display:area": "0,0.119,1,0.762"
setDisplayRect({ABS_X}, {ABS_Y}, {ABS_W}, {ABS_H}); Yes 0.1.128 Sets up the display area with relative coordinates. The default area is "0,0,1,1", which fills the entire screen. Please see AVPlay API for possible values.

Note: If this property is set, the property tizen:display:mode will be set to "PLAYER_DISPLAY_MODE_FULL_SCREEN", which fills the entire area (by stretching the video image).

tizen:display:mode {DISPLAY_MODE} "tizen:display:mode": "PLAYER_DISPLAY_MODE_LETTER_BOX"
"tizen:display:mode": "PLAYER_DISPLAY_MODE_FULL_SCREEN"
"tizen:display:mode": "PLAYER_DISPLAY_MODE_AUTO_ASPECT_RATIO"
setDisplayMethod({DISPLAY_MODE}); Yes 0.1.128 Sets up the display mode. The default mode is "PLAYER_DISPLAY_MODE_LETTER_BOX", which fills the entire screen (by keeping the video aspect ratio). Please see AVPlay API for possible values.

Note: If this property is set, the property tizen:display:area will be set to "0,0,1,1".

tizen:load {ACTION} "tizen:load": "info:Tizen player loaded." n/a No 0.1.128 Sets up an action that is executed if the player is loaded (i.e. the internal state is "IDLE"). Please see AVPlay API for more information.
tizen:ready {ACTION} "tizen:ready": "info:Tizen player ready." n/a Yes 0.1.128 Sets up an action that is executed if the player is ready (i.e. the internal state is "READY"). Please see AVPlay API for more information.
tizen:start {ACTION} "tizen:start": "info:Tizen player started." n/a Yes 0.1.128 Sets up an action that is executed if the player is started (i.e. the internal state is "PLAYING" or "PAUSED"). Please see AVPlay API for more information.
tizen:stream:{STREAM_TYPE} {STREAM_VALUE} "tizen:stream:PREBUFFER_MODE": "5000"
"tizen:stream:ADAPTIVE_INFO": "FIXED_MAX_RESOLUTION=7680X4320"
"tizen:stream:ADAPTIVE_INFO": "BITRATES=5000~10000|STARTBITRATE=HIGHEST|SKIPBITRATE=LOWEST"
setStreamingProperty({STREAM_TYPE}, {STREAM_VALUE}); No 0.1.128 Sets up a stream specific property. Please see AVPlay API for possible values.
tizen:subtitle:delay {MILLISECONDS} "tizen:subtitle:delay": "500" setSubtitlePosition({MILLISECONDS}); Yes 0.1.141 Sets up a subtitle delay in milliseconds to adjust the synchronization with the video/audio. The default delay is "0". Please see AVPlay API for more information.
tizen:subtitle:hidden {BOOLEAN_VALUE} "tizen:subtitle:hidden": "true" n/a Yes 0.1.145 Shows/Hides the in-app subtitles. The default value is "false".
tizen:subtitle:silent {BOOLEAN_VALUE} "tizen:subtitle:silent": "true" setSilentSubtitle({BOOLEAN_VALUE}); Yes 0.1.141 Shows/Hides the subtitles. The default value is "false". Please see AVPlay API for more information.

Note: If the tizen:subtitle:url or tizen:track:text property is set, this property will be set to "false".

tizen:subtitle:style:color {STYLE_COLOR} "tizen:subtitle:style:color": "white"
"tizen:subtitle:style:color": "yellow"
"tizen:subtitle:style:color": "black"
n/a Yes 0.1.153 Sets up the in-app subtitle style color. The default value is "white".
tizen:subtitle:style:size {STYLE_SIZE} "tizen:subtitle:style:size": "extra-small"
"tizen:subtitle:style:size": "small"
"tizen:subtitle:style:size": "medium"
"tizen:subtitle:style:size": "large"
"tizen:subtitle:style:size": "extra-large"
n/a Yes 0.1.153 Sets up the in-app subtitle style size. The default value is "medium".
tizen:subtitle:style:type {STYLE_TYPE} "tizen:subtitle:style:type": "border"
"tizen:subtitle:style:type": "shadow"
"tizen:subtitle:style:type": "box"
n/a Yes 0.1.153 Sets up the in-app subtitle style type. The default value is "border".
tizen:subtitle:type {SUBTITLE_TYPE} "tizen:subtitle:type": "html"
"tizen:subtitle:type": "plain"
n/a Yes 0.1.145 Sets up the in-app subtitle type. By default, Samsung TVs provide subtitles in the HTML format, therefore, the default type is "html" (which means that subtitles will not be HTML-escaped). However, it is not clear whether this applies to all subtitle files and all TV models. Therefore, it is also possible to set the type to "plain" (which means that subtitles will be HTML-escaped).
tizen:subtitle:url {SUBTITLE_URL} "tizen:subtitle:url": "http://msx.benzac.de/media/sintel/en.srt" setExternalSubtitlePath({SUBTITLE_FILE}); Yes 0.1.141 Sets up an external subtitle file. Please see AVPlay API for more information.

Note: Subtitle files should be specified in the SubRip Text (SRT) format.

tizen:track:audio {TRACK_INDEX} "tizen:track:audio": "1" setSelectTrack("AUDIO", {TRACK_INDEX}); Yes 0.1.128 Selects an audio track by indicating the index. Please see AVPlay API for more information.
tizen:track:text {TRACK_INDEX} "tizen:track:text": "1" setSelectTrack("TEXT", {TRACK_INDEX}); Yes 0.1.128 Selects a text track by indicating the index. Please see AVPlay API for more information.

Runtime Usage[edit]

It is possible to request data from the Tizen player (e.g. from an interaction plugin) and/or to set some extended properties via an action at runtime.

Actions[edit]

Action syntax for Tizen player
Syntax & Example Data Tizen Function Since Version Description

player:commit:message:{PROPERTY}:{VALUE}
player:commit:message:tizen:buffer:timeout:20
player:commit:message:tizen:display:area:0,0,1,1
player:commit:message:tizen:subtitle:hidden:true
player:commit:message:tizen:subtitle:silent:true
player:commit:message:tizen:subtitle:style:size:large
player:commit:message:tizen:subtitle:url:http://msx.benzac.de/media/sintel/en.srt
player:commit:message:tizen:track:audio:1
player:commit:message:tizen:track:text:1

n/a n/a 0.1.128 Sets up an extended property during runtime.

Note: Only the dynamic properties can be set at runtime.

Please see #Syntax for more information.

player:commit
{
   "key": "{PROPERTY}",
   "value": "{VALUE}",
   "action": "{ACTION}",
   "data": null
}
n/a 0.1.128 Sets up an extended property during runtime and optionally executes an action on completion.

Note: Only the dynamic properties can be set at runtime.

Please see #Syntax for more information.

interaction:commit:response:request:player:tizen:info
interaction:commit:response:request:player:tizen:info:base
interaction:commit:response:request:player:tizen:info:display
interaction:commit:response:request:player:tizen:info:buffer
interaction:commit:response:request:player:tizen:info:subtitle
interaction:commit:response:request:player:tizen:info:stream
interaction:commit:response:request:player:tizen:info:tracks

n/a

getVersion();
getState();
getCurrentStreamInfo();
getTotalTrackInfo();

0.1.128 Requests info data from the player and commits the response to an interaction plugin. Please see AVPlay API for more information. For the response data structure, please see #Response Examples.

interaction:commit:response:request:player:tizen:property:{STREAM_TYPE}
interaction:commit:response:request:player:tizen:property:IS_LIVE
interaction:commit:response:request:player:tizen:property:AVAILABLE_BITRATE
interaction:commit:response:request:player:tizen:property:GET_LIVE_DURATION
interaction:commit:response:request:player:tizen:property:CURRENT_BANDWIDTH

n/a getStreamingProperty({STREAM_TYPE}); 0.1.128 Requests a stream specific property from the player and commits the response to an interaction plugin. Please see AVPlay API for more information. For the response data structure, please see #Response Examples.

interaction:commit:response:request:player:tizen:properties:{STREAM_TYPE}|{STREAM_TYPE}|{STREAM_TYPE}
interaction:commit:response:request:player:tizen:properties:IS_LIVE|AVAILABLE_BITRATE|GET_LIVE_DURATION

n/a getStreamingProperty({STREAM_TYPE}); 0.1.128 Requests multiple stream specific properties from the player and commits the response to an interaction plugin. Please see AVPlay API for more information. For the response data structure, please see #Response Examples.

Response Examples[edit]

Note: Please note that no action-related data property is used for all response examples. Therefore, the committed data property is always null.

Response examples for Tizen player
Action Example Response Example

interaction:commit:response:request:player:tizen:info

{
    "response": {
        "tizen": {
            "info": {
                "version": "1.0",
                "state": "PLAYING",
                "display": {
                    "area": "0,0,1,1",
                    "mode": "PLAYER_DISPLAY_MODE_LETTER_BOX"
                },
                "buffer": {
                    "timeout": 20,
                    "size": {
                        "init": 10,
                        "resume": 10
                    }
                },
                "subtitle": {
                    "delay": 0,
                    "silent": false,
                    "hidden": false,
                    "type": "html",
                    "style": {
                        "size": "medium",
                        "color": "white",
                        "type": "border"
                    },
                    "url": null
                },
                "stream": {
                    "video": {
                        "index": 0,
                        "info": {
                            "fourCC": "H264",
                            "Width": 1920,
                            "Height": 1080,
                            "Bit_rate": 477000
                        }
                    },
                    "audio": {
                        "index": 1,
                        "info": {
                            "language": "eng",
                            "channels": 2,
                            "sample_rate": 44100,
                            "bit_rate": 96000,
                            "fourCC": "AACL"
                        }
                    },
                    "text": {
                        "index": 2,
                        "info": {
                            "track_num": 0,
                            "track_lang": "eng",
                            "subtitle_type": -1,
                            "fourCC": "TTML"
                        }
                    }
                },
                "tracks": {
                    "video": [{
                            "index": 0,
                            "info": {
                                "fourCC": "H264",
                                "Width": 1920,
                                "Height": 1080,
                                "Bit_rate": 477000
                            }
                        }],
                    "audio": [{
                            "index": 1,
                            "info": {
                                "language": "eng",
                                "channels": 2,
                                "sample_rate": 44100,
                                "bit_rate": 96000,
                                "fourCC": "AACL"
                            }
                        }],
                    "text": [{
                            "index": 2,
                            "info": {
                                "track_num": 0,
                                "track_lang": "eng",
                                "subtitle_type": -1,
                                "fourCC": "TTML"
                            }
                        }]
                }
            }
        }
    },
    "error": null,
    "data": null
}

interaction:commit:response:request:player:tizen:property:IS_LIVE

{
    "response": {
        "tizen": {
            "property": {
                "type": "IS_LIVE",
                "value": "0"
            }
        }
    },
    "error": null,
    "data": null
}

interaction:commit:response:request:player:tizen:properties:IS_LIVE|AVAILABLE_BITRATE|GET_LIVE_DURATION

{
    "response": {
        "tizen": {
            "properties": [{
                    "type": "IS_LIVE",
                    "value": "0"
                }, {
                    "type": "AVAILABLE_BITRATE",
                    "value": ""
                }, {
                    "type": "GET_LIVE_DURATION",
                    "value": ""
                }]
        }
    },
    "error": null,
    "data": null
}

Example[edit]

This example uses an interaction plugin to interact with the Tizen player. You can use it as is or integrate it into your existing interaction plugin. Please have a look at following implementation scripts.

Screenshot[edit]

Example Screenshot (Tizen Player)

Code[edit]

{
    "type": "list",
    "headline": "Tizen Player Test",
    "template": {       
        "type": "separate",
        "layout": "0,0,2,4",       
        "color": "msx-glass",
        "properties": {
            "tizen:buffer:size": "10",
            "tizen:buffer:timeout": "20",          
            "tizen:load": "logger:debug:Tizen player loaded.",
            "tizen:ready": "logger:debug:Tizen player ready.",
            "tizen:start": "logger:debug:Tizen player started.",            
            "button:content:icon": "build",
            "button:content:action": "content:request:interaction:init@http://msx.benzac.de/interaction/tizen.html"			
        }
    },
    "items": [{
            "icon": "msx-white-soft:movie",
            "title": "Video 1",
            "playerLabel": "Video 1",
            "action": "video:http://msx.benzac.de/media/video1.mp4"
        }, {
            "icon": "msx-white-soft:movie",
            "title": "Video 2",
            "playerLabel": "Video 2",
            "action": "video:http://msx.benzac.de/media/video2.mp4"
        }, {
            "icon": "msx-white-soft:movie",
            "title": "Video 3",
            "playerLabel": "Video 3",
            "action": "video:http://msx.benzac.de/media/video3.mp4"
        }, {
            "offset": "0,0,0,-1",
            "icon": "msx-white-soft:music-note",
            "background": "http://msx.benzac.de/img/bg1.jpg",
            "title": "Audio 1",
            "playerLabel": "Audio 1",
            "action": "audio:http://msx.benzac.de/media/audio1.mp3"
        }, {
            "offset": "0,0,0,-1",
            "icon": "msx-white-soft:music-note",
            "background": "http://msx.benzac.de/img/bg2.jpg",
            "title": "Audio 2",
            "playerLabel": "Audio 2",
            "action": "audio:http://msx.benzac.de/media/audio2.mp3"
        }, {
            "offset": "0,0,0,-1",
            "icon": "msx-white-soft:music-note",
            "background": "http://msx.benzac.de/img/bg3.jpg",
            "title": "Audio 3",
            "playerLabel": "Audio 3",
            "action": "audio:http://msx.benzac.de/media/audio3.mp3"
        }, {
            "icon": "msx-white-soft:subtitles",
            "title": "Sintel",      
            "titleFooter": "0.1.145+",
            "playerLabel": "Sintel © copyright Blender Foundation | durian.blender.org",
            "action": "video:http://msx.benzac.de/media/sintel/sintel.mp4",
            "properties": {
                "resume:position": "102",
                "label:extension": "{ico:msx-white:subtitles} EN",
                "tizen:subtitle:url": "http://msx.benzac.de/media/sintel/en.srt",          
                "button:content:icon": "build",
                "button:content:action": "content:request:interaction:init@http://msx.benzac.de/interaction/tizen.html",          
                "button:speed:icon": "subtitles",
                "button:speed:action": "panel:http://msx.benzac.de/info/xp/data/tizen_test_subtitles.json"
            }
        }]
}

Demo[edit]

Note: This demo will only work properly on a Samsung TV (2016+ model) with Media Station X 0.1.128 or higher.