Пример #1
0
        /// <summary>
        /// Gets the content type of current playing media.
        /// </summary>
        /// <returns>The <see cref="MediaControlContentType"/>.</returns>
        /// <exception cref="InvalidOperationException">
        ///     The server has already been stopped.<br/>
        ///     -or-<br/>
        ///     An internal error occurs.
        /// </exception>
        /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
        /// <since_tizen> 5 </since_tizen>
        public MediaControlContentType GetContentTypeOfCurrentPlayingMedia()
        {
            ThrowIfStopped();

            IntPtr playbackHandle = IntPtr.Zero;

            try
            {
                Native.GetServerPlaybackHandle(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback.");

                Native.GetPlaybackContentType(playbackHandle, out MediaControlContentType type).
                ThrowIfError("Failed to get playback content type");

                return(type);
            }
            finally
            {
                if (playbackHandle != IntPtr.Zero)
                {
                    Native.DestroyPlayback(playbackHandle);
                }
            }
        }