From ea2be153b020808de6a5cd27fed175c0985cdfb5 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Tue, 16 Jan 2024 11:26:09 -0500 Subject: [PATCH] bug fix --- CHANGELOG.md | 4 +++- playlet-lib/src/components/VideoPlayer/VideoPlayer.bs | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7308937e..55e3f906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -Nothing worth mentioning yet. +### Fixed + +- [Attempt #2] to fix a crash caused by execution timeout when stopping a video takes too long ## [0.19.1] - 2024-01-13 diff --git a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs index 5f645025..bbd7b5bd 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs +++ b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs @@ -144,13 +144,20 @@ function Close(_unused as dynamic) m.sponsorBlockTask = invalid end if - m.top.control = "stop" - m.top.content = invalid parent = m.top.getParent() if parent <> invalid parent.RemoveChild(m.top) end if SponsorBlock.RemoveNotifcation(m.notifications) + + ' Stopping a video is slow and synchronous, and can lead to execution timeout crashes. + try + m.top.control = "stop" + catch error + DialogUtils.ShowDialog(ErrorUtils.Format(error), "Error closing video", true) + end try + + m.top.content = invalid end function function OnVideoPlayerStateChange() as void