Condividi tramite


MediaPlayer.SetSurface(Surface) Method

Definition

Sets the Surface to be used as the sink for the video portion of the media.

[Android.Runtime.Register("setSurface", "(Landroid/view/Surface;)V", "GetSetSurface_Landroid_view_Surface_Handler")]
public virtual void SetSurface (Android.Views.Surface? surface);
[<Android.Runtime.Register("setSurface", "(Landroid/view/Surface;)V", "GetSetSurface_Landroid_view_Surface_Handler")>]
abstract member SetSurface : Android.Views.Surface -> unit
override this.SetSurface : Android.Views.Surface -> unit

Parameters

surface
Surface

The Surface to be used for the video portion of the media.

Attributes

Remarks

Sets the Surface to be used as the sink for the video portion of the media. This is similar to #setDisplay(SurfaceHolder), but does not support #setScreenOnWhilePlaying(boolean). Setting a Surface will un-set any Surface or SurfaceHolder that was previously set. A null surface will result in only the audio track being played.

If the Surface sends frames to a SurfaceTexture, the timestamps returned from SurfaceTexture#getTimestamp() will have an unspecified zero point. These timestamps cannot be directly compared between different media sources, different instances of the same media source, or multiple runs of the same program. The timestamp is normally monotonically increasing and is unaffected by time-of-day adjustments, but it is reset when the position is set.

Java documentation for android.media.MediaPlayer.setSurface(android.view.Surface).

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