MediaPlayer.SetScreenOnWhilePlaying(Boolean) Method

Definition

Control whether we should use the attached SurfaceHolder to keep the screen on while video playback is occurring.

[Android.Runtime.Register("setScreenOnWhilePlaying", "(Z)V", "GetSetScreenOnWhilePlaying_ZHandler")]
public virtual void SetScreenOnWhilePlaying (bool screenOn);
[<Android.Runtime.Register("setScreenOnWhilePlaying", "(Z)V", "GetSetScreenOnWhilePlaying_ZHandler")>]
abstract member SetScreenOnWhilePlaying : bool -> unit
override this.SetScreenOnWhilePlaying : bool -> unit

Parameters

screenOn
Boolean

Supply true to keep the screen on, false to allow it to turn off.

Attributes

Remarks

Control whether we should use the attached SurfaceHolder to keep the screen on while video playback is occurring. This is the preferred method over #setWakeMode where possible, since it doesn't require that the application have permission for low-level wake lock access.

Java documentation for android.media.MediaPlayer.setScreenOnWhilePlaying(boolean).

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