Exemple #1
0
        /// <summary>
        /// Add an item to the playlist.
        /// </summary>
        /// <param name="uri">The URI of the item to add.</param>
        /// <param name="name">An optional name for the new item.</param>
        /// <param name="options">Whether to use the new item's audio, video or both.</param>
        /// <param name="playImmediately">If set to <c>true</c> start playback immediately.</param>
        private async Task Add(string uri, string name, VlcPlaylistAddMode options, bool playImmediately)
        {
            StringBuilder command = new StringBuilder();

            command.Append("command=");

            command.Append(playImmediately ? "in_play" : "in_enqueue");

            command.Append("&input=");
            command.Append(Uri.EscapeDataString(uri));

            if (!String.IsNullOrEmpty(name))
            {
                command.Append("&name=" + Uri.EscapeDataString(name));
            }

            switch (options)
            {
            case VlcPlaylistAddMode.NoAudio:
                command.Append("&option=noaudio");
                break;

            case VlcPlaylistAddMode.NoVideo:
                command.Append("&option=novideo");
                break;
            }

            await SendCommand(command.ToString());
        }
Exemple #2
0
 /// <summary>
 /// Add an item to the playlist without starting playback immediately.
 /// </summary>
 /// <param name="uri">The URI of the item to add.</param>
 /// <param name="name">An optional name for the new item.</param>
 /// <param name="options">Whether to use the new item's audio, video or both.</param>
 public async Task Add(string uri, string name = null, VlcPlaylistAddMode options = VlcPlaylistAddMode.Default)
 {
     await Add(uri, name, options, false);
 }