Multimedia

The following questions are related to implementing multimedia playback features.

Video playback using the HTML video element supports external subtitles in WebVTT format. For more information, see Adding Captions and Subtitles.

The AVPlay API supports both internal and external subtitles in a variety of formats. For information on configuring subtitle tracks with the AVPlay API, see Subtitles.

Note To display internal subtitles, the user must switch on the "Caption" setting on the TV.

On some TV models, the "Caption" setting is available only when the TV input source is the broadcast signal.

   #subtitle    #video element    #avplay api    #caption

Yes. For implementation information, see Using Video Elements.

Alternatively, you can also implement video playback using the AVPlay API.

   #html    #video element

For information about implementing media playback with the AVPlay API, see Using AVPlay. The AVPlay API allows you to play media content with features not supported in HTML5, such as adaptive streaming, additional subtitle formats, and 4K UHD video.

   #avplay api    #adaptive streaming    #subtitle    #4k    #uhd

When implementing multitasking, if you use the AVPlay API to play media content, do not call the pause() and play() methods when the application is hidden and resumed. Instead, call the suspend() method to save the playback state, and the restore() method to restore it:

document.addEventListener('visibilitychange', function() {

if (document.hidden) {

// Behavior when the application is hidden

webapis.avplay.suspend();

} else {

// Behavior when the application is resumed

webapis.avplay.restore();

}

});

For more information, see Multitasking.

   #avplay api    #multitasking    #suspend    #restore

Yes, you can implement multiple audio tracks and multiple subtitle tracks using the AVPlay API.

If you are not using the AVPlay API, you can implement multiple subtitle tracks for an HTML5 video element. For more information, see Adding Captions and Subtitles.

   #subtitle    #audio track    #multiple tracks    #avplay api    #video element    #caption

No. A video element and an AVPlay instance cannot play content simultaneously.

   #video element    #avplay api

To check whether the TV supports 4K UHD resolution, use the isUdPanelSupported() method of the ProductInfo API.

   #uhd    #4k    #screen resolution    #productinfo api

To retrieve the current playback time, use the getCurrentTime() method. It returns the playback time in milliseconds.

   #avplay api    #playback time    #getcurrenttime    #timestamp

You can specify whether a video is displayed in fullscreen mode, letterbox mode, or the video's aspect ratio, using the setDisplayMethod() method of the AVPlay API.

Note Overriding the video's original aspect ratio can cause video image distortion.

   #aspect ratio    #fullscreen    #letterbox    #override    #display mode

No. The AVPlay API plays the video content as delivered. It does not support rotating or mirroring the video image.

   #avplay api    #rotate    #mirror    #video image    #flip    #reverse

No. Subtitle visibility can be controlled from within the application, but closed captioning must be enabled or disabled in the TV settings. If the media content has both closed captioning and subtitles, you can prompt the user to open the TV settings and disable captioning, or you can avoid implementing software subtitles.

   #caption    #subtitle    #tv setting

No, switching the TV audio mode is not supported by the API. The user must select the audio mode from the TV menu.

   #audio mode

Yes, the autoplay and loop attributes for the HTML video element are supported on Samsung Smart TVs.

   #html    #video element    #autoplay    #loop

No, the getVideoPlaybackQuality() method of the HTMLVideoElement interface is not supported.

   #html5    #html video element    #getvideoplaybackquality    #playback quality

No. Although allowing the user to jump backwards improves the user experience, it is not a required feature. When you submit the application for publishing, if it does not support backwards jump, make sure to mention it in your application UI description file.

   #jump    #backward    #rewind    #user experience    #ux    #application ui description

To implement launching another application, you need the other application's application ID. Since application IDs are confidential, you can only launch other applications that you have developed.

However, if the streaming service you want to use, such as YouTube, has an HTML embedding functionality, you can use it in your application to stream content from that service.

   #embedding    #html    #embedded content    #application launch

Make sure the video format is supported by the TV. For information on video format support, see Media Specifications. Implement checks to ensure that the video format is supported before you attempt playback.

   #video element    #video format

To handle AVPlay errors, implement the onerror() event handler, which returns the error code. For more information and error code definitions, see the AVPlay API.

   #avplay api    #error code    #onerror

Make sure the application is setting the correct subtitle track. To retrieve the list of tracks in a media stream:

var trackInfo = webapis.avplay.getTotalTrackInfo();

var text = 'type of track info: ' + typeof trackInfo + '';

text += 'length: ' + trackInfo.length + '';

for (var i = 0; i trackInfo.length; i++) {

text += 'index: ' + trackInfo[i].index + '';

text += 'type: ' + trackInfo[i].type + '';

text += 'extra_info: ' + trackInfo[i].extra_info + '';

}

For more information on selecting a subtitle track, see Switching Subtitle Tracks.

   #avplay api    #subtitle track    #caption

Make sure you have set the appropriate display area for the content, using the setDisplayRect() method. For more information, see Using AVPlay.

If the media is 4K UHD content, you must also check that the TV supports it and implement its playback.

   #avplay api    #display area    #4k    #uhd    #no video

Captioning text is rendered with fixed-width (monospace) fonts, which can appear wider than variable-width (proportional) fonts.

   #caption    #subtitle    #font    #text    #font width

Closed captions are shown only when focus is on the TV broadcast window. To show closed captions in a PiP window, you must move focus to it.

   #captions    #subtitles    #picture in picture    #pip    #tv broadcast    #tvwindow api

The seekTo() method of the AVPlay API cannot be used to move to the video start time (0 milliseconds) or end time. To move to the beginning of a video, you can stop and restart the video, or move to a position close to the beginning, such as 1000 milliseconds.

   #seek    #jump    #avplay api    #seekto

The connection failed error occurs when the AVPlay instance is unable to access the media content. Make sure the URL is correct, the media server is accessible, and the connection uses the appropriate security settings and certificates.

   #network connection    #error    #url    #security certificate    #security setting    #server

When the media has multiple audio tracks, you must use the setSelectTrack() method to define the audio track to play. The method must be called when the AVPlay instance is in the playing state.

Note For Smooth Streaming only, the setSelectTrack() method can also be called during the ready state.

   #multiple audio tracks    #setselecttrack    #smooth streaming    #avplay api

Yes. The setVolume() method of the TVAudioControl API does not show the TV's built-in volume UI. You must implement your own volume UI.

   #volume level    #volume ui    #tvaudiocontrol api

Poor network connectivity can cause media to load slowly. To inform the user that content is still loading, implement a loading screen.

   #network connectivity    #black screen    #loading screen