javascriptmediaweboslg

Luna Service for media in LG webOS 3.0 TV App


Need to know what the below service does.

luna://com.webos.media service (Note: It's not available in Luna service documentation)

I'm looking for language change in Subtitle/Audio for a channel. Please guide me through this.

Please refer the below sample.

 webOS.service.request("luna://com.webos.media", {
    method:"selectTrack",
    parameters: { "type": "audio", "index": index, "mediaId": mediaId },
      onSuccess: function (result) {
        console.log("[succes] select audio track " + index);
      },
      onFailure: function (result) {
        console.log( "[fail][" + result.errorCode + "] " + result.errorText );
        }
 });

Please mention the other available methods for this API.


Solution

  • We have successfully used this method to switch between subtitles and audio tracks for LG WebOS devices.

    You can refer to this link to improve: https://github.com/webosose/umediaserver/blob/master/src/server/uMediaserver.cpp

    /**
    @page com_webos_media com.webos.media
    @{
    @section com_webos_media_selectTrack selectTrack
    Selects Track
    @par Parameters
    Name | Required | Type | Description
    -----|--------|------|----------
    mediaId  | yes | String  | media id assigned to this media.
    type     | yes | String  | track type: video, audio and subtitle.
    index    | yes | Integer  | track index to select.
    @par Returns(Call)
    Name | Required | Type | Description
    -----|--------|------|----------
    returnValue | yes | Boolean | true if successful, false otherwise.
    errorCode   | no  | Integer | errorCode only if returnValue is false.
    errorText   | no  | String  | errorText only if returnValue is false.
    mediaId     | yes | String  | media id assigned to this media.