private void PlayInternal(PlayOptions options) { EnsureMediaPlayerCreated(); CurrentPlaylistIndex = 0; CurrentPlayOptions = options; _playlist = options.Items.ToList(); _isPaused = false; var path = options.Items.First().Path; try { //var media = new PathMedia(@"D:\\Video\\TV\\30 Rock\\Season 1\\30 Rock - 1x02 - The Aftermath.mkv"); var media = path.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? (MediaBase) new LocationMedia(path) : (MediaBase) new PathMedia(path); //media.StateChanged += // delegate(MediaBase s, VlcEventArgs<States> args) // { // if (args.Data == States.Ended) // { // var subItems = media.SubItems; // if (subItems.Count > 0) // { // _vlcControl.Play(subItems[0]); // } // } // }; //media.MediaSubItemAdded += // delegate(MediaBase s, VlcEventArgs<MediaBase> args) // { // _vlcControl.Media = args.Data; // _vlcControl.Play(); // }; _vlcControl = new VlcControl(); _vlcControl.Media = media; _vlcControl.PlaybackMode = PlaybackModes.Loop; _vlcControl.Stopped += _vlcControl_Stopped; _vlcControl.Paused += _vlcControl_Paused; _vlcControl.Playing += _vlcControl_Playing; _vlcControl.Play(); _vlcControl.SetHandle(_hiddenWindow.Form.Handle); _userInput.GlobalKeyDown += _userInput_KeyDown; } catch (Exception ex) { _logger.ErrorException("Error beginning playback", ex); DisposePlayer(); } }