Difference between revisions of "HTML5X Plugin"

From MSX - Wiki
Jump to navigation Jump to search
(Created page with "HTML5X stands for HTML5 Extended and is a special video plugin that supports the following features. * Setup subtitle tracks. * Preselect subtitle track. * Preselect audio tr...")
 
 
(27 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
* Switch audio track at playback time.
 
* Switch audio track at playback time.
 
* Load video and/or subtitle tracks from the interaction plugin (this allows you to use the plugin with Google Drive MSX, OneDrive MSX, Dropbox MSX, and other services).
 
* Load video and/or subtitle tracks from the interaction plugin (this allows you to use the plugin with Google Drive MSX, OneDrive MSX, Dropbox MSX, and other services).
 +
* Switch to fullscreen mode with native player controls (currently, this feature is only available for iOS/Mac devices)
  
'''Note: Subtitle tracks should be specified in the Web Video Text Tracks Format (WebVTT) for best cross-platform compatibility. Please also note the selection of audio tracks may not work on each platform.'''
+
'''Note: Subtitle tracks should be specified in the Web Video Text Tracks (WebVTT) format. Please also note the selection of audio tracks may not work on each platform.'''
  
The plugin can be used with version '''0.1.117''' or higher and is configured via the extended properties of a content item. Please see [[Extended Properties]] for more information.
+
The plugin can be used with version '''0.1.117''' or higher and is configured via the [[Extended Properties]] of a content item.
  
 
== Usage ==
 
== Usage ==
Line 28: Line 29:
 
== Syntax ==
 
== Syntax ==
 
{| class="wikitable sortable"
 
{| class="wikitable sortable"
|+ Extended property syntax of HTML5X plugin
+
|+ Property syntax of extended properties for HTML5X plugin
 
|-
 
|-
! Parameter !! Type !! Default Value !! Mandatory !! class="unsortable" | Description  
+
! Property !! Value !! Example !! class="unsortable" | Description  
 
|-
 
|-
| <code>url</code> || <code>string</code> || <code>null</code> || '''Yes''' ||
+
| <code>html5x:audiotrack</code> || <code>{LANGUAGE}</code> ||
The URL of the image. It is recommended to encode the value to ensure that it is evaluated correctly (e.g. <code>"http://msx.benzac.de/img/bg1.jpg"</code> <code>"http%3A%2F%2Fmsx.benzac.de%2Fimg%2Fbg1.jpg"</code>).
+
<code>"html5x:audiotrack": "en"</code><br/>
 +
<code>"html5x:audiotrack": "de"</code><br/>
 +
<code>"html5x:audiotrack": "es"</code><br/>
 +
<code>"html5x:audiotrack": "fr"</code><br/>
 +
<code>"html5x:audiotrack": "it"</code><br/>
 +
<code>"html5x:audiotrack": "nl"</code><br/>
 +
<code>"html5x:audiotrack": "pl"</code><br/>
 +
<code>"html5x:audiotrack": "pt"</code><br/>
 +
<code>"html5x:audiotrack": "ru"</code><br/>
 +
<code>"html5x:audiotrack": "default"</code><br/>
 +
||
 +
Preselects an audio track. If this property is not set, the last selected audio track is used. If the audio track does not exist or is set to <code>"default"</code>, the first audio track is used.
 
|-
 
|-
| <code>duration</code> || <code>number</code> || <code>30</code> || No ||
+
| <code>html5x:content</code> || <code>{BOOLEAN_VALUE}</code> ||
The display duration of the image in seconds.
+
<code>"html5x:content": "true"</code><br/>
 +
<code>"html5x:content": "false"</code><br/>
 +
||
 +
Adds/Removes the related content button (i.e. the button with the action <code>player:content</code>). By default, the related content button is removed.
 
|-
 
|-
| <code>filler</code> || <code>string</code> || <code>"fit"</code> || No ||
+
| <code>html5x:cors</code> || <code>{BOOLEAN_VALUE}</code> ||
The filler type of the image.
+
<code>"html5x:cors": "true"</code><br/>
 
+
<code>"html5x:cors": "false"</code><br/>
* <code>"fit"</code>: The image is sized (by keeping the ratio) to fit into the size and is positioned in the center.
+
||
* <code>"cover"</code>: The image is sized (by keeping the ratio) to cover the entire size and is positioned in the center.
+
Enables/Disables CORS support. By default, CORS support is enabled. If CORS support is enabled, the video URL and subtitle track URLs must contain the CORS headers. If CORS support is disabled, an online proxy is used for the subtitle track URLs, which means that these URLs must be publicly available.
* <code>"smart"</code>: If the ratio of the image and the size is the same, <code>"cover"</code> is used, otherwise <code>"fit"</code> is used.
+
|-
 +
| <code>html5x:subtitle</code> || <code>{LANGUAGE}</code> ||
 +
<code>"html5x:subtitle": "en"</code><br/>
 +
<code>"html5x:subtitle": "de"</code><br/>
 +
<code>"html5x:subtitle": "es"</code><br/>
 +
<code>"html5x:subtitle": "fr"</code><br/>
 +
<code>"html5x:subtitle": "it"</code><br/>
 +
<code>"html5x:subtitle": "nl"</code><br/>
 +
<code>"html5x:subtitle": "pl"</code><br/>
 +
<code>"html5x:subtitle": "pt"</code><br/>
 +
<code>"html5x:subtitle": "ru"</code><br/>
 +
<code>"html5x:subtitle": "default"</code><br/>
 +
||
 +
Preselects a subtitle track. If this property is not set, the last selected subtitle track is used. If the subtitle track does not exist or is set to <code>"default"</code>, the subtitles are initially switched off.
 +
|-
 +
| <code>html5x:subtitle:{LANGUAGE}:{LABEL}</code> || <code>{URL}</code>{{pipe}}<code>{ID}</code> ||
 +
<code>"html5x:subtitle:en:English": "http://msx.benzac.de/media/sintel/en.vtt"</code><br/>
 +
<code>"html5x:subtitle:de:Deutsch": "http://msx.benzac.de/media/sintel/de.vtt"</code><br/>
 +
<code>"html5x:subtitle:es:Español": "http://msx.benzac.de/media/sintel/es.vtt"</code><br/>
 +
<code>"html5x:subtitle:fr:Français": "http://msx.benzac.de/media/sintel/fr.vtt"</code><br/>
 +
<code>"html5x:subtitle:it:Italiano": "http://msx.benzac.de/media/sintel/it.vtt"</code><br/>
 +
<code>"html5x:subtitle:nl:Nederlands": "http://msx.benzac.de/media/sintel/nl.vtt"</code><br/>
 +
<code>"html5x:subtitle:pl:Język polski": "http://msx.benzac.de/media/sintel/pl.vtt"</code><br/>
 +
<code>"html5x:subtitle:pt:Português": "http://msx.benzac.de/media/sintel/pt.vtt"</code><br/>
 +
<code>"html5x:subtitle:ru:Pусский": "http://msx.benzac.de/media/sintel/ru.vtt"</code><br/>
 +
||
 +
Sets up a subtitle track. If the value is not an HTTP/HTTPS URL, the interaction plugin is used to request the corresponding URL.
 
|-
 
|-
| <code>color</code> || <code>string</code> || <code>"black"</code> || No ||
+
| <code>html5x:subtitle:order</code> || <code>{ORDER}</code> ||
The background color of the image in CSS syntax. It is recommended to encode the value to ensure that it is evaluated correctly (e.g. <code>"#000000"</code> → <code>"%23000000"</code>).
+
<code>"html5x:subtitle:order": "label"</code><br/>
 +
<code>"html5x:subtitle:order": "language"</code><br/>
 +
||
 +
Orders the subtitle tracks by label or language. If this property is not set, the order remains as it appears in the extended properties.
 
|}
 
|}
  
 
== Example ==
 
== Example ==
 
=== Screenshot ===
 
=== Screenshot ===
[[File:image_plugin.png|thumb|640px|none|Example Screenshot (Image Plugin)]]
+
[[File:html5x_plugin.png|thumb|640px|none|Example Screenshot (HTML5X Plugin)]]
  
 
=== Code ===
 
=== Code ===
Line 57: Line 101:
 
{
 
{
 
     "type": "pages",
 
     "type": "pages",
     "headline": "Image Plugin Test",
+
     "headline": "HTML5X Plugin Test",  
 
     "template": {       
 
     "template": {       
 
         "type": "separate",
 
         "type": "separate",
 
         "layout": "0,0,2,4",
 
         "layout": "0,0,2,4",
 
         "icon": "msx-white-soft:extension",
 
         "icon": "msx-white-soft:extension",
         "color": "msx-glass",
+
         "color": "msx-glass",       
 +
        "playerLabel": "Sintel © copyright Blender Foundation | durian.blender.org",
 +
        "action": "video:plugin:http://msx.benzac.de/plugins/html5x.html?url=http://msx.benzac.de/media/sintel/sintel.mp4",
 
         "properties": {
 
         "properties": {
             "control:load": "silent"
+
             "resume:position": "102",
 +
            "button:content:icon": "{context:contentIcon}",
 +
            "button:content:action": "{context:contentAction}",
 +
            "html5x:subtitle:en:English": "http://msx.benzac.de/media/sintel/en.vtt",
 +
            "html5x:subtitle:de:Deutsch": "http://msx.benzac.de/media/sintel/de.vtt",
 +
            "html5x:subtitle:es:Español": "http://msx.benzac.de/media/sintel/es.vtt",
 +
            "html5x:subtitle:fr:Français": "http://msx.benzac.de/media/sintel/fr.vtt",
 +
            "html5x:subtitle:it:Italiano": "http://msx.benzac.de/media/sintel/it.vtt",
 +
            "html5x:subtitle:nl:Nederlands": "http://msx.benzac.de/media/sintel/nl.vtt",
 +
            "html5x:subtitle:pl:Język polski": "http://msx.benzac.de/media/sintel/pl.vtt",
 +
            "html5x:subtitle:pt:Português": "http://msx.benzac.de/media/sintel/pt.vtt",
 +
            "html5x:subtitle:ru:Pусский": "http://msx.benzac.de/media/sintel/ru.vtt"
 
         }
 
         }
 
     },
 
     },
     "items": [{
+
     "items": [{    
             "title": "Video 1",
+
             "title": "Sintel 1",
             "playerLabel": "Video 1",
+
             "titleFooter": "Audio & Subtitles",
             "action": "video:http://msx.benzac.de/media/video1.mp4"
+
             "contentIcon": "settings",
        }, {
+
             "contentAction": "panel:request:player:options"        
             "background": "http://msx.benzac.de/img/bg1.jpg",
+
         }, {        
            "title": "Audio 1",
+
             "title": "Sintel 2",
            "playerLabel": "Audio 1",
+
             "titleFooter": "Audio only",
            "action": "audio:http://msx.benzac.de/media/audio1.mp3"
+
             "contentIcon": "audiotrack",
         }, {          
+
             "contentAction": "panel:request:player:audiotrack"
             "title": "Image 1",
+
         }, {  
             "playerLabel": "Image 1",
+
             "title": "Sintel 3",
            "action": "video:plugin:http://msx.benzac.de/plugins/image.html?url=http://msx.benzac.de/img/bg3.jpg"
+
             "titleFooter": "Subtitles only",
        }, {
+
             "contentIcon": "subtitles",
             "title": "Video 2",
+
             "contentAction": "panel:request:player:subtitle"
             "playerLabel": "Video 2",
 
            "action": "video:http://msx.benzac.de/media/video2.mp4"
 
         }, {
 
            "background": "http://msx.benzac.de/img/bg2.jpg",
 
             "title": "Audio 2",
 
            "playerLabel": "Audio 2",
 
             "action": "audio:http://msx.benzac.de/media/audio2.mp3"
 
        }, {
 
             "title": "Image 2",
 
             "playerLabel": "Image 2",
 
            "action": "video:plugin:http://msx.benzac.de/plugins/image.html?url=http://msx.benzac.de/img/test.jpg"
 
 
         }]
 
         }]
 
}
 
}
Line 98: Line 144:
  
 
=== Demo ===
 
=== Demo ===
* Launch via App: https://msx.benzac.de/?start=content:https://msx.benzac.de/info/xp/data/plugin_test_3.json
+
* Launch via App: http://msx.benzac.de/?start=content:http://msx.benzac.de/info/xp/data/plugin_test_4.json
* Launch via Demo Page: https://msx.benzac.de/info/?start=content:https://msx.benzac.de/info/xp/data/plugin_test_3.json
+
* Launch via Demo Page: http://msx.benzac.de/info/?start=content:http://msx.benzac.de/info/xp/data/plugin_test_4.json
 +
 
 +
'''Note: These demo links are opened in an insecure context (i.e. via <code>http://</code>) to avoid mixed content issues.'''
 +
 
 +
== See also ==
 +
* [[Video/Audio Plugin]]
 +
* [[Plugin API Reference]]

Latest revision as of 12:05, 12 June 2023

HTML5X stands for HTML5 Extended and is a special video plugin that supports the following features.

  • Setup subtitle tracks.
  • Preselect subtitle track.
  • Preselect audio track.
  • Switch subtitle track at playback time.
  • Switch audio track at playback time.
  • Load video and/or subtitle tracks from the interaction plugin (this allows you to use the plugin with Google Drive MSX, OneDrive MSX, Dropbox MSX, and other services).
  • Switch to fullscreen mode with native player controls (currently, this feature is only available for iOS/Mac devices)

Note: Subtitle tracks should be specified in the Web Video Text Tracks (WebVTT) format. Please also note the selection of audio tracks may not work on each platform.

The plugin can be used with version 0.1.117 or higher and is configured via the Extended Properties of a content item.

Usage[edit]

The plugin can be loaded with a video URL or ID. If a video ID is used, the interaction plugin is used to request the corresponding URL. Please see following action syntax examples.

If you would like to use the plugin with Google Drive MSX, OneDrive MSX, or Dropbox MSX, please use the index.json file feature and reference all video and subtitle files with the inline expression {asset:id:{NAME}} (e.g. {asset:id:sintel.mp4}). For more information, please see Credits & Hints from the corresponding service.

Note: For Google Drive MSX, CORS support must be disabled and all referenced files must be publicly shared and smaller than 100 MB.

If you would like to use the plugin as reference to implement your own plugin, please have a look at this implementation script: http://msx.benzac.de/plugins/js/html5x.js.

In order to get access to the audio/subtitle track selection, you have to set up a custom content action in the extended properties (i.e. by setting the button:content:icon and button:content:action property).

Syntax[edit]

Property syntax of extended properties for HTML5X plugin
Property Value Example Description
html5x:audiotrack {LANGUAGE}

"html5x:audiotrack": "en"
"html5x:audiotrack": "de"
"html5x:audiotrack": "es"
"html5x:audiotrack": "fr"
"html5x:audiotrack": "it"
"html5x:audiotrack": "nl"
"html5x:audiotrack": "pl"
"html5x:audiotrack": "pt"
"html5x:audiotrack": "ru"
"html5x:audiotrack": "default"

Preselects an audio track. If this property is not set, the last selected audio track is used. If the audio track does not exist or is set to "default", the first audio track is used.

html5x:content {BOOLEAN_VALUE}

"html5x:content": "true"
"html5x:content": "false"

Adds/Removes the related content button (i.e. the button with the action player:content). By default, the related content button is removed.

html5x:cors {BOOLEAN_VALUE}

"html5x:cors": "true"
"html5x:cors": "false"

Enables/Disables CORS support. By default, CORS support is enabled. If CORS support is enabled, the video URL and subtitle track URLs must contain the CORS headers. If CORS support is disabled, an online proxy is used for the subtitle track URLs, which means that these URLs must be publicly available.

html5x:subtitle {LANGUAGE}

"html5x:subtitle": "en"
"html5x:subtitle": "de"
"html5x:subtitle": "es"
"html5x:subtitle": "fr"
"html5x:subtitle": "it"
"html5x:subtitle": "nl"
"html5x:subtitle": "pl"
"html5x:subtitle": "pt"
"html5x:subtitle": "ru"
"html5x:subtitle": "default"

Preselects a subtitle track. If this property is not set, the last selected subtitle track is used. If the subtitle track does not exist or is set to "default", the subtitles are initially switched off.

html5x:subtitle:{LANGUAGE}:{LABEL} {URL}|{ID}

"html5x:subtitle:en:English": "http://msx.benzac.de/media/sintel/en.vtt"
"html5x:subtitle:de:Deutsch": "http://msx.benzac.de/media/sintel/de.vtt"
"html5x:subtitle:es:Español": "http://msx.benzac.de/media/sintel/es.vtt"
"html5x:subtitle:fr:Français": "http://msx.benzac.de/media/sintel/fr.vtt"
"html5x:subtitle:it:Italiano": "http://msx.benzac.de/media/sintel/it.vtt"
"html5x:subtitle:nl:Nederlands": "http://msx.benzac.de/media/sintel/nl.vtt"
"html5x:subtitle:pl:Język polski": "http://msx.benzac.de/media/sintel/pl.vtt"
"html5x:subtitle:pt:Português": "http://msx.benzac.de/media/sintel/pt.vtt"
"html5x:subtitle:ru:Pусский": "http://msx.benzac.de/media/sintel/ru.vtt"

Sets up a subtitle track. If the value is not an HTTP/HTTPS URL, the interaction plugin is used to request the corresponding URL.

html5x:subtitle:order {ORDER}

"html5x:subtitle:order": "label"
"html5x:subtitle:order": "language"

Orders the subtitle tracks by label or language. If this property is not set, the order remains as it appears in the extended properties.

Example[edit]

Screenshot[edit]

Example Screenshot (HTML5X Plugin)

Code[edit]

{
    "type": "pages",
    "headline": "HTML5X Plugin Test",    
    "template": {       
        "type": "separate",
        "layout": "0,0,2,4",
        "icon": "msx-white-soft:extension",
        "color": "msx-glass",        
        "playerLabel": "Sintel © copyright Blender Foundation | durian.blender.org",
        "action": "video:plugin:http://msx.benzac.de/plugins/html5x.html?url=http://msx.benzac.de/media/sintel/sintel.mp4",
        "properties": {
            "resume:position": "102",
            "button:content:icon": "{context:contentIcon}",
            "button:content:action": "{context:contentAction}",
            "html5x:subtitle:en:English": "http://msx.benzac.de/media/sintel/en.vtt",
            "html5x:subtitle:de:Deutsch": "http://msx.benzac.de/media/sintel/de.vtt",				
            "html5x:subtitle:es:Español": "http://msx.benzac.de/media/sintel/es.vtt",
            "html5x:subtitle:fr:Français": "http://msx.benzac.de/media/sintel/fr.vtt",
            "html5x:subtitle:it:Italiano": "http://msx.benzac.de/media/sintel/it.vtt",
            "html5x:subtitle:nl:Nederlands": "http://msx.benzac.de/media/sintel/nl.vtt",
            "html5x:subtitle:pl:Język polski": "http://msx.benzac.de/media/sintel/pl.vtt",
            "html5x:subtitle:pt:Português": "http://msx.benzac.de/media/sintel/pt.vtt",
            "html5x:subtitle:ru:Pусский": "http://msx.benzac.de/media/sintel/ru.vtt"			
        }
    },
    "items": [{     
            "title": "Sintel 1",
            "titleFooter": "Audio & Subtitles",
            "contentIcon": "settings",
            "contentAction": "panel:request:player:options"         
        }, {         
            "title": "Sintel 2",
            "titleFooter": "Audio only",
            "contentIcon": "audiotrack",
            "contentAction": "panel:request:player:audiotrack"
        }, {    
            "title": "Sintel 3",
            "titleFooter": "Subtitles only",
            "contentIcon": "subtitles",
            "contentAction": "panel:request:player:subtitle"
        }]
}

Demo[edit]

Note: These demo links are opened in an insecure context (i.e. via http://) to avoid mixed content issues.

See also[edit]