Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SurfaceDialMediaPlayerElement
readonly RadialController _controller;
public MediaPlayerPagePage()
{
InitializeComponent();
mpe.PosterSource = new BitmapImage(new Uri(DefaultPoster));
mpe.Source = MediaSource.CreateFromUri(new Uri(DefaultSource));
_controller = RadialController.CreateForCurrentView();
_controller.RotationResolutionInDegrees = 5;
_controller.UseAutomaticHapticFeedback = false;
var myItem = RadialControllerMenuItem.CreateFromFontGlyph("El Bruno - Playback", "\xE714", "Segoe MDL2 Assets");
_controller.Menu.Items.Add(myItem);
_controller.ButtonClicked += ControllerButtonClicked;
_controller.RotationChanged += ControllerRotationChanged;
}
private void ControllerRotationChanged(RadialController sender, RadialControllerRotationChangedEventArgs args)
{
mpe.MediaPlayer.Position = mpe.MediaPlayer.Position + TimeSpan.FromSeconds(args.RotationDeltaInDegrees);
}
private void ControllerButtonClicked(RadialController sender, RadialControllerButtonClickedEventArgs args)
{
if (mpe.MediaPlayer.CurrentState == MediaPlayerState.Playing)
{
mpe.MediaPlayer.Pause();
}
else
{
mpe.MediaPlayer.Play();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment