Example #1
0
        /// <summary>
        /// Retrieves the album art of the stream, or null if there is no album art data.
        /// </summary>
        /// <returns>Raw byte array if album art exists; otherwise null.</returns>
        /// <remarks>
        /// The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>,
        /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.
        /// </remarks>
        /// <exception cref="ObjectDisposedException">
        /// The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed of.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.
        /// </exception>
        /// <since_tizen> 3 </since_tizen>
        public byte[] GetAlbumArt()
        {
            Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);

            NativePlayer.GetAlbumArt(Player.Handle, out var art, out var size).
            ThrowIfFailed(Player, "Failed to get the album art");

            if (art == IntPtr.Zero || size == 0)
            {
                return(null);
            }

            byte[] albumArt = new byte[size];
            Marshal.Copy(art, albumArt, 0, size);
            return(albumArt);
        }