-
Notifications
You must be signed in to change notification settings - Fork 468
Full screen events #2041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Full screen events #2041
Changes from 105 commits
bba92d1
2aaa53e
6db6b06
17601c3
7669d0a
38c5834
2783077
47b6434
5185222
8198c94
6d34192
d7c12eb
afa937f
6c8b106
697950d
5706688
201e54e
4a12906
3425c25
7f75702
8bfed07
58ffa61
1e65556
4abb02c
63bf581
b43ccfa
f1c1ae6
f9a516c
fa8e9fb
fddb7f6
aa09b29
2f6c67e
de01200
ba378b9
69714db
6dba9bb
c3322fa
72bc9da
279cd7f
2bb21dd
ebe0d60
142544c
112e7e5
5ffabb7
ee8868a
1684f86
d1bebfd
1590fe1
a0e47d7
f585895
2a6f156
2b35903
b72c39e
a5028d2
9ce744b
6f94766
c841e3c
33f44ba
dfa7af1
8bdb8a9
692c286
59e7e1c
b26bb60
94436e2
77878ed
4367ea1
8687ea0
f82392d
93dbdc2
bf5b70e
4867fa6
05be19c
06b2a1e
621840b
44c0afa
e8adc95
19f9526
45580dd
9a38eb3
8388539
6d98bdf
42b91a2
e513a81
be5d58c
72a8769
fe1d20d
2ae03fb
637dfbc
f7beb35
f2d2d04
93a534e
d63101f
84774e8
779d8d9
83acf53
826259f
d1a8df9
ba9936e
95d59fd
7669c1d
8887d07
fc46ed6
825b675
eba43a3
726a54b
5a5675c
427e31f
eee4a19
073a2bd
79210ce
37cd87a
8aef539
dfb8233
c04ee86
fb4ec2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| using CommunityToolkit.Maui.Core; | ||
| using CommunityToolkit.Maui.Views; | ||
|
|
||
| namespace CommunityToolkit.Maui.Primitives; | ||
|
|
||
| /// <summary> | ||
| /// Represents the event arguments for the <see cref="FullScreenEvents.WindowsChanged"/> event. | ||
| /// </summary> | ||
| public class FullScreenEvents | ||
| { | ||
| /// <summary> | ||
| /// An event that is raised when the full screen state of the media element has changed. | ||
| /// </summary> | ||
| public event EventHandler<FullScreenStateChangedEventArgs>? WindowsChanged; | ||
ne0rrmatrix marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// <summary> | ||
| /// An event that is raised when the full screen state of the media element has changed. | ||
| /// </summary> | ||
| /// <param name="sender"></param> | ||
| /// <param name="e"></param> | ||
| public void OnFullScreenStateChanged(object? sender, FullScreenStateChangedEventArgs e) => WindowsChanged?.Invoke(sender, e); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||
| namespace CommunityToolkit.Maui.Core; | ||||
|
|
||||
| /// <summary> | ||||
| /// Event data for when the full screen state of the media element has changed. | ||||
| /// </summary> | ||||
| public sealed class FullScreenStateChangedEventArgs | ||||
ne0rrmatrix marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||
| { | ||||
| /// <summary> | ||||
| /// Initializes a new instance of the <see cref="FullScreenStateChangedEventArgs"/> class. | ||||
| /// </summary> | ||||
| /// <param name="previousState"></param> | ||||
| /// <param name="newState"></param> | ||||
| public FullScreenStateChangedEventArgs(MediaElementScreenState previousState, MediaElementScreenState newState) | ||||
| { | ||||
| PreviousState = previousState; | ||||
| NewState = newState; | ||||
| } | ||||
|
|
||||
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| namespace CommunityToolkit.Maui.Core; | ||
|
|
||
| /// <summary> | ||
| /// Represents the different screen states of a media element. | ||
| /// </summary> | ||
| public enum MediaElementScreenState | ||
| { | ||
| /// <summary> | ||
| /// Full screen. | ||
| /// </summary> | ||
| FullScreen, | ||
|
|
||
| /// <summary> | ||
| /// The default state. | ||
| /// </summary> | ||
| Default, | ||
| } | ||
|
Comment on lines
+6
to
+17
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -28,7 +28,8 @@ | |||||
| Player = new(); | ||||||
| PlayerViewController = new() | ||||||
| { | ||||||
| Player = Player | ||||||
| Player = Player, | ||||||
| Delegate = new MediaManagerDelegate() | ||||||
| }; | ||||||
|
|
||||||
| // Pre-initialize Volume and Muted properties to the player object | ||||||
|
|
@@ -317,7 +318,7 @@ | |||||
| return; | ||||||
| } | ||||||
|
|
||||||
| var videoTrack = PlayerItem.Asset.TracksWithMediaType(AVMediaTypes.Video.GetConstant()).FirstOrDefault(); | ||||||
|
Check warning on line 321 in src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.macios.cs
|
||||||
| if (videoTrack is not null) | ||||||
| { | ||||||
| return; | ||||||
|
|
@@ -512,7 +513,7 @@ | |||||
| var asset = avPlayerItem.Asset; | ||||||
|
|
||||||
| // Retrieve the video track | ||||||
| var videoTrack = asset.TracksWithMediaType(AVMediaTypes.Video.GetConstant()).FirstOrDefault(); | ||||||
|
Check warning on line 516 in src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.macios.cs
|
||||||
|
|
||||||
| if (videoTrack is not null) | ||||||
| { | ||||||
|
|
@@ -717,4 +718,16 @@ | |||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| sealed class MediaManagerDelegate : AVPlayerViewControllerDelegate | ||||||
| { | ||||||
| public override void WillBeginFullScreenPresentation(AVPlayerViewController playerViewController, IUIViewControllerTransitionCoordinator coordinator) | ||||||
| { | ||||||
| MediaManager.FullScreenEvents.OnFullScreenStateChanged(this, new FullScreenStateChangedEventArgs(MediaElementScreenState.Default, MediaElementScreenState.FullScreen)); | ||||||
| } | ||||||
|
||||||
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing documentation for the
newStateparameter. It should describe what the parameter represents. For example:/// <param name="newState">The new full screen state to update to.</param>