Skip to content

Commit

Permalink
Add full-screen functionality
Browse files Browse the repository at this point in the history
Fixes #37 specifically requestFullscreen - width and heigh already work.
  • Loading branch information
SQL-MisterMagoo committed Dec 22, 2024
1 parent f7302b0 commit db974cf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions samples/SharedRCL/Pages/Controls.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
</BlazoredVideo>
<div @key="1" class="d-flex flex-column w-25 p-2">
<button class="btn btn-primary" @onclick=PlayOrPause>@PausePlayText</button>
<button class="btn btn-secondary" @onclick=RequestFullScreen>Full Screen</button>
<fieldset title="" class="d-flex flex-column mt-2">
<label for="volume">Volume @(volume * 10)</label>
<input id="volume" type="range" value=@volume @onchange=SetVolume min=0 max=1 step=0.1 list="steplist" />
Expand Down Expand Up @@ -96,6 +97,10 @@
await video.PausePlayback();
}
}
async Task RequestFullScreen()
{
await video.RequestFullScreen();
}

async Task SetVolume(ChangeEventArgs args)
{
Expand Down
6 changes: 6 additions & 0 deletions src/Blazored.Video/BlazoredVideo.razor.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ public partial class BlazoredVideo
/// </summary>
public ValueTask ReloadControl() => DoInvokeAsync(method: "load");

/// <summary>
/// Request full screen
/// </summary>
/// <returns></returns>
public ValueTask RequestFullScreen() => DoInvokeAsync(method: "requestFullscreen");

/// <summary>
/// Check whether the supplied mediaType can be played
/// </summary>
Expand Down
9 changes: 8 additions & 1 deletion src/Blazored.Video/BlazoredVideo.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Expand Down

0 comments on commit db974cf

Please sign in to comment.