Sdílet prostřednictvím


MediaPlayer.SetVolume(Single, Single) Method

Definition

Sets the volume on this player.

[Android.Runtime.Register("setVolume", "(FF)V", "GetSetVolume_FFHandler")]
public virtual void SetVolume (float leftVolume, float rightVolume);
[<Android.Runtime.Register("setVolume", "(FF)V", "GetSetVolume_FFHandler")>]
abstract member SetVolume : single * single -> unit
override this.SetVolume : single * single -> unit

Parameters

leftVolume
Single

left volume scalar

rightVolume
Single

right volume scalar

Attributes

Remarks

Sets the volume on this player. This API is recommended for balancing the output of audio streams within an application. Unless you are writing an application to control user settings, this API should be used in preference to AudioManager#setStreamVolume(int, int, int) which sets the volume of ALL streams of a particular type. Note that the passed volume values are raw scalars in range 0.0 to 1.0. UI controls should be scaled logarithmically.

Java documentation for android.media.MediaPlayer.setVolume(float, float).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to