private async void receiver_PlaybackRateChangeRequested(PlayToReceiver recv, PlaybackRateChangeRequestedEventArgs args) { await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { if (dmrVideo != null && currentType == MediaType.AudioVideo) { if (dmrVideo.CurrentState != MediaElementState.Opening && dmrVideo.CurrentState != MediaElementState.Closed) { dmrVideo.PlaybackRate = args.Rate; } else { bufferedPlaybackRate = args.Rate; } } }); }
private void systemMediaControls_PlaybackRateChangeRequested(SystemMediaTransportControls smtc, PlaybackRateChangeRequestedEventArgs args) { }
// <SnippetPlaybackChangedHandler> void SystemControls_PlaybackRateChangeRequested(SystemMediaTransportControls sender, PlaybackRateChangeRequestedEventArgs args) { // Check the requested value to make sure it is within a valid and expected range if (args.RequestedPlaybackRate >= 0 && args.RequestedPlaybackRate <= 2) { // Set the requested value on the MediaElement mediaElement.PlaybackRate = args.RequestedPlaybackRate; // Update the system media controls to reflect the new value _systemMediaTransportControls.PlaybackRate = mediaElement.PlaybackRate; } }
/// <summary> /// Handles a request from the System Media Transport Controls to change our current playback rate /// </summary> private async void systemMediaControls_PlaybackRateChangeRequested(SystemMediaTransportControls sender, PlaybackRateChangeRequestedEventArgs args) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { // Check to make sure the requested value is in a range we deem appropriate, if so set it on the MediaPlayer. // We then need to turn around and update SMTC so that the system knows the new value. if (args.RequestedPlaybackRate >= 0 && args.RequestedPlaybackRate <= 2) { mediaPlayer.PlaybackSession.PlaybackRate = args.RequestedPlaybackRate; systemMediaControls.PlaybackRate = mediaPlayer.PlaybackSession.PlaybackRate; } rootPage.NotifyUser("Playback rate change requested", NotifyType.StatusMessage); }); }
private void _SMTC_PlaybackRateChangeRequested(SystemMediaTransportControls sender, PlaybackRateChangeRequestedEventArgs args) { WriteChromeNativeMessageToSTDIO(new JProperty("Command", new JProperty("RequestedPlaybackRate", args.RequestedPlaybackRate))); }
private async void receiver_PlaybackRateChangeRequested(PlayToReceiver sender, PlaybackRateChangeRequestedEventArgs args) { await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { VideoSource.PlaybackRate = args.Rate; }); }
private void HandleReceiverPlaybackRateChangeRequested(PlayToReceiver sender, PlaybackRateChangeRequestedEventArgs args) { Dispatch(() => { if (_currentPlaybackType == PlaybackType.Video) { VideoPlayer.PlaybackRate = args.Rate; // Receiver notification occurs in the HandleVideoPlayerRateChanged handler } else if (_currentPlaybackType == PlaybackType.Image) { // Setting playback rate is a no-op in image playback. Just indicate it was accepted _receiver.NotifyRateChange(args.Rate); } }); }