示例#1
0
文件: Player.cs 项目: prjung/TizenFX
        /// <summary>
        /// Applies the audio stream policy.
        /// </summary>
        /// <param name="policy">The <see cref="AudioStreamPolicy"/> to apply.</param>
        /// <remarks>
        /// The player must be in the <see cref="PlayerState.Idle"/> state.<br/>
        /// <br/>
        /// <see cref="Player"/> does not support all <see cref="AudioStreamType"/>.<br/>
        /// Supported types are <see cref="AudioStreamType.Media"/>, <see cref="AudioStreamType.System"/>,
        /// <see cref="AudioStreamType.Alarm"/>, <see cref="AudioStreamType.Notification"/>,
        /// <see cref="AudioStreamType.Emergency"/>, <see cref="AudioStreamType.VoiceInformation"/>,
        /// <see cref="AudioStreamType.RingtoneVoip"/> and <see cref="AudioStreamType.MediaExternalOnly"/>.
        /// </remarks>
        /// <exception cref="ObjectDisposedException">
        ///     The player has already been disposed of.<br/>
        ///     -or-<br/>
        ///     <paramref name="policy"/> has already been disposed of.
        /// </exception>
        /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="policy"/> is null.</exception>
        /// <exception cref="NotSupportedException">
        ///     <see cref="AudioStreamType"/> of <paramref name="policy"/> is not supported by <see cref="Player"/>.
        /// </exception>
        /// <seealso cref="AudioStreamPolicy"/>
        /// <since_tizen> 3 </since_tizen>
        public void ApplyAudioStreamPolicy(AudioStreamPolicy policy)
        {
            if (policy == null)
            {
                throw new ArgumentNullException(nameof(policy));
            }

            ValidatePlayerState(PlayerState.Idle);

            NativePlayer.SetAudioPolicyInfo(Handle, policy.Handle).
            ThrowIfFailed("Failed to set the audio stream policy to the player");
        }
示例#2
0
        /// <summary>
        /// Applies the audio stream policy.
        /// </summary>
        /// <param name="policy">The <see cref="AudioStreamPolicy"/> to apply.</param>
        /// <remarks>
        /// The player must be in the <see cref="PlayerState.Idle"/> state.<br/>
        /// <br/>
        /// <see cref="Player"/> does not support all <see cref="AudioStreamType"/>.<br/>
        /// Supported types are <see cref="AudioStreamType.Media"/>, <see cref="AudioStreamType.System"/>,
        /// <see cref="AudioStreamType.Alarm"/>, <see cref="AudioStreamType.Notification"/>,
        /// <see cref="AudioStreamType.Emergency"/>, <see cref="AudioStreamType.VoiceInformation"/>,
        /// <see cref="AudioStreamType.RingtoneVoip"/> and <see cref="AudioStreamType.MediaExternalOnly"/>.
        /// </remarks>
        /// <exception cref="ObjectDisposedException">
        ///     The player has already been disposed of.<br/>
        ///     -or-<br/>
        ///     <paramref name="policy"/> has already been disposed of.
        /// </exception>
        /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="policy"/> is null.</exception>
        /// <exception cref="NotSupportedException">
        ///     The required feature is not supported.<br/>
        ///     -or-<br/>
        ///     <see cref="AudioStreamType"/> of <paramref name="policy"/> is not supported on the current platform.
        /// </exception>
        /// <seealso cref="AudioStreamPolicy"/>
        /// <feature>http://tizen.org/feature/multimedia.player.stream_info</feature>
        /// <since_tizen> 3 </since_tizen>
        public void ApplyAudioStreamPolicy(AudioStreamPolicy policy)
        {
            ValidationUtil.ValidateFeatureSupported("http://tizen.org/feature/multimedia.player.stream_info");

            if (policy == null)
            {
                throw new ArgumentNullException(nameof(policy));
            }

            ValidatePlayerState(PlayerState.Idle);

            var ret = NativePlayer.SetAudioPolicyInfo(Handle, policy.Handle);

            if (ret == PlayerErrorCode.InvalidArgument)
            {
                throw new NotSupportedException("The specified policy is not supported on the current system.");
            }

            ret.ThrowIfFailed(this, "Failed to set the audio stream policy to the player");
        }