88 lines
3.0 KiB
Plaintext
88 lines
3.0 KiB
Plaintext
' Playlet (App to play videos from an Invidious server on Roku TVs)
|
|
' Copyright (C) 2023 Brahim Hadriche
|
|
|
|
' This program is free software: you can redistribute it and/or modify
|
|
' it under the terms of the GNU Affero General Public License as published by
|
|
' the Free Software Foundation, either version 3 of the License, or
|
|
' (at your option) any later version.
|
|
|
|
' This program is distributed in the hope that it will be useful,
|
|
' but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
' GNU Affero General Public License for more details.
|
|
|
|
' You should have received a copy of the GNU Affero General Public License
|
|
' along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
function Main(args as object) as void
|
|
screen = CreateObject("roSGScreen")
|
|
port = CreateObject("roMessagePort")
|
|
screen.setMessagePort(port)
|
|
m.global = screen.getGlobalNode()
|
|
|
|
ClearPlayletLibUrlsIfNeeded(args)
|
|
|
|
scene = screen.CreateScene("BootstrapScene")
|
|
screen.show()
|
|
|
|
scene.ObserveField("exitChannel", port)
|
|
scene.launchArgs = args
|
|
|
|
if false
|
|
' These vars are needed to pass certification.
|
|
' The actual work is done in Playlet Lib
|
|
' bs:disable-next-line LINT1005
|
|
contentId = args.contentId
|
|
' bs:disable-next-line LINT1005
|
|
mediaType = args.mediaType
|
|
|
|
' Do not signal app launch complete here, we're doing it over at Playlet Lib
|
|
' This is needed to pass cetification
|
|
scene.signalBeacon("AppLaunchComplete")
|
|
end if
|
|
|
|
input = CreateObject("roInput")
|
|
input.setMessagePort(port)
|
|
|
|
' TODO:P1 follow up on bug where roSystemLog does not fire for a video player in ComponentLibrary
|
|
' https://community.roku.com/t5/Roku-Developer-Program/BUG-roSystemLog-not-firing-with-ComponentLibrary/td-p/906075
|
|
systemLog = CreateObject("roSystemLog")
|
|
systemLog.SetMessagePort(port)
|
|
systemLog.EnableType("http.connect")
|
|
systemLog.EnableType("http.error")
|
|
systemLog.EnableType("http.complete")
|
|
systemLog.EnableType("bandwidth.minute")
|
|
|
|
#if DEBUG
|
|
' The following comment is to enable the SceneGraph inspector
|
|
' on the VSCode BrightScript plugin.
|
|
' vscode_rdb_on_device_component_entry
|
|
|
|
' The following comment is to enable RALE tracking
|
|
' vscode_rale_tracker_entry
|
|
#end if
|
|
|
|
while true
|
|
msg = wait(0, port)
|
|
msgType = type(msg)
|
|
if msgType = "roSystemLogEvent"
|
|
info = msg.GetInfo()
|
|
info.DateTime = info.DateTime.ToISOString()
|
|
scene.systemLogEvent = info
|
|
else if msgType = "roSGScreenEvent"
|
|
if msg.isScreenClosed()
|
|
return
|
|
end if
|
|
else if msgType = "roSGNodeEvent"
|
|
field = msg.getField()
|
|
data = msg.getData()
|
|
if field = "exitChannel" and data = true
|
|
END
|
|
end if
|
|
else if msgType = "roInputEvent"
|
|
scene.inputArgs = msg.getInfo()
|
|
end if
|
|
end while
|
|
|
|
end function
|