Esempio n. 1
0
        /// <summary>
        /// Loads the ressources and synchronizes the position.
        /// </summary>
        public void LoadAndSync()
        {
            if (_player.Source != AssociatedItem)
            {
                _player.Source = AssociatedItem;
            }

            _player.MediaElement.Pause();

            _player.MediaElement.MediaStartingPosition = AssociatedItem.VideoStart;
            _player.MediaElement.MediaPosition         = AssociatedItem.VideoStart + Convert.ToInt64((_player.Position - AssociatedItem.Start) * this.InitialSpeedRatio);

            TrySetSpeedRatio(_player.GetCurrentActionActualSpeedRatio());
        }
Esempio n. 2
0
        private void OnTimeLineUpdate(object sender, EventArgs e)
        {
            if (_player != null && _player.IsPlaying && _player.CurrentAction == this)
            {
                var globalPosition = _player.InternalPosition + Convert.ToInt64(_timeline.Interval.Ticks * _player.SpeedRatio);

                if (globalPosition > End)
                {
                    _timeline.IsEnabled      = false;
                    _player.InternalPosition = End;
                    RaiseCompleted();
                }
                else
                {
                    _player.InternalPosition += Convert.ToInt64(_timeline.Interval.Ticks * _player.SpeedRatio);

                    var speedRatio = _player.GetCurrentActionActualSpeedRatio();
                    _speedRatio = speedRatio;
                }
            }
        }