Example #1
0
        /// <summary>
        /// Gets the metadata with the specified key.
        /// </summary>
        /// <returns>A string that represents the value of the specified key.</returns>
        /// <param name="key">The key to query.</param>
        /// <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 string GetMetadata(StreamMetadataKey key)
        {
            Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);

            ValidationUtil.ValidateEnum(typeof(StreamMetadataKey), key);

            IntPtr ptr = IntPtr.Zero;

            try
            {
                NativePlayer.GetContentInfo(Player.Handle, key, out ptr).
                ThrowIfFailed($"Failed to get the meta data with the key '{ key }'");

                return(Marshal.PtrToStringAnsi(ptr));
            }
            finally
            {
                LibcSupport.Free(ptr);
            }
        }