Android Guides | Samples

Android.Widget.VideoView Class

Displays a video file.

See Also: VideoView

Syntax

[Android.Runtime.Register("android/widget/VideoView", DoNotGenerateAcw=true)]
public class VideoView : SurfaceView, MediaController+IMediaPlayerControl, IDisposable

Remarks

Displays a video file. The VideoView class can load images from various sources (such as resources or content providers), takes care of computing its measurement from the video so that it can be used in any layout manager, and provides various display options such as scaling and tinting.

Note: VideoView does not retain its full state when going into the background. In particular, it does not restore the current play state, play position, selected tracks, or any subtitle tracks added via VideoView.AddSubtitleSource(Stream,MediaFormat). Applications should save and restore these on their own in Activity.OnSaveInstanceState(Bundle) and Activity.OnRestoreInstanceState(Bundle).

Also note that the audio session id (from VideoView.AudioSessionId) may change from its previously returned value when the VideoView is restored.

[Android Documentation]

Requirements

Namespace: Android.Widget
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Widget.VideoView are listed below.

See Also: SurfaceView

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
AudioSessionIdInt32. Get the audio session id for the player used by this VideoView.
[read-only]
BufferPercentageInt32.
[read-only]
CurrentPositionInt32.
[read-only]
DurationInt32.
[read-only]
IsPlayingBoolean.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

AddSubtitleSource(Stream, MediaFormat)
Adds an external subtitle source file (from the provided input stream.
CanPause() : Boolean
CanSeekBackward() : Boolean
CanSeekForward() : Boolean
Pause()
ResolveAdjustedSize(Int32, Int32) : Int32
Resume()
SeekTo(Int32)
SetMediaController(MediaController)
SetOnCompletionListener(MediaPlayer+IOnCompletionListener)
Register a callback to be invoked when the end of a media file has been reached during playback.
SetOnErrorListener(MediaPlayer+IOnErrorListener)
Register a callback to be invoked when an error occurs during playback or setup.
SetOnInfoListener(MediaPlayer+IOnInfoListener)
Register a callback to be invoked when an informational event occurs during playback or setup.
SetOnPreparedListener(MediaPlayer+IOnPreparedListener)
Register a callback to be invoked when the media file is loaded and ready to go.
SetVideoPath(String)
Sets video path.
SetVideoURI(Uri)
Sets video URI.
SetVideoURI(Uri, IDictionary<string, string>)
Start()
StopPlayback()
Suspend()

Public Events