public void Play() { try { if (_videoView != null) { this.Show(); _videoView.SeekTo(0); _videoView.Start(); //_videoView.RequestFocus(); if (OnStart != null) { OnStart(); } } } catch (Exception ex) { Log.Error("VideoView(Play)", ex.Message); } }
public void Stop() { try { if (_audioView != null) { _audioView.Pause(); _audioView.SeekTo(0); } } catch (Exception ex) { Log.Error("AudioView(Stop)", ex.Message); } }
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs args) { base.OnElementPropertyChanged(sender, args); if (args.PropertyName == VideoPlayer.AreTransportControlsEnabledProperty.PropertyName) { SetAreTransportControlsEnabled(); } else if (args.PropertyName == VideoPlayer.SourceProperty.PropertyName) { SetSource(); } else if (args.PropertyName == VideoPlayer.PositionProperty.PropertyName) { if (Math.Abs(videoView.CurrentPosition - Element.Position.TotalMilliseconds) > 1000) { videoView.SeekTo((int)Element.Position.TotalMilliseconds); } } }