id
- id of the player app,com.webos.app.mediadiscovery
for webOS 6+,com.webos.app.photovideo
for webOS 3.x-5.x,com.webos.app.smartshare
for webOS 1.0-2.xfullPath
- url of the video filefileName
- name of the video displayed in player. Filename is remembered by the player to continue playback from exit timestamp
from a web app
webOS.service.request("luna://com.webos.applicationManager", {
method: "launch",
parameters: { "id": "com.webos.app.photovideo", "params": {"payload":[{
"fullPath":"https://media.w3.org/2010/05/sintel/trailer.mp4",
"artist":"",
"subtitle":"",
"dlnaInfo":{"flagVal":4096,"cleartextSize":"-1","contentLength":"-1","opVal":1,"protocolInfo":"http-get:*:video/x-matroska:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000","duration":0},
"mediaType":"VIDEO",
"thumbnail":"",
"deviceType":"DMR",
"album":"",
"fileName":"trailer",
"lastPlayPosition":-1}]}},
onSuccess: function (inResponse) {
console.log("The app is launched");
},
onFailure: function (inError) {
console.log("Failed to launch the app");
console.log("[" + inError.errorCode + "]: " + inError.errorText);
return;
}
});
from shell
luna-send-pub -n 1 -f luna://com.webos.applicationManager/launch '{"id": "com.webos.app.photovideo", "params": {"payload":[{"fullPath":"https://media.w3.org/2010/05/sintel/trailer.mp4","artist":"","subtitle":"","dlnaInfo":{"flagVal":4096,"cleartextSize":"-1","contentLength":"-1","opVal":1,"protocolInfo":"http-get:*:video/x-matroska:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000","duration":0},"mediaType":"VIDEO","thumbnail":"","deviceType":"DMR","album":"","fileName":"trailer","lastPlayPosition":-1}]}}'
# 1
luna-send -f -n 1 luna://com.webos.service.settings/setSystemSettings '{"category":"picture","settings":{"energySaving":"screen_off","energySavingModified":"true"}}'
//screen will turn back on with any remote key
# 2
luna-send -n 1 "luna://com.webos.service.tvpower/power/turnOffScreen" '{}'
luna-send -n 1 "luna://com.webos.service.tvpower/power/turnOnScreen" '{}'
luna-send -n 1 -f 'luna://com.webos.service.capture/executeOneShot' '{"path":"/tmp/'"$(date +%Y_%m_%d_%H-%M-%S)"'_capture.png","method":"DISPLAY","format":"PNG"}'
mediaId
is assigned by webos media server to any opened media pipeline. Value is required to perform direct com.webos.media
calls to control playback of videos.
document.querySelector('video').mediaId
Public Luna calls that return video details including mediaId (may not be supported on older webOS versions)
luna://com.webos.service.videooutput/getStatus
luna://com.webos.media/getForegroundAppInfo
luna://com.webos.media/getActivePipelines
Direct use of com.webos.media by application developers is strongly discouraged. Instead, the media interfaces native to a particular application framework (e.g. Web, QT, SDL/NDL) should be used. However some standard web apis (like managing subtitles) are not supported leaving us no choice rather to use direct calls.
method setSubtitleEnable
parameters:
mediaId
enable
-true
to show subtitles,false
to hide subtitles
Example
webOS.service.request("luna://com.webos.media", {
method:"setSubtitleEnable",
parameters: {
"mediaId": "_MQUBT01X5MiTj4",
"enable": true
},
onSuccess: function (result) {
console.log(JSON.stringify(result));
}
},
onFailure: function (result) {
console.log( "[fail][" + result.errorCode + "] " + result.errorText );
}
});
method selectTrack
parameters:
mediaId
type
-audio
for audiotracks,text
for subtitletracksindex
- number of track (0...n)
method setSubtitleFontSize
parameters:
mediaId
fontSize
- values:0
for tiny,1
- small,2
- standard (default),3
- large,4
- huge
method setSubtitleColor
parameters:
mediaId
color
- values:0
- yellow,1
- red,2
- white (default),3
- green,4
- blue,5
- gray
method setSubtitlePosition
parameters:
mediaId
position
- values:-3
for lowest position,-2
,-1
,0
(default),1
,2
,3
,4
for highest position
method setSubtitleCharacterOpacity
parameters:
mediaId
charOpacity
- values: from0
for fully transparent to255
for non-transparent (default)
(seems to do the same as setSubtitleColor
but some different values)
method setSubtitleCharacterColor
parameters:
mediaId
charColor
- values:black
,white
(default),yellow
,red
,green
,blue
method setSubtitleBackgroundOpacity
parameters:
mediaId
bgOpacity
- values: from0
for fully transparent (default) to255
for non-transparent
method setSubtitleBackgroundColor
parameters:
mediaId
bgColor
- values:black
(default),white
,yellow
,red
,green
,blue
method setSubtitleWindowOpacity
parameters:
mediaId
windowOpacity
- values: from0
for fully transparent (default) to255
for non-transparent
method setSubtitleWindowColor
parameters:
mediaId
windowColor
- values:black
(default),white
,yellow
,red
,green
,blue
method setSubtitleEncoding
parameters:
mediaId
encoding
- values:ISO8859-1
,ISO6937
,UTF-8
,WINDOWS-1252
,WINDOWS-1250
,ISO8859-4
,WINDOWS-1251
,WINDOWS-1256
,WINDOWS-1253
,ISO8859-8
,ISO8859-9
,ISO8859-11
,WINDOWS-1258
,BIG5
,GB2312
,EUCKR
,Shift_JIS
method setSubtitleSource
parameters:
mediaId
uri
link to subtitles file (i.e.http://some.website/filename.srt
or local filefile:///tmp/usb/sda/sda1/filename.srt
)preferredEncodings
- optional parameter
method setSubtitleSync
parameters:
mediaId
sync
- values: +-sync in milliseconds (i.e.-350
,200
,1500
, etc)
method setPlayRate
parameters:
mediaId
playRate
- values from0.1
to2.0
, default is1.0
audioOutput
-true
, audio is played only up to x2 playback rate
To get video detailed data like number of embedded audio and subtitle tracks may be needed to subscribe to pipeline events and parse sourceInfo
generated after media is loaded (https://www.webosose.org/docs/reference/ls2-api/com-webos-media/#sourceinfo-1)
method subscribe
parameters:
mediaId
subscribe
-true
To unsubscribe use method unsubscribe
with only parameter mediaId
Example of sourceInfo
object
{"sourceInfo":{"numPrograms":1,"container":"mkv","seekable":true,"trickable":true,"programInfo":[{"duration":1295552,"numAudioTracks":4,"audioTrackInfo":[{"bitRate":0,"language":"ru","codec":"ac3","sampleRate":48,"channels":2,"audioType":0},{"bitRate":0,"language":"ru","codec":"ac3","sampleRate":48,"channels":2,"audioType":0},{"bitRate":0,"language":"ru","codec":"ac3","sampleRate":48,"channels":2,"audioType":0},{"bitRate":0,"language":"en","codec":"ac3","sampleRate":48,"channels":6,"audioType":0} ],"numVideoTracks":1,"videoTrackInfo":[{"angleNumber":0,"level":3.1,"width":1280,"height":720,"codec":"H264","profile":"high","frameRate":23.976,"progressive":true} ],"numSubtitleTracks":2,"subtitleTrackInfo":[{"language":"ru","type":"text"},{"language":"en","type":"text"} ]} ],"mediaId":"_MQUBT01X5MiTj4"}}
Audiotrack may have disposition.default
tag. WebOS 4+ reads this tag and puts the track marked as default into the first position of tracks list (index 0)
Thanks, This is working, what is the proper way to get this information? are there any resources I can read about supported APIs ore any app which uses this I can look into it's code?