Added in API level 1

VideoView


open class VideoView : SurfaceView, MediaController.MediaPlayerControl
kotlin.Any
   ↳ android.view.View
   ↳ android.view.SurfaceView
   ↳ android.widget.VideoView

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 addSubtitleSource(). Applications should save and restore these on their own in android.app.Activity#onSaveInstanceState and android.app.Activity#onRestoreInstanceState.

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

By default, VideoView requests audio focus with AudioManager.AUDIOFOCUS_GAIN. Use setAudioFocusRequest(int) to change this behavior.

The default AudioAttributes used during playback have a usage of AudioAttributes.USAGE_MEDIA and a content type of AudioAttributes.CONTENT_TYPE_MOVIE, use setAudioAttributes(android.media.AudioAttributes) to modify them.

Summary

Inherited XML attributes
Inherited constants
Public constructors
VideoView(context: Context!)

VideoView(context: Context!, attrs: AttributeSet!)

VideoView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

VideoView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Unit

Adds an external subtitle source file (from the provided input stream.) Note that a single external subtitle source may contain multiple or no supported tracks in it.

open Boolean

open Boolean

open Boolean

open Unit
draw(canvas: Canvas)

open CharSequence!

open Int

open Int

open Int

open Int

open Boolean

open Boolean
onKeyDown(keyCode: Int, event: KeyEvent!)

open Boolean

open Boolean

open Unit

open Int
resolveAdjustedSize(desiredSize: Int, measureSpec: Int)

open Unit

open Unit
seekTo(msec: Int)

open Unit

Sets the AudioAttributes to be used during the playback of the video.

open Unit

Sets which type of audio focus will be requested during the playback, or configures playback to not request audio focus.

open Unit

open Unit

Register a callback to be invoked when the end of a media file has been reached during playback.

open Unit

Register a callback to be invoked when an error occurs during playback or setup.

open Unit

Register a callback to be invoked when an informational event occurs during playback or setup.

open Unit

Register a callback to be invoked when the media file is loaded and ready to go.

open Unit

Sets video path.

open Unit

Sets video URI.

open Unit
setVideoURI(uri: Uri!, headers: MutableMap<String!, String!>!)

Sets video URI using specific headers.

open Unit

open Unit

open Unit

Protected methods
open Unit

open Unit

open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)

open Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

Inherited functions