2020-02-17 19:30:04 +00:00
|
|
|
function PlaystateUpdate(id, state as string, params = {})
|
|
|
|
if state = "start" then
|
|
|
|
url = "Sessions/Playing"
|
|
|
|
else if state = "stop" then
|
|
|
|
url = "Sessions/Playing/Stopped"
|
|
|
|
else if state = "update"
|
|
|
|
url = "Sessions/Playing/Progress"
|
|
|
|
end if
|
2019-04-21 00:34:33 +00:00
|
|
|
params = PlaystateDefaults(id, params)
|
2020-02-17 19:30:04 +00:00
|
|
|
resp = APIRequest(url)
|
2019-04-21 00:34:33 +00:00
|
|
|
return postJson(resp, params)
|
|
|
|
end function
|
|
|
|
|
|
|
|
function PlaystateDefaults(id="" as string, params={} as object)
|
|
|
|
new_params = {
|
|
|
|
'"CanSeek": false
|
|
|
|
'"Item": "{}", ' TODO!
|
|
|
|
'"NowPlayingQueue": "[]", ' TODO!
|
|
|
|
'"PlaylistItemId": "",
|
|
|
|
"ItemId": id,
|
|
|
|
'"SessionId": "", ' TODO!
|
|
|
|
'"MediaSourceId": id,
|
|
|
|
'"AudioStreamIndex": 1,
|
|
|
|
'"SubtitleStreamIndex": 0,
|
|
|
|
"IsPaused": false,
|
|
|
|
'"IsMuted": false,
|
2020-02-17 19:30:04 +00:00
|
|
|
"PositionTicks": 0,
|
2019-04-21 00:34:33 +00:00
|
|
|
'"PlaybackStartTimeTicks": 0,
|
|
|
|
'"VolumeLevel": 100,
|
|
|
|
'"Brightness": 100,
|
|
|
|
'"AspectRatio": "16x9",
|
|
|
|
'"PlayMethod": "DirectStream"
|
|
|
|
'"LiveStreamId": "",
|
|
|
|
'"PlaySessionId": "",
|
|
|
|
'"RepeatMode": "RepeatNone"
|
|
|
|
}
|
|
|
|
for each p in params.items()
|
|
|
|
new_params[p.key] = p.value
|
|
|
|
end for
|
2020-06-26 16:55:43 +00:00
|
|
|
return FormatJson(new_params)
|
2019-04-21 00:34:33 +00:00
|
|
|
end function
|
2020-03-11 03:50:47 +00:00
|
|
|
|
|
|
|
function deleteTranscode(id)
|
|
|
|
devinfo = CreateObject("roDeviceInfo")
|
|
|
|
device_id = devinfo.getChannelClientID()
|
|
|
|
req = APIRequest("/Videos/ActiveEncodings", { "deviceID" : devinfo.getChannelClientID(), "PlaySessionId": id })
|
|
|
|
req.setRequest("DELETE")
|
|
|
|
postVoid(req)
|
|
|
|
end function
|