Add a live weather inset and local soundtrack support
This commit is contained in:
@@ -27,6 +27,7 @@ sub findServer(baseUrl as string, useSaved as boolean)
|
||||
m.weather.visible = false
|
||||
stopWeather()
|
||||
m.video.control = "stop"
|
||||
m.videoChannelId = invalid
|
||||
m.video.visible = false
|
||||
m.playbackStatus.visible = false
|
||||
m.retryTimer.control = "stop"
|
||||
@@ -154,16 +155,26 @@ end sub
|
||||
sub startPlayback()
|
||||
if m.channelIndex < 0 then return
|
||||
channel = m.channels[m.channelIndex]
|
||||
m.video.control = "stop"
|
||||
m.weather.visible = channel.type = "weather"
|
||||
m.video.visible = not m.weather.visible
|
||||
m.playbackStatus.visible = false
|
||||
if m.weather.visible
|
||||
startWeather()
|
||||
return
|
||||
end if
|
||||
stopWeather()
|
||||
m.video.visible = true
|
||||
m.video.translation = [0, 0]
|
||||
m.video.width = 1280
|
||||
m.video.height = 720
|
||||
m.video.mute = false
|
||||
if m.videoChannelId = channel.id and m.video.state = "playing" then return
|
||||
setPlaybackStatus("Tuning…")
|
||||
playLinear(channel)
|
||||
end sub
|
||||
|
||||
sub playLinear(channel as object)
|
||||
m.video.control = "stop"
|
||||
m.videoChannelId = invalid
|
||||
streamUrl = channel.streamUrl
|
||||
if GetInterface(streamUrl, "ifString") = invalid or streamUrl = ""
|
||||
setPlaybackStatus("This channel has no stream.")
|
||||
@@ -176,7 +187,7 @@ sub startPlayback()
|
||||
content.live = true
|
||||
content.title = channel.name
|
||||
m.video.content = content
|
||||
setPlaybackStatus("Tuning…")
|
||||
m.videoChannelId = channel.id
|
||||
m.video.control = "play"
|
||||
end sub
|
||||
|
||||
@@ -278,7 +289,11 @@ sub setPlaybackStatus(message as string)
|
||||
end sub
|
||||
|
||||
sub onVideoState()
|
||||
if m.channelIndex < 0 or m.weather.visible then return
|
||||
if m.weather.visible
|
||||
if m.video.state = "error" or m.video.state = "finished" then hideWeatherPreview()
|
||||
return
|
||||
end if
|
||||
if m.channelIndex < 0 then return
|
||||
if m.video.state = "playing"
|
||||
m.playbackStatus.visible = false
|
||||
m.retryCount = 0
|
||||
@@ -324,7 +339,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if m.previousIndex >= 0 then tune(m.previousIndex)
|
||||
return true
|
||||
else if LCase(key) = "ok"
|
||||
if m.video.state = "error" or m.video.state = "finished"
|
||||
if not m.weather.visible and (m.video.state = "error" or m.video.state = "finished")
|
||||
tune(m.channelIndex)
|
||||
else
|
||||
showBanner()
|
||||
|
||||
Reference in New Issue
Block a user