|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.View
android.view.SurfaceView
android.widget.VideoView
public class 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class android.view.View |
|---|
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener |
| Field Summary | |
|---|---|
(package private) MediaPlayer.OnPreparedListener |
mPreparedListener
|
(package private) SurfaceHolder.Callback |
mSHCallback
|
| Constructor Summary | |
|---|---|
VideoView(Context context)
|
|
VideoView(Context context,
AttributeSet attrs)
|
|
VideoView(Context context,
AttributeSet attrs,
int defStyle)
|
|
| Method Summary | |
|---|---|
int |
getBufferPercentage()
|
int |
getCurrentPosition()
|
int |
getDuration()
|
boolean |
isPlaying()
|
boolean |
onKeyDown(int keyCode,
KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform press of the view
when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER
is released, if the view is enabled and clickable. |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
Measure the view and its content to determine the measured width and the measured height. |
boolean |
onTouchEvent(MotionEvent ev)
Implement this method to handle touch screen motion events. |
boolean |
onTrackballEvent(MotionEvent ev)
Implement this method to handle trackball motion events. |
void |
pause()
|
int |
resolveAdjustedSize(int desiredSize,
int measureSpec)
|
void |
seekTo(int msec)
|
void |
setMediaController(MediaController controller)
|
void |
setOnCompletionListener(MediaPlayer.OnCompletionListener l)
Register a callback to be invoked when the end of a media file has been reached during playback. |
void |
setOnErrorListener(MediaPlayer.OnErrorListener l)
Register a callback to be invoked when an error occurs during playback or setup. |
void |
setOnPreparedListener(MediaPlayer.OnPreparedListener l)
Register a callback to be invoked when the media file is loaded and ready to go. |
void |
setVideoPath(String path)
|
void |
setVideoURI(Uri uri)
|
void |
start()
|
void |
stopPlayback()
|
| Methods inherited from class android.view.SurfaceView |
|---|
dispatchDraw, draw, gatherTransparentRegion, getHolder, onAttachedToWindow, onDetachedFromWindow, onScrollChanged, onSizeChanged, onWindowVisibilityChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
MediaPlayer.OnPreparedListener mPreparedListener
SurfaceHolder.Callback mSHCallback
| Constructor Detail |
|---|
public VideoView(Context context)
public VideoView(Context context,
AttributeSet attrs)
public VideoView(Context context,
AttributeSet attrs,
int defStyle)
| Method Detail |
|---|
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
View
Measure the view and its content to determine the measured width and the
measured height. This method is invoked by View.measure(int, int) and
should be overriden by subclasses to provide accurate and efficient
measurement of their contents.
CONTRACT: When overriding this method, you
must call View.setMeasuredDimension(int, int) to store the
measured width and height of this view. Failure to do so will trigger an
IllegalStateException, thrown by
View.measure(int, int). Calling the superclass'
View.onMeasure(int, int) is a valid use.
The base class implementation of measure defaults to the background size,
unless a larger size is allowed by the MeasureSpec. Subclasses should
override View.onMeasure(int, int) to provide better measurements of
their content.
If this method is overridden, it is the subclass's responsibility to make
sure the measured height and width are at least the view's minimum height
and width (View.getSuggestedMinimumHeight() and
View.getSuggestedMinimumWidth()).
onMeasure in class SurfaceViewwidthMeasureSpec - horizontal space requirements as imposed by the parent.
The requirements are encoded with
View.MeasureSpec.heightMeasureSpec - vertical space requirements as imposed by the parent.
The requirements are encoded with
View.MeasureSpec.View.getMeasuredWidth(),
View.getMeasuredHeight(),
View.setMeasuredDimension(int, int),
View.getSuggestedMinimumHeight(),
View.getSuggestedMinimumWidth(),
View.MeasureSpec.getMode(int),
View.MeasureSpec.getSize(int)
public int resolveAdjustedSize(int desiredSize,
int measureSpec)
public void setVideoPath(String path)
public void setVideoURI(Uri uri)
public void stopPlayback()
public void setMediaController(MediaController controller)
public void setOnPreparedListener(MediaPlayer.OnPreparedListener l)
l - The callback that will be runpublic void setOnCompletionListener(MediaPlayer.OnCompletionListener l)
l - The callback that will be runpublic void setOnErrorListener(MediaPlayer.OnErrorListener l)
l - The callback that will be runpublic boolean onTouchEvent(MotionEvent ev)
View
onTouchEvent in class Viewev - The motion event.
public boolean onTrackballEvent(MotionEvent ev)
ViewMotionEvent.getX() and
MotionEvent.getY(). These are normalized so
that a movement of 1 corresponds to the user pressing one DPAD key (so
they will often be fractional values, representing the more fine-grained
movement information available from a trackball).
onTrackballEvent in class Viewev - The motion event.
public boolean onKeyDown(int keyCode,
KeyEvent event)
ViewKeyEvent.Callback.onKeyMultiple(): perform press of the view
when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER
is released, if the view is enabled and clickable.
onKeyDown in interface KeyEvent.CallbackonKeyDown in class ViewkeyCode - A key code that represents the button pressed, from
KeyEvent.event - The KeyEvent object that defines the button action.
public void start()
start in interface MediaController.MediaPlayerControlpublic void pause()
pause in interface MediaController.MediaPlayerControlpublic int getDuration()
getDuration in interface MediaController.MediaPlayerControlpublic int getCurrentPosition()
getCurrentPosition in interface MediaController.MediaPlayerControlpublic void seekTo(int msec)
seekTo in interface MediaController.MediaPlayerControlpublic boolean isPlaying()
isPlaying in interface MediaController.MediaPlayerControlpublic int getBufferPercentage()
getBufferPercentage in interface MediaController.MediaPlayerControl
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||