/// <summary> /// Plays the movie. /// </summary> public void PlayMovie() { IncrementPlayCount(); var ms = new MediaSource(this.TitleObject.SelectedDisk); ms.OnSave += new Action <MediaSource>(ms_OnSave); IPlayMovie moviePlayer = MoviePlayerFactory.CreateMoviePlayer(ms); moviePlayer.PlayMovie(); }
public bool PlayMovie() { Utilities.DebugLine("[MoviePlayerWPL] Total Items: " + _wplm.PlayListItems.Count + " Current Item: " + _currentItem); if (_wplm.PlayListItems.Count > _currentItem) { Utilities.DebugLine("[MoviePlayerWPL] Loading Video Player: " + _currentItem); try { PlayListItem item = (PlayListItem)_wplm.PlayListItems[_currentItem]; if (item != null) { _mItem.MediaPath = item.FileLocation; _mItem.Format = VideoFormat.WMV; Utilities.DebugLine("[MoviePlayerWPL] Playing now: " + _mItem.MediaPath); IPlayMovie player = MoviePlayerFactory.CreateMoviePlayer(_mItem); if (player != null) { player.PlayMovie(); // the MediaExperience object isn't loaded until a media file is playing //AddInHost.Current.MediaCenterEnvironment.MediaExperience.Transport.PropertyChanged -= MoviePlayerFactory.Transport_PropertyChanged; //AddInHost.Current.MediaCenterEnvironment.MediaExperience.Transport.PropertyChanged += MoviePlayerFactory.Transport_PropertyChanged; //AddInHost.Current.MediaCenterEnvironment.MediaExperience.Transport.PropertyChanged -= Transport_PropertyChanged; //AddInHost.Current.MediaCenterEnvironment.MediaExperience.Transport.PropertyChanged += Transport_PropertyChanged; } _currentItem++; } } catch (Exception e) { Utilities.DebugLine("[MoviePlayerWPL] Error: " + e.Message); return(false); } } else { _currentItem = 0; } return(true); }