Merge pull request #505 from neilsb/handle-missing-transcode-url

This commit is contained in:
Anthony Lavado 2021-12-03 14:54:52 -05:00 committed by GitHub
commit e81e5a6eb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 0 deletions

View File

@ -172,4 +172,22 @@ end sub
sub resetTime()
' Passthrough to overhang
m.overhang.callFunc("resetTime")
end sub
'
' Display dialog to user with an OK button
sub userMessage(title as string, message as string)
dialog = createObject("roSGNode", "Dialog")
dialog.title = title
dialog.message = message
dialog.buttons = [tr("OK")]
dialog.observeField("buttonSelected", "dismiss_dialog")
m.scene.dialog = dialog
end sub
'
' Close currently displayed dialog
sub dismiss_dialog()
print "Button Pressed"
m.scene.dialog.close = true
end sub

View File

@ -6,6 +6,7 @@
<function name="getActiveScene" />
<function name="clearScenes" />
<function name="resetTime" />
<function name="userMessage" />
<field id="currentUser" type="string" onChange="updateUser" />
</interface>
<script type="text/brightscript" uri="SceneManager.brs" />

View File

@ -387,5 +387,15 @@
<translation>or enter server URL manually:</translation>
<extracomment>Instructions on initial app launch when the user is asked to manually enter a server URL</extracomment>
</message>
<message>
<source>Error Getting Playback Information</source>
<translation>Error Getting Playback Information</translation>
<extracomment>Dialog Title: Received error from server when trying to get information about the selected item for playback</extracomment>
</message>
<message>
<source>An error was encountered while playing this item. Server did not provide required transcoding data.</source>
<translation>An error was encountered while playing this item. Server did not provide required transcoding data.</translation>
<extracomment>Content of message box when trying to play an item which requires transcoding, and the server did not provide transcode url</extracomment>
</message>
</context>
</TS>

View File

@ -379,5 +379,15 @@
<translation>or enter server URL manually:</translation>
<extracomment>Instructions on initial app launch when the user is asked to manually enter a server URL</extracomment>
</message>
<message>
<source>Error Getting Playback Information</source>
<translation>Error Getting Playback Information</translation>
<extracomment>Dialog Title: Received error from server when trying to get information about the selected item for playback</extracomment>
</message>
<message>
<source>An error was encountered while playing this item. Server did not provide required transcoding data.</source>
<translation>An error was encountered while playing this item. Server did not provide required transcoding data.</translation>
<extracomment>Content of message box when trying to play an item which requires transcoding, and the server did not provide transcode url</extracomment>
</message>
</context>
</TS>

View File

@ -106,6 +106,12 @@ sub AddVideoContent(video, audio_stream_idx = 1, subtitle_idx = -1, playbackPosi
video.content.url = buildURL(Substitute("Videos/{0}/stream", video.id), params)
video.isTranscoded = false
else
' If server does not provide a transcode URL, display a message to the user
if playbackInfo.MediaSources[0].TranscodingUrl = invalid
m.global.sceneManager.callFunc("userMessage", tr("Error Getting Playback Information"), tr("An error was encountered while playing this item. Server did not provide required transcoding data."))
video.content = invalid
return
end if
' Get transcoding reason
video.transcodeReasons = getTranscodeReasons(playbackInfo.MediaSources[0].TranscodingUrl)