From 7d6faee27bca36108d1e347ea29791130d187b1f Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Fri, 4 Oct 2024 12:29:40 -0500 Subject: [PATCH] properly destroy channel preview (#1910) --- CHANGELOG.md | 2 ++ ErsatzTV/Pages/_Host.cshtml | 10 +++++----- ErsatzTV/Shared/ChannelPreviewDialog.razor | 11 ++++++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b39cd0b6..ab2866fec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix startup error with MySql backend caused by database cleaner - Fix emptying trash with ElasticSearch backend - Fix double loading of trash UI elements, and fix reloading of all UI elements after emptying trash +- Fix destroying channel preview player when preview dialog is closed + - This bug made it difficult to "stop" a channel after previewing it ## [0.8.8-beta] - 2024-09-19 ### Added diff --git a/ErsatzTV/Pages/_Host.cshtml b/ErsatzTV/Pages/_Host.cshtml index 2273dd726..0db6fd9af 100644 --- a/ErsatzTV/Pages/_Host.cshtml +++ b/ErsatzTV/Pages/_Host.cshtml @@ -50,7 +50,7 @@ $("h2").addClass("mud-typography mud-typography-h4"); $("h3").addClass("mud-typography mud-typography-h5"); } - + function previewChannel(uri) { var video = document.getElementById('video'); if (Hls.isSupported()) { @@ -80,7 +80,7 @@ }); } } - + function stopPreview() { var hls = $('#video').data('hls'); hls && hls.destroy(); @@ -114,7 +114,7 @@ } } }; - + window.clipboardCopy = { copyText: async function (codeElement) { if (navigator.clipboard && window.isSecureContext) { @@ -124,10 +124,10 @@ textArea.value = codeElement.textContent; textArea.style.position = "absolute"; textArea.style.left = "-999999px"; - + document.body.prepend(textArea); textArea.select(); - + try { document.execCommand('copy'); } catch (error) { diff --git a/ErsatzTV/Shared/ChannelPreviewDialog.razor b/ErsatzTV/Shared/ChannelPreviewDialog.razor index 1131d4dc3..34f0d931a 100644 --- a/ErsatzTV/Shared/ChannelPreviewDialog.razor +++ b/ErsatzTV/Shared/ChannelPreviewDialog.razor @@ -1,4 +1,5 @@ @inject IJSRuntime JsRuntime +@implements IDisposable