2021-09-01 00:39:35 +00:00
|
|
|
sub init()
|
|
|
|
m.top.functionName = "PlaystateUpdate"
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub PlaystateUpdate()
|
|
|
|
if m.top.status = "start"
|
|
|
|
url = "Sessions/Playing"
|
|
|
|
else if m.top.status = "stop"
|
|
|
|
url = "Sessions/Playing/Stopped"
|
|
|
|
else if m.top.status = "update"
|
|
|
|
url = "Sessions/Playing/Progress"
|
|
|
|
else
|
|
|
|
' Unknown State
|
|
|
|
return
|
|
|
|
end if
|
|
|
|
params = PlaystateDefaults(m.top.params)
|
|
|
|
resp = APIRequest(url)
|
|
|
|
postJson(resp, params)
|
|
|
|
end sub
|
|
|
|
|
|
|
|
function PlaystateDefaults(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,
|
2022-05-30 13:00:14 +00:00
|
|
|
"PositionTicks": 0
|
2021-09-01 00:39:35 +00:00
|
|
|
'"PlaybackStartTimeTicks": 0,
|
|
|
|
'"VolumeLevel": 100,
|
|
|
|
'"Brightness": 100,
|
|
|
|
'"AspectRatio": "16x9",
|
|
|
|
'"PlayMethod": "DirectStream"
|
|
|
|
'"LiveStreamId": "",
|
|
|
|
'"PlaySessionId": "",
|
|
|
|
'"RepeatMode": "RepeatNone"
|
|
|
|
}
|
2022-05-07 16:33:09 +00:00
|
|
|
|
|
|
|
paramsArray = params.items()
|
|
|
|
for i = 0 to paramsArray.count() - 1
|
|
|
|
item = paramsArray[i]
|
|
|
|
new_params[item.key] = item.value
|
2021-09-01 00:39:35 +00:00
|
|
|
end for
|
|
|
|
return FormatJson(new_params)
|
|
|
|
end function
|