From 151e10818376e9032aff78610d7afb6b3067458d Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Sat, 29 Jul 2023 20:38:47 -0400 Subject: [PATCH] Fit more error info in the dialog when videos fail --- CHANGELOG.md | 6 ++++++ playlet-lib/src/components/Dialog/Dialog.xml | 4 ---- playlet-lib/src/components/Dialog/DialogUtils.bs | 5 ++++- .../src/components/Dialog/{Dialog.bs => SimpleDialog.bs} | 0 playlet-lib/src/components/Dialog/SimpleDialog.xml | 4 ++++ playlet-lib/src/components/VideoPlayer/VideoPlayer.bs | 8 ++++++-- 6 files changed, 20 insertions(+), 7 deletions(-) delete mode 100644 playlet-lib/src/components/Dialog/Dialog.xml rename playlet-lib/src/components/Dialog/{Dialog.bs => SimpleDialog.bs} (100%) create mode 100644 playlet-lib/src/components/Dialog/SimpleDialog.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 431b81e4..350f0506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- Slightly more information in the error dialog when videos fail to play + ## [0.10.3] - 2023-07-24 ### Added diff --git a/playlet-lib/src/components/Dialog/Dialog.xml b/playlet-lib/src/components/Dialog/Dialog.xml deleted file mode 100644 index 31027d0d..00000000 --- a/playlet-lib/src/components/Dialog/Dialog.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/playlet-lib/src/components/Dialog/DialogUtils.bs b/playlet-lib/src/components/Dialog/DialogUtils.bs index c5e6fa68..0ad23fd9 100644 --- a/playlet-lib/src/components/Dialog/DialogUtils.bs +++ b/playlet-lib/src/components/Dialog/DialogUtils.bs @@ -3,13 +3,16 @@ function ShowDialog(message as dynamic, title as string) as object end function function ShowDialogButtons(message as dynamic, title as string, buttons as object) as object - dialog = CreateObject("roSGNode", "Dialog") + dialog = CreateObject("roSGNode", "SimpleDialog") if GetInterface(message, "ifArray") = invalid message = message.Tokenize(UnixNL()).ToArray() end if dialog.message = message dialog.title = title dialog.buttons = buttons + deviceInfo = CreateObject("roDeviceInfo") + displaySize = deviceInfo.GetDisplaySize() + dialog.width = displaySize.w - 100 m.top.getScene().dialog = dialog return dialog end function diff --git a/playlet-lib/src/components/Dialog/Dialog.bs b/playlet-lib/src/components/Dialog/SimpleDialog.bs similarity index 100% rename from playlet-lib/src/components/Dialog/Dialog.bs rename to playlet-lib/src/components/Dialog/SimpleDialog.bs diff --git a/playlet-lib/src/components/Dialog/SimpleDialog.xml b/playlet-lib/src/components/Dialog/SimpleDialog.xml new file mode 100644 index 00000000..f82cb4a6 --- /dev/null +++ b/playlet-lib/src/components/Dialog/SimpleDialog.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs index 28b0d317..8b7cfcdc 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs +++ b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs @@ -337,12 +337,16 @@ function OnVideoPlayerStateChange() as void end if if state = "error" + messageLines = [] + messageLines.push(`errorMsg: ${m.top.errorMsg}`) + messageLines.push(`errorCode: ${m.top.errorCode}`) + messageLines.push(`errorStr: ${m.top.errorStr}`) + errorInfo = m.top.errorInfo - messageLines = [`VideoId: ${m.top.videoId}`] for each info in errorInfo messageLines.push(`${info}: ${errorInfo[info]}`) end for - ShowDialog(messageLines, "Error playing video") + ShowDialog(messageLines, `Error playing video ${m.top.videoId}`) CloseVideo() end if end function