From db974cf24ceb090e010df8c56be760f6df322607 Mon Sep 17 00:00:00 2001 From: Mister Magoo Date: Sun, 22 Dec 2024 17:51:25 +0000 Subject: [PATCH] Add full-screen functionality Fixes #37 specifically requestFullscreen - width and heigh already work. --- samples/SharedRCL/Pages/Controls.razor | 5 +++++ src/Blazored.Video/BlazoredVideo.razor.Methods.cs | 6 ++++++ src/Blazored.Video/BlazoredVideo.razor.cs | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/samples/SharedRCL/Pages/Controls.razor b/samples/SharedRCL/Pages/Controls.razor index 153fb92..adf893d 100644 --- a/samples/SharedRCL/Pages/Controls.razor +++ b/samples/SharedRCL/Pages/Controls.razor @@ -17,6 +17,7 @@
+
@@ -96,6 +97,10 @@ await video.PausePlayback(); } } + async Task RequestFullScreen() + { + await video.RequestFullScreen(); + } async Task SetVolume(ChangeEventArgs args) { diff --git a/src/Blazored.Video/BlazoredVideo.razor.Methods.cs b/src/Blazored.Video/BlazoredVideo.razor.Methods.cs index bf27c22..fe1753d 100644 --- a/src/Blazored.Video/BlazoredVideo.razor.Methods.cs +++ b/src/Blazored.Video/BlazoredVideo.razor.Methods.cs @@ -23,6 +23,12 @@ public partial class BlazoredVideo /// public ValueTask ReloadControl() => DoInvokeAsync(method: "load"); + /// + /// Request full screen + /// + /// + public ValueTask RequestFullScreen() => DoInvokeAsync(method: "requestFullscreen"); + /// /// Check whether the supplied mediaType can be played /// diff --git a/src/Blazored.Video/BlazoredVideo.razor.cs b/src/Blazored.Video/BlazoredVideo.razor.cs index a204410..a82b1d6 100644 --- a/src/Blazored.Video/BlazoredVideo.razor.cs +++ b/src/Blazored.Video/BlazoredVideo.razor.cs @@ -343,7 +343,14 @@ protected virtual async ValueTask DisposeAsyncCore() { if (jsModule is not null) { - await jsModule.DisposeAsync().ConfigureAwait(false); + try + { + await jsModule.DisposeAsync().ConfigureAwait(false); + } + catch + { + // ignore dispose errors due to circuit disconnect + } } } }