示例#1
0
        private void MpvOnEndFile(object sender, MpvEndFileEventArgs e)
        {
            bool shouldInvoke = !this.IsPlaying;

            // File died
            this.IsPlaying = false;
            this.Position  = 0;

            if (shouldInvoke)
            {
                this.Dispatcher.Invoke(() => MediaPlayerEnded?.Invoke());
            }
        }
示例#2
0
        private void MpvOnPropertyChange(object sender, MpvPropertyChangeEventArgs e)
        {
            var eventProperty = e.EventProperty;

            switch (e.ReplyUserData)
            {
            case timePosUserData:
                var newPosition = PointerReader.ReadDouble(eventProperty.Data);

                PlayerOnPositionChanged(newPosition);
                break;

            case eofUserData:
                if (eventProperty.DataString == "yes")
                {
                    this.Dispatcher.Invoke(() => MediaPlayerEnded?.Invoke());
                }
                break;
            }
        }