コード例 #1
0
        //public async Task EnsureNextVideoMatchesConditionsAsync(bool skipping) {
        //    int QueuePos = skipping ? 0 : 1;
        //    if (nextVideo != null && PlayMode == PlayerMode.Normal) {
        //        // Get new conditions
        //        GetConditionsEventArgs Args = new GetConditionsEventArgs(FilterSettings);
        //        Args.QueuePos = QueuePos;
        //        if (GetConditions != null)
        //            GetConditions(this, Args);

        //        // Run the conditions on the next video in the playlist
        //        if (!PlayerAccess.VideoMatchesConditions(nextVideo, FilterSettings.Update(playedVideos, Settings.SavedFile.AutoDownload))) {
        //            // If next video doesn't match conditions, select another one
        //            await SelectNextVideoAsync(QueuePos);
        //        }
        //    } else if (nextVideo == null)
        //        await SelectNextVideoAsync(QueuePos);
        //}

        public void ReloadVideoInfo()
        {
            if (player.CurrentVideo != null)
            {
                player.CurrentVideo = PlayerAccess.GetVideoById(player.CurrentVideo.MediaId);
                Application.Current.Dispatcher.Invoke(() => NowPlaying?.Invoke(this, new NowPlayingEventArgs(true)));
            }
        }
 protected void OnNowPlaying(string str)
 {
     NowPlaying?.Invoke(this, str);
 }
コード例 #3
0
 /// <summary>
 /// When the player is playing a file, start the timer and notify the UI.
 /// </summary>
 private void player_NowPlaying(object sender, EventArgs e)
 {
     timerSession.Start();
     Application.Current.Dispatcher.Invoke(() => NowPlaying?.Invoke(this, new NowPlayingEventArgs()));
 }
コード例 #4
0
        /* Messages sent from slave to master to inform about the current state
         */
        private void OnMessageFromSlave(MediaPlayerMessage msg)
        {
            switch (msg.Action)
            {
            case "playing":
                Playing?.Invoke(this, null);
                break;

            case "stopped":
                Stopped?.Invoke(this, null);
                break;

            case "error":
                Error?.Invoke(this, null);
                break;

            case "ended":
                Ended?.Invoke(this, null);
                break;

            case "now-playing":
                NowPlaying?.Invoke(this, msg.Mrl);
                break;

            case "position":
                PositionChanged?.Invoke(this, msg.Position);
                break;

            case "paused":
                Paused?.Invoke(this, null);
                break;

            case "opening":
                Opening?.Invoke(this, null);
                break;

            case "seekable-changed":
                //TODO: Need to be able to send bool
                break;

            case "pausable-changed":
                //TODO: Need to be able to send bool
                break;

            case "volume":
            case "getvolume":
                Volume = (int)Math.Round(msg.Volume * 100f);
                VolumeChanged?.Invoke(this, null);
                break;

            case "has-subtitles-changed":
                //TODO: Need to be able to send bool
                break;

            case "has-next-changed":
                //TODO: Need to be able to send bool
                break;

            case "duration-changed":
                //TODO: Need to be able to send bool
                break;

            default:
                break;
            }
        }