Skip to content

Most visited

Recently visited

navigation

InstantVideoView

public class InstantVideoView
extends FrameLayout

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.support.media.instantvideo.widget.InstantVideoView


Displays a video or an image. This class provides a high level interface for applications to play a video. When the video isn't playing, it displays an image instead if set.

A developer can preload a video by calling preload(Uri), so that the video can play right after start() is called.

See also:

Summary

Inherited XML attributes

From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View

Inherited constants

From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

InstantVideoView(Context context)
InstantVideoView(Context context, AttributeSet attrs)
InstantVideoView(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

int getCurrentPosition()

Returns the current playback position which is the offset from the start of the video.

void seekTo(int position)

Seeks to the given position.

void setImageDrawable(Drawable drawable)

Sets a drawable as the default image of this view.

void setVideoUri(Uri uri)

Sets a video URI.

void start()

Starts the video playback.

void stop()

Stops the video playback.

Protected methods

void onDetachedFromWindow()

This is called when the view is detached from a window.

Inherited methods

From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Public constructors

InstantVideoView

InstantVideoView (Context context)

Parameters
context Context

InstantVideoView

InstantVideoView (Context context, 
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

InstantVideoView

InstantVideoView (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context
attrs AttributeSet
defStyleAttr int

Public methods

getCurrentPosition

int getCurrentPosition ()

Returns the current playback position which is the offset from the start of the video.

Returns
int

seekTo

void seekTo (int position)

Seeks to the given position.

Parameters
position int: The position of the video to seek to. It's the offset from the start of the video.

setImageDrawable

void setImageDrawable (Drawable drawable)

Sets a drawable as the default image of this view.

Parameters
drawable Drawable: the Drawable to set, or null to clear the content.

See also:

setVideoUri

void setVideoUri (Uri uri)

Sets a video URI.

This method is used to set the video URI to play in this view.

Parameters
uri Uri: the URI of the video.

start

void start ()

Starts the video playback.

stop

void stop ()

Stops the video playback.

Protected methods

onDetachedFromWindow

void onDetachedFromWindow ()

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.