private void QueuePlayableItemLegacy(PlayableItem playable) { Microsoft.MediaCenter.MediaType type = MediaType.Audio; bool success = true; if (playable.HasMediaItems && playable.MediaItems.All(f => f.WillStream && f is Song)) { IEnumerable <string> files = playable.FilesFormattedForPlayer; string playlistFile = PlaybackControllerHelper.CreateASXPlaylist(playable); if (!PlaybackControllerHelper.CallPlayMedia(Application.MediaCenterEnvironment, type, playlistFile, true)) { success = false; } } else { foreach (string file in playable.FilesFormattedForPlayer) { if (!PlaybackControllerHelper.CallPlayMedia(Application.MediaCenterEnvironment, type, file, true)) { success = false; break; } } } if (!success) { OnErrorPlayingItem(playable, "PlayMedia returned false"); } }
/// <summary> /// Calls PlayMedia /// </summary> private bool CallPlayMediaLegacy(MediaCenterEnvironment mediaCenterEnvironment, PlayableItem playable) { Microsoft.MediaCenter.MediaType type = PlaybackControllerHelper.GetMediaType(playable); bool playedWithPlaylist = false; // Need to create a playlist if (PlaybackControllerHelper.RequiresWPL(playable)) { IEnumerable <string> files = playable.FilesFormattedForPlayer; string playlistFile = PlaybackControllerHelper.CreateWPLPlaylist(playable.Id.ToString(), files, playable.StartPlaylistPosition); if (!PlaybackControllerHelper.CallPlayMedia(mediaCenterEnvironment, type, playlistFile, false)) { return(false); } playedWithPlaylist = true; } // If we're playing a dvd and the last item played was a MediaCollection, we need to make sure the MediaCollection has // fully cleared out of the player or there will be quirks such as ff/rew remote buttons not working if (playable.HasMediaItems) { Video video = playable.MediaItems.First() as Video; Microsoft.MediaCenter.Extensibility.MediaType lastMediaType = PlaybackControllerHelper.GetCurrentMediaType(); if (video != null && video.MediaType == Library.MediaType.DVD && (lastMediaType == Microsoft.MediaCenter.Extensibility.MediaType.MediaCollection || lastMediaType == Microsoft.MediaCenter.Extensibility.MediaType.Unknown)) { System.Threading.Thread.Sleep(500); } } if (!playedWithPlaylist) { bool queue = false; foreach (string fileToPlay in playable.FilesFormattedForPlayer) { if (!PlaybackControllerHelper.CallPlayMedia(mediaCenterEnvironment, type, fileToPlay, queue)) { return(false); } queue = true; } } return(true); }
private void QueuePlayableItemLegacy(PlayableItem playable) { Microsoft.MediaCenter.MediaType type = MediaType.Audio; bool success = true; foreach (string file in playable.FilesFormattedForPlayer) { if (!PlaybackControllerHelper.CallPlayMedia(AddInHost.Current.MediaCenterEnvironment, type, file, true)) { success = false; break; } } if (!success) { OnErrorPlayingItem(playable, "PlayMedia returned false"); } }