jf-roku/source/VideoPlayer.brs

49 lines
1.1 KiB
Plaintext
Raw Normal View History

function VideoPlayer(id)
video = CreateObject("roSGNode", "Video")
2019-03-05 04:59:31 +00:00
content = VideoContent(id)
2019-01-31 04:56:15 +00:00
2019-03-05 04:59:31 +00:00
video.setFocus(true)
video.content = content
2019-03-05 04:59:31 +00:00
video.control = "play"
2019-01-31 04:56:15 +00:00
jellyfin_blue = "#00a4dcFF"
video.retrievingBar.filledBarBlendColor = jellyfin_blue
video.bufferingBar.filledBarBlendColor = jellyfin_blue
video.trickPlayBar.filledBarBlendColor = jellyfin_blue
2019-03-05 04:59:31 +00:00
return video
2019-01-31 04:56:15 +00:00
end function
function VideoContent(id) as object
2019-04-21 00:34:33 +00:00
2019-03-05 05:18:01 +00:00
content = createObject("RoSGNode", "ContentNode")
2019-01-31 04:56:15 +00:00
2019-03-05 05:18:01 +00:00
meta = ItemMetaData(id)
content.title = meta.Name
2019-01-31 04:56:15 +00:00
container = meta.json.mediaSources[0].container
if container = invalid
container = ""
else if container = "m4v" or container = "mov"
container = "mp4"
end if
content.url = buildURL(Substitute("Videos/{0}/stream", id), {
Static: "true",
Container: container
})
2019-01-31 04:56:15 +00:00
2019-03-05 05:18:01 +00:00
content = authorize_request(content)
2019-01-31 04:56:15 +00:00
content.streamformat = container
content.switchingStrategy = ""
2019-03-05 05:18:01 +00:00
if server_is_https() then
content.setCertificatesFile("common:/certs/ca-bundle.crt")
end if
2019-01-31 04:56:15 +00:00
2019-03-05 05:18:01 +00:00
return content
2019-01-31 04:56:15 +00:00
end function