Created
August 12, 2021 16:20
-
-
Save rdelrosario/c73e031c2946392ba55198d554be88c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class VideoPlayer : MediaElement | |
{ | |
public static readonly BindableProperty CommandProperty = | |
BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(VideoPlayer), defaultBindingMode: BindingMode.OneWayToSource); | |
public ICommand Command | |
{ | |
get => (ICommand) GetValue(CommandProperty); | |
set => SetValue(CommandProperty, value); | |
} | |
public VideoPlayer() | |
{ | |
ShowsPlaybackControls = false; | |
Command = new Command<VideoTrigger>(ExecuteTrigger); | |
} | |
private void ExecuteTrigger(VideoTrigger trigger) | |
{ | |
switch (trigger) | |
{ | |
case VideoTrigger.Play: | |
Play(); | |
break; | |
case VideoTrigger.Pause: | |
Pause(); | |
break; | |
case VideoTrigger.Stop: | |
Stop(); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment