本文整理汇总了C#中PlayListType类的典型用法代码示例。如果您正苦于以下问题:C# PlayListType类的具体用法?C# PlayListType怎么用?C# PlayListType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayListType类属于命名空间,在下文中一共展示了PlayListType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public virtual void Save(System.String FileName, PlayListType FileType)
{
System.IO.FileStream File = System.IO.File.Create(this.MusicPath + System.IO.Path.DirectorySeparatorChar + FileName);
System.Text.ASCIIEncoding Encoder = new System.Text.ASCIIEncoding();
System.String Content;
switch (FileType)
{
case PlayListType.pls:
Content = this.GetPLS();
break;
case PlayListType.m3u:
Content = this.GetM3U();
break;
default:
Content = this.GetSMIL();
break;
}
File.Write(Encoder.GetBytes(Content), 0, Encoder.GetByteCount(Content));
File.Flush();
File.Close();
}
示例2: OnPlayAll
// Play all files in selected directory
private void OnPlayAll(string path)
{
// Get all video files in selected folder and it's subfolders
ArrayList playFiles = new ArrayList();
AddVideoFiles(path, ref playFiles);
if(playFiles.Count == 0)
{
return;
}
int selectedOption = 0;
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
// Check and play according to setting value
if (_howToPlayAll == 3) // Ask, select sort method from options in GUIDialogMenu
{
if (dlg == null)
{
return;
}
dlg.Reset();
dlg.SetHeading(498); // menu
dlg.AddLocalizedString(103); // By Name
dlg.AddLocalizedString(104); // By Date
dlg.AddLocalizedString(191); // Shuffle
// Show GUIDialogMenu
dlg.DoModal(GetID);
if (dlg.SelectedId == -1)
{
return;
}
selectedOption = dlg.SelectedId;
}
else // Don't ask, sort according to setting and play videos
{
selectedOption = _howToPlayAll;
}
// Get current playlist
_currentPlaylistType = new PlayListType();
_currentPlaylistType = _playlistPlayer.CurrentPlaylistType;
_currentPlaylistIndex = _playlistPlayer.CurrentSong;
// Reset playlist
_playlistPlayer.Reset();
_playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO;
PlayList tmpPlayList = _playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO);
tmpPlayList.Clear();
// Do sorting
switch (selectedOption)
{
//
// ****** Watch out for fallthrough of empty cases if reordering CASE *******
//
case 0: // By name == 103
case 103:
AddToPlayList(tmpPlayList, playFiles.ToArray());
List<PlayListItem> sortedPlayListItems = new List<PlayListItem>();
sortedPlayListItems.AddRange(tmpPlayList);
sortedPlayListItems.Sort((item1, item2) => StringLogicalComparer.Compare(item1.Description, item2.Description));
tmpPlayList.Clear();
foreach (PlayListItem playListItem in sortedPlayListItems)
{
tmpPlayList.Add(playListItem);
}
break;
case 1: // By date (date modified) == 104
case 104:
IOrderedEnumerable<object> sortedPlayList = playFiles.ToArray().OrderBy(fn => new FileInfo((string)fn).LastWriteTime);
AddToPlayList(tmpPlayList, sortedPlayList);
break;
case 2: // Shuffle == 191
case 191:
AddToPlayList(tmpPlayList, playFiles.ToArray());
tmpPlayList.Shuffle();
break;
}
// Play movies
PlayMovieFromPlayList(false, true);
}
示例3: SavePlayerState
/// <summary>
/// Save player state (when form was resized)
/// </summary>
protected void SavePlayerState()
{
if (!_wasPlayingVideo && (g_Player.Playing && (g_Player.IsTV || g_Player.IsVideo || g_Player.IsDVD)))
{
_wasPlayingVideo = true;
// Some Audio/video is playing
_currentPlayerPos = g_Player.CurrentPosition;
_currentPlayListType = PlaylistPlayer.CurrentPlaylistType;
_currentPlayList = new PlayList();
Log.Info("D3D: Saving fullscreen state for resume: {0}", Menu == null);
var tempList = PlaylistPlayer.GetPlaylist(_currentPlayListType);
if (tempList.Count == 0 && g_Player.IsDVD)
{
// DVD is playing
var itemDVD = new PlayListItem {FileName = g_Player.CurrentFile, Played = true, Type = PlayListItem.PlayListItemType.DVD};
tempList.Add(itemDVD);
}
foreach (var itemNew in tempList)
{
_currentPlayList.Add(itemNew);
}
_currentFile = PlaylistPlayer.Get(PlaylistPlayer.CurrentSong);
if (_currentFile.Equals(string.Empty) && g_Player.IsDVD)
{
_currentFile = g_Player.CurrentFile;
}
Log.Info("D3D: Stopping media - Current playlist: Type: {0} / Size: {1} / Current item: {2} / Filename: {3} / Position: {4}",
_currentPlayListType, _currentPlayList.Count, PlaylistPlayer.CurrentSong, _currentFile, _currentPlayerPos);
g_Player.Stop();
_lastActiveWindow = GUIWindowManager.ActiveWindow;
}
}
示例4: GetPlaylist
public PlayList GetPlaylist(PlayListType nPlayList)
{
switch (nPlayList)
{
case PlayListType.PLAYLIST_MUSIC:
return _musicPlayList;
case PlayListType.PLAYLIST_MUSIC_TEMP:
return _tempMusicPlayList;
case PlayListType.PLAYLIST_VIDEO:
return _videoPlayList;
case PlayListType.PLAYLIST_VIDEO_TEMP:
return _tempVideoPlayList;
case PlayListType.PLAYLIST_MUSIC_VIDEO:
return _musicVideoPlayList;
case PlayListType.PLAYLIST_RADIO_STREAMS:
return _radioStreamPlayList;
case PlayListType.PLAYLIST_LAST_FM:
return _lastFMPlaylist;
default:
_emptyPlayList.Clear();
return _emptyPlayList;
}
}
示例5: playlistPlayer_Changed
private void playlistPlayer_Changed(PlayListType nPlayList, PlayList playlist)
{
// update of playlist control is done by skin engine when moving item up / down
// but moving the item in the playlist triggers an event
// we do not want to reload if an item has been moved
if (!_movingItem)
{
DoRefreshList();
}
}
示例6: OnMessage
public void OnMessage(GUIMessage message)
{
switch (message.Message)
{
case GUIMessage.MessageType.GUI_MSG_PLAYBACK_STOPPED:
{
PlayListItem item = GetCurrentItem();
if (item != null)
{
if (item.Type != PlayListItem.PlayListItemType.AudioStream)
{
if (!Player.g_Player.IsPicturePlaylist)
{
Reset();
_currentPlayList = PlayListType.PLAYLIST_NONE;
}
else
{
Player.g_Player.IsPicturePlaylist = false;
}
}
}
GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS, 0, 0, 0, -1, 0, null);
GUIGraphicsContext.SendMessage(msg);
}
break;
// Allows a Musicplayer to continuously play
// Note: BASS Player uses a different technique now, because of Gapless Playback
// The handling of the message is left for backward compatibility with 3rd party plugins
case GUIMessage.MessageType.GUI_MSG_PLAYBACK_CROSSFADING:
{
PlayNext();
}
break;
case GUIMessage.MessageType.GUI_MSG_PLAYBACK_ENDED:
{
// This message is sent by both the internal and BASS player
// In case of gapless/crossfading it is only sent after the last song
PlayNext(false);
if (!g_Player.Playing)
{
g_Player.Release();
// Clear focus when playback ended
GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS, 0, 0, 0, -1, 0, null);
GUIGraphicsContext.SendMessage(msg);
}
}
break;
case GUIMessage.MessageType.GUI_MSG_PLAY_FILE:
{
Log.Info("Playlistplayer: Start file ({0})", message.Label);
g_Player.Play(message.Label);
if (!g_Player.Playing)
{
g_Player.Stop();
}
}
break;
case GUIMessage.MessageType.GUI_MSG_STOP_FILE:
{
Log.Info("Playlistplayer: Stop file");
g_Player.Stop();
}
break;
case GUIMessage.MessageType.GUI_MSG_SEEK_FILE_PERCENTAGE:
{
Log.Info("Playlistplayer: SeekPercent ({0}%)", message.Param1);
g_Player.SeekAsolutePercentage(message.Param1);
Log.Debug("Playlistplayer: SeekPercent ({0}%) done", message.Param1);
}
break;
case GUIMessage.MessageType.GUI_MSG_SEEK_FILE_END:
{
double duration = g_Player.Duration;
double position = g_Player.CurrentPosition;
if (position < duration - 1d)
{
Log.Info("Playlistplayer: SeekEnd ({0})", duration);
g_Player.SeekAbsolute(duration - 2d);
Log.Debug("Playlistplayer: SeekEnd ({0}) done", g_Player.CurrentPosition);
}
}
break;
case GUIMessage.MessageType.GUI_MSG_SEEK_POSITION:
{
g_Player.SeekAbsolute(message.Param1);
}
break;
}
}
示例7: Remove
public void Remove(PlayListType type, string filename)
{
PlayList playlist = GetPlaylist(type);
int itemRemoved = playlist.Remove(filename);
if (type != CurrentPlaylistType)
{
return;
}
if (_currentItem >= itemRemoved)
{
_currentItem--;
}
}
示例8: OnPlaylistChanged
private void OnPlaylistChanged(PlayListType nPlayList, PlayList playlist)
{
// changes to the current track are dealt with by g_player events
// but user can udpate the playlist without firing g_player events
// make sure the next track details shown are correct
if ((_playlistIsCurrent && nPlayList == PlayListType.PLAYLIST_MUSIC) ||
(!_playlistIsCurrent && nPlayList == PlayListType.PLAYLIST_MUSIC_TEMP))
{
var nextFilename = playlistPlayer.GetNext();
if (!string.IsNullOrEmpty(nextFilename))
{
var tag = GetTag(nextFilename);
SetNextSkinProperties(tag, nextFilename);
}
else
{
SetNextSkinProperties(null, string.Empty);
}
}
}
示例9: OnMessage
public void OnMessage(GUIMessage message)
{
if(PlayListPlayer.SingletonPlayer.CurrentPlaylistType!=PlayListType.PLAYLIST_NONE)
return;
switch (message.Message)
{
case GUIMessage.MessageType.GUI_MSG_PLAYBACK_STOPPED:
{
PlayListItem item = GetCurrentItem();
if (item != null)
{
if (item.Type != PlayListItem.PlayListItemType.Radio ||
item.Type != PlayListItem.PlayListItemType.AudioStream)
{
Reset();
_currentPlayList = PlayListType.PLAYLIST_NONE;
}
}
GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS, 0, 0, 0, -1, 0, null);
GUIGraphicsContext.SendMessage(msg);
}
break;
// SV Allows BassMusicPlayer to continuously play
case GUIMessage.MessageType.GUI_MSG_PLAYBACK_CROSSFADING:
{
// This message is only sent by BASS in gapless/crossfading mode
PlayNext();
}
break;
case GUIMessage.MessageType.GUI_MSG_PLAYBACK_ENDED:
{
// This message is sent by both the internal and BASS player
// In case of gapless/crossfading it is only sent after the last song
PlayNext();
if (!g_Player.Playing)
{
g_Player.Release();
// Clear focus when playback ended
GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS, 0, 0, 0, -1, 0, null);
GUIGraphicsContext.SendMessage(msg);
}
}
break;
case GUIMessage.MessageType.GUI_MSG_PLAY_FILE:
{
Log.Info("YoutubePlaylistplayer: Start file ({0})", message.Label);
g_Player.Play(message.Label);
if (!g_Player.Playing)
{
g_Player.Stop();
}
}
break;
case GUIMessage.MessageType.GUI_MSG_STOP_FILE:
{
Log.Info("YoutubePlaylistplayer: Stop file");
g_Player.Stop();
}
break;
case GUIMessage.MessageType.GUI_MSG_SEEK_FILE_PERCENTAGE:
{
Log.Info("YoutubePlaylistplayer: SeekPercent ({0}%)", message.Param1);
g_Player.SeekAsolutePercentage(message.Param1);
Log.Debug("YoutubePlaylistplayer: SeekPercent ({0}%) done", message.Param1);
}
break;
case GUIMessage.MessageType.GUI_MSG_SEEK_FILE_END:
{
double duration = g_Player.Duration;
double position = g_Player.CurrentPosition;
if (position < duration - 1d)
{
Log.Info("YoutubePlaylistplayer: SeekEnd ({0})", duration);
g_Player.SeekAbsolute(duration - 2d);
Log.Debug("YoutubePlaylistplayer: SeekEnd ({0}) done", g_Player.CurrentPosition);
}
}
break;
case GUIMessage.MessageType.GUI_MSG_SEEK_POSITION:
{
g_Player.SeekAbsolute(message.Param1);
}
break;
}
}
示例10: PlayNext
public void PlayNext()
{
if (_currentPlayList == PlayListType.PLAYLIST_NONE)
{
return;
}
PlayList playlist = GetPlaylist(_currentPlayList);
if (playlist.Count <= 0)
{
return;
}
int iSong = _currentItem;
iSong++;
if (iSong >= playlist.Count)
{
// Is last element of video stacking playlist?
if (_currentPlayList == PlayListType.PLAYLIST_VIDEO_TEMP)
{
// Disable playlist playback
_currentPlayList = PlayListType.PLAYLIST_NONE;
return;
}
if (!_repeatPlayList)
{
_currentPlayList = PlayListType.PLAYLIST_NONE;
return;
}
iSong = 0;
}
if (!Play(iSong))
{
if (!g_Player.Playing)
{
PlayNext();
}
}
}
示例11: SavePlayerState
/// <summary>
/// Save player state (when form was resized)
/// </summary>
protected void SavePlayerState()
{
// Is App not minimized to tray and is a player active?
if (WindowState != FormWindowState.Minimized &&
!_wasPlayingVideo &&
(g_Player.Playing && (g_Player.IsTV || g_Player.IsVideo || g_Player.IsDVD)))
{
_wasPlayingVideo = true;
_fullscreen = g_Player.FullScreen;
// Some Audio/video is playing
_currentPlayerPos = g_Player.CurrentPosition;
_currentPlayListType = playlistPlayer.CurrentPlaylistType;
_currentPlayList = new PlayList();
Log.Info("D3D: Saving fullscreen state for resume: {0}", _fullscreen);
PlayList tempList = playlistPlayer.GetPlaylist(_currentPlayListType);
if (tempList.Count == 0 && g_Player.IsDVD == true)
{
// DVD is playing
PlayListItem itemDVD = new PlayListItem();
itemDVD.FileName = g_Player.CurrentFile;
itemDVD.Played = true;
itemDVD.Type = PlayListItem.PlayListItemType.DVD;
tempList.Add(itemDVD);
}
if (tempList != null)
{
for (int i = 0; i < (int)tempList.Count; ++i)
{
PlayListItem itemNew = tempList[i];
_currentPlayList.Add(itemNew);
}
}
_strCurrentFile = playlistPlayer.Get(playlistPlayer.CurrentSong);
if (_strCurrentFile.Equals(string.Empty) && g_Player.IsDVD == true)
{
_strCurrentFile = g_Player.CurrentFile;
}
Log.Info(
"D3D: Form resized - Stopping media - Current playlist: Type: {0} / Size: {1} / Current item: {2} / Filename: {3} / Position: {4}",
_currentPlayListType, _currentPlayList.Count, playlistPlayer.CurrentSong, _strCurrentFile, _currentPlayerPos);
g_Player.Stop();
_iActiveWindow = GUIWindowManager.ActiveWindow;
}
}
示例12: OnPageLoad
protected override void OnPageLoad()
{
base.OnPageLoad();
if (string.IsNullOrEmpty(playlistname))
{
GUIPropertyManager.SetProperty("#currentmodule", "Playlist");
}
else
{
GUIPropertyManager.SetProperty("#currentmodule", "Playlist/" + playlistname);
}
_playlistType = PlayListType.PLAYLIST_MUSIC_VIDEO;
currentView = View.PlayList;
facadeView.CurrentLayout = GUIFacadeControl.Layout.Playlist;
LoadDirectory(string.Empty);
if (m_iItemSelected >= 0)
{
GUIControl.SelectItemControl(GetID, facadeView.GetID, m_iItemSelected);
}
if ((m_iLastControl == facadeView.GetID) && facadeView.Count <= 0)
{
m_iLastControl = btnNowPlaying.GetID;
GUIControl.FocusControl(GetID, m_iLastControl);
}
if (facadeView.Count <= 0)
{
GUIControl.FocusControl(GetID, btnViewAs.GetID);
}
using (MediaPortal.Profile.Settings settings = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
{
playlistPlayer.RepeatPlaylist = settings.GetValueAsBool("youtubeplaylist", "repeat", true);
ScrobblerOn = settings.GetValueAsBool("youtubeplaylist", "ScrobblerOn", true);
currentScrobbleMode =(ScrobbleMode) settings.GetValueAsInt("youtubeplaylist", "ScrobblerMode", 0);
}
if (btnRepeatPlaylist != null)
{
btnRepeatPlaylist.Selected = playlistPlayer.RepeatPlaylist;
}
if (ScrobblerOn)
btnScrobble.Selected = true;
SetScrobbleButonLabel();
SelectCurrentPlayingSong();
}
示例13: CreatePlayListItemItem
/// <summary>
/// Play a media item described by its' MpExtended properties (item id/item type/provider id)
/// </summary>
/// <param name="itemId">MpExtended item id</param>
/// <param name="mediaType">MpExtended media type</param>
/// <param name="providerId">MpExtended provider id</param>
/// <param name="playInfo">Additional information to playback the item</param>
public static List<PlayListItem> CreatePlayListItemItem(string itemId, int mediaType, int providerId, Dictionary<string, string> playInfo, out PlayListType playlistType)
{
playlistType = PlayListType.PLAYLIST_VIDEO;//default to video
try
{
List<PlayListItem> items = new List<PlayListItem>();
MpExtendedProviders provider = (MpExtendedProviders)providerId;
MpExtendedMediaTypes type = (MpExtendedMediaTypes)mediaType;
switch (provider)
{
case MpExtendedProviders.MovingPictures:
if (WifiRemote.IsAvailableMovingPictures)
{
playlistType = PlayListType.PLAYLIST_VIDEO;
items.Add(MovingPicturesHelper.CreatePlaylistItem(Int32.Parse(playInfo["Id"])));
}
else
{
WifiRemote.LogMessage("MovingPictures not installed but required!", WifiRemote.LogType.Error);
}
break;
case MpExtendedProviders.MPTvSeries:
if (WifiRemote.IsAvailableTVSeries)
{
playlistType = PlayListType.PLAYLIST_VIDEO;
if (type == MpExtendedMediaTypes.TVEpisode)
{
items.Add(TVSeriesHelper.CreatePlaylistItemFromEpisode(playInfo["Id"]));
}
else if (type == MpExtendedMediaTypes.TVSeason)
{
items = TVSeriesHelper.CreatePlaylistItemsFromSeason(Int32.Parse(playInfo["ShowId"]), Int32.Parse(playInfo["SeasonIndex"]));
}
else if (type == MpExtendedMediaTypes.TVShow)
{
items = TVSeriesHelper.CreatePlaylistItemsFromShow(Int32.Parse(playInfo["Id"]));
}
}
else
{
WifiRemote.LogMessage("MP-TvSeries not installed but required!", WifiRemote.LogType.Error);
}
break;
case MpExtendedProviders.MPMusic:
playlistType = PlayListType.PLAYLIST_MUSIC;
if (type == MpExtendedMediaTypes.MusicTrack)
{
items.Add(MpMusicHelper.CreatePlaylistItemFromMusicTrack(Int32.Parse(playInfo["Id"])));
}
else if (type == MpExtendedMediaTypes.MusicAlbum)
{
items = MpMusicHelper.CreatePlaylistItemsFromMusicAlbum(playInfo["Artist"], playInfo["Album"]);
}
else if (type == MpExtendedMediaTypes.MusicArtist)
{
items = MpMusicHelper.CreatePlaylistItemsFromMusicArtist(playInfo["Artist"]);
// MpMusicHelper.PlayArtist(playInfo["Artist"], startPos);
}
break;
case MpExtendedProviders.MPVideo:
playlistType = PlayListType.PLAYLIST_VIDEO;
//MpVideosHelper.PlayVideo(Int32.Parse(playInfo["Id"]), startPos);
break;
case MpExtendedProviders.MpVideosShare:
playlistType = PlayListType.PLAYLIST_VIDEO;
if (type == MpExtendedMediaTypes.File)
{
//TODO: fill myvideos db information instead of just playing the file
items.Add(MpVideosHelper.CreatePlaylistItemFromVideoFile(playInfo["Path"]));
}
else if (type == MpExtendedMediaTypes.Folder)
{
string[] extensions = playInfo["Extensions"].Split('|');
items = MpVideosHelper.CreatePlaylistItemFromVideoFolder(playInfo["Path"], extensions);
}
break;
case MpExtendedProviders.MpMusicShare:
playlistType = PlayListType.PLAYLIST_MUSIC;
if (type == MpExtendedMediaTypes.File)
{
//MpMusicHelper.PlayFile(playInfo["Path"], startPos);
}
else if (type == MpExtendedMediaTypes.Folder)
{
//string[] extensions = playInfo["Extensions"].Split('|');
//MpMusicHelper.PlayAllFilesInFolder(playInfo["Path"], extensions, startPos);
}
break;
default:
playlistType = PlayListType.PLAYLIST_VIDEO;
//we have no providers (yet) for tv
//.........这里部分代码省略.........
示例14: PlayNext
/// <summary>
/// Play next video in playlist
/// </summary>
public void PlayNext()
{
timerClearProperty.Enabled = false;
if (_currentPlayList == PlayListType.PLAYLIST_NONE)
return;
PlayList playlist = GetPlaylist(_currentPlayList);
if (playlist.Count <= 0)
return;
int iItem = _currentItem;
iItem++;
if (iItem >= playlist.Count)
{
if (!_repeatPlayList)
{
_currentPlayList = PlayListType.PLAYLIST_NONE;
return;
}
iItem = 0;
}
if (m_bIsExternalPlayer && externalPlayerStopped)
return;
if (!Play(iItem))
{
if (!mvPlayer.Playing)
{
PlayNext();
}
}
}
示例15: AddPlaylistItems
/// <summary>
/// Add a list of playlist items to the current playlist
/// </summary>
/// <param name="type">Type of playlist (e.g. video/music)</param>
/// <param name="items">Items that we want to add</param>
/// <param name="startIndex">Where should the items be added (-1 will append them at the end)</param>
internal static void AddPlaylistItems(PlayListType type, List<PlayListItem> items, int startIndex)
{
PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
PlayList playList = playListPlayer.GetPlaylist(type);
if (startIndex == -1 || startIndex >= playList.Count)
{
startIndex = playList.Count;
}
else if (startIndex < 0)
{
startIndex = 0;
}
for (int i = 0; i < items.Count; i++)
{
//Note: we need -1 here, because Insert wants the item after which the song should be inserted, not the actual index
playList.Insert(items[i], i + startIndex - 1);
}
}