Merge pull request #1273 from 1hitsong/globalQueueDeepLink
Convert deeplink to global queue & add error dialog to video player
This commit is contained in:
commit
ef568b2ba8
|
@ -63,34 +63,55 @@ sub onSubtitleChange()
|
|||
m.LoadMetaDataTask.control = "RUN"
|
||||
end sub
|
||||
|
||||
sub onPlaybackErrorDialogClosed(msg)
|
||||
sourceNode = msg.getRoSGNode()
|
||||
sourceNode.unobserveField("buttonSelected")
|
||||
sourceNode.unobserveField("wasClosed")
|
||||
|
||||
m.global.sceneManager.callFunc("popScene")
|
||||
end sub
|
||||
|
||||
sub onPlaybackErrorButtonSelected(msg)
|
||||
sourceNode = msg.getRoSGNode()
|
||||
sourceNode.close = true
|
||||
end sub
|
||||
|
||||
sub showPlaybackErrorDialog(errorMessage as string)
|
||||
dialog = createObject("roSGNode", "Dialog")
|
||||
dialog.title = tr("Error During Playback")
|
||||
dialog.buttons = [tr("OK")]
|
||||
dialog.message = errorMessage
|
||||
dialog.observeField("buttonSelected", "onPlaybackErrorButtonSelected")
|
||||
dialog.observeField("wasClosed", "onPlaybackErrorDialogClosed")
|
||||
m.top.getScene().dialog = dialog
|
||||
end sub
|
||||
|
||||
sub onVideoContentLoaded()
|
||||
m.LoadMetaDataTask.unobserveField("content")
|
||||
m.LoadMetaDataTask.control = "STOP"
|
||||
|
||||
videoContent = m.LoadMetaDataTask.content
|
||||
m.LoadMetaDataTask.content = []
|
||||
|
||||
' If we have nothing to play, return to previous screen
|
||||
if not isValid(m.LoadMetaDataTask.content)
|
||||
m.global.sceneManager.callFunc("popScene")
|
||||
if not isValid(videoContent)
|
||||
showPlaybackErrorDialog(tr("There was an error retrieving the data for this item from the server."))
|
||||
return
|
||||
end if
|
||||
|
||||
if not isValid(m.LoadMetaDataTask.content[0])
|
||||
m.global.sceneManager.callFunc("popScene")
|
||||
if not isValid(videoContent[0])
|
||||
showPlaybackErrorDialog(tr("There was an error retrieving the data for this item from the server."))
|
||||
return
|
||||
end if
|
||||
|
||||
if m.LoadMetaDataTask.content.count() = 0
|
||||
m.global.sceneManager.callFunc("popScene")
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.content = m.LoadMetaDataTask.content[0].content
|
||||
m.top.PlaySessionId = m.LoadMetaDataTask.content[0].PlaySessionId
|
||||
m.top.videoId = m.LoadMetaDataTask.content[0].id
|
||||
m.top.container = m.LoadMetaDataTask.content[0].container
|
||||
m.top.mediaSourceId = m.LoadMetaDataTask.content[0].mediaSourceId
|
||||
m.top.fullSubtitleData = m.LoadMetaDataTask.content[0].fullSubtitleData
|
||||
m.top.audioIndex = m.LoadMetaDataTask.content[0].audioIndex
|
||||
m.top.transcodeParams = m.LoadMetaDataTask.content[0].transcodeparams
|
||||
m.top.content = videoContent[0].content
|
||||
m.top.PlaySessionId = videoContent[0].PlaySessionId
|
||||
m.top.videoId = videoContent[0].id
|
||||
m.top.container = videoContent[0].container
|
||||
m.top.mediaSourceId = videoContent[0].mediaSourceId
|
||||
m.top.fullSubtitleData = videoContent[0].fullSubtitleData
|
||||
m.top.audioIndex = videoContent[0].audioIndex
|
||||
m.top.transcodeParams = videoContent[0].transcodeparams
|
||||
|
||||
if m.LoadMetaDataTask.isIntro
|
||||
m.top.enableTrickPlay = false
|
||||
|
@ -189,12 +210,7 @@ sub onState(msg)
|
|||
m.top.retryWithTranscoding = true ' If playback was not reported, retry with transcoding
|
||||
else
|
||||
' If an error was encountered, Display dialog
|
||||
dialog = createObject("roSGNode", "Dialog")
|
||||
dialog.title = tr("Error During Playback")
|
||||
dialog.buttons = [tr("OK")]
|
||||
dialog.message = tr("An error was encountered while playing this item.")
|
||||
dialog.observeField("buttonSelected", "dialogClosed")
|
||||
m.top.getScene().dialog = dialog
|
||||
showPlaybackErrorDialog(tr("Error During Playback"))
|
||||
end if
|
||||
|
||||
' Stop playback and exit player
|
||||
|
@ -274,12 +290,7 @@ sub bufferCheck(msg)
|
|||
m.top.callFunc("refresh")
|
||||
else
|
||||
' If buffering has stopped Display dialog
|
||||
dialog = createObject("roSGNode", "Dialog")
|
||||
dialog.title = tr("Error Retrieving Content")
|
||||
dialog.buttons = [tr("OK")]
|
||||
dialog.message = tr("There was an error retrieving the data for this item from the server.")
|
||||
dialog.observeField("buttonSelected", "dialogClosed")
|
||||
m.top.getScene().dialog = dialog
|
||||
showPlaybackErrorDialog(tr("There was an error retrieving the data for this item from the server."))
|
||||
|
||||
' Stop playback and exit player
|
||||
m.top.control = "stop"
|
||||
|
@ -289,14 +300,6 @@ sub bufferCheck(msg)
|
|||
|
||||
end sub
|
||||
|
||||
'
|
||||
' Clean up on Dialog Closed
|
||||
sub dialogClosed(msg)
|
||||
sourceNode = msg.getRoSGNode()
|
||||
sourceNode.unobserveField("buttonSelected")
|
||||
sourceNode.close = true
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
|
||||
if key = "OK" and m.nextEpisodeButton.hasfocus() and not m.top.trickPlayBar.visible
|
||||
|
|
|
@ -82,19 +82,14 @@ sub Main (args as dynamic) as void
|
|||
|
||||
' Check if we were sent content to play with the startup command (Deep Link)
|
||||
if isValidAndNotEmpty(args.mediaType) and isValidAndNotEmpty(args.contentId)
|
||||
video = CreateVideoPlayerGroup(args.contentId)
|
||||
|
||||
if isValid(video)
|
||||
sceneManager.callFunc("pushScene", video)
|
||||
else
|
||||
dialog = createObject("roSGNode", "Dialog")
|
||||
dialog.id = "OKDialog"
|
||||
dialog.title = tr("Not found")
|
||||
dialog.message = tr("The requested content does not exist on the server")
|
||||
dialog.buttons = [tr("OK")]
|
||||
m.scene.dialog = dialog
|
||||
m.scene.dialog.observeField("buttonSelected", m.port)
|
||||
end if
|
||||
deepLinkVideo = {
|
||||
id: args.contentId,
|
||||
type: "video"
|
||||
}
|
||||
|
||||
m.global.queueManager.callFunc("push", deepLinkVideo)
|
||||
m.global.queueManager.callFunc("playQueue")
|
||||
end if
|
||||
|
||||
' This is the core logic loop. Mostly for transitioning between scenes
|
||||
|
|
Loading…
Reference in New Issue
Block a user