jf-roku/source/VideoPlayer.brs

33 lines
790 B
Plaintext
Raw Normal View History

function VideoPlayer(scene, id)
2019-03-05 04:59:31 +00:00
video = scene.createChild("Video")
content = VideoContent(id)
2019-01-31 04:56:15 +00:00
2019-03-05 04:59:31 +00:00
video.content = content
2019-01-31 04:56:15 +00:00
2019-03-05 04:59:31 +00:00
video.setFocus(true)
video.control = "play"
2019-01-31 04:56:15 +00:00
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-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
2019-03-05 05:18:01 +00:00
' I'm not super happy that I'm basically re-implementing APIRequest
' but for a ContentNode instead of UrlTransfer
server = get_setting("server")
content.url = Substitute("{0}/emby/Videos/{1}/stream.mp4", server, id)
content.url = content.url + "?Static=true"
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
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