示例#1
0
        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);
            }
        }
示例#2
0
 public void Stop()
 {
     try
     {
         if (_audioView != null)
         {
             _audioView.Pause();
             _audioView.SeekTo(0);
         }
     }
     catch (Exception ex)
     {
         Log.Error("AudioView(Stop)", ex.Message);
     }
 }
示例#3
0
        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);
                }
            }
        }