Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaControlPlaylist"/> class.
        /// </summary>
        /// <param name="name">The name of this playlist.</param>
        /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
        /// <since_tizen> 5 </since_tizen>
        public MediaControlPlaylist(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            NativePlaylist.CreatePlaylist(name, out IntPtr handle).ThrowIfError("Failed to create playlist");

            Name    = name;
            _handle = handle;

            MediaControlServer.SavePlaylist(handle);
        }
Exemple #2
0
        /// <summary>
        /// Sets the metadata to the playlist.
        /// </summary>
        /// <param name="metadata">The metadata of media.</param>
        /// <exception cref="ArgumentNullException"><paramref name="metadata"/> is null.</exception>
        /// <since_tizen> 5 </since_tizen>
        public void AddMetadata(Dictionary <string, MediaControlMetadata> metadata)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException(nameof(metadata));
            }

            foreach (var data in metadata)
            {
                AddMetadata(data.Key, data.Value);
            }

            MediaControlServer.SavePlaylist(Handle);
        }
Exemple #3
0
        /// <summary>
        /// Sets the metadata to the playlist.
        /// </summary>
        /// <param name="index">The index of media in the playlist.</param>
        /// <param name="metadata">The metadata of media.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="index"/> or <paramref name="metadata"/> is null.
        /// </exception>
        /// <since_tizen> 5 </since_tizen>
        public void AddMetadata(string index, MediaControlMetadata metadata)
        {
            if (index == null)
            {
                throw new ArgumentNullException(nameof(index));
            }
            if (metadata == null)
            {
                throw new ArgumentNullException(nameof(metadata));
            }

            AddItemToPlaylist(index, metadata);
            _metadata.Add(index, metadata);

            MediaControlServer.SavePlaylist(Handle);
        }