android.widget
Class VideoView

java.lang.Object
  extended by android.view.View
      extended by android.view.SurfaceView
          extended by android.widget.VideoView
All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, MediaController.MediaPlayerControl

public class VideoView
extends SurfaceView
implements MediaController.MediaPlayerControl


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
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, INVISIBLE, KEEP_SCREEN_ON, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
VideoView(Context context)
           
VideoView(Context context, AttributeSet attrs)
           
VideoView(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
 boolean canPause()
           
 boolean canSeekBackward()
           
 boolean canSeekForward()
           
 int getBufferPercentage()
           
 int getCurrentPosition()
           
 int getDuration()
           
 boolean isPlaying()
           
 boolean onKeyDown(int keyCode, KeyEvent event)
           
protected  void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
           
 boolean onTouchEvent(MotionEvent ev)
           
 boolean onTrackballEvent(MotionEvent ev)
           
 void pause()
           
 int resolveAdjustedSize(int desiredSize, int measureSpec)
           
 void resume()
           
 void seekTo(int msec)
           
 void setMediaController(MediaController controller)
           
 void setOnCompletionListener(MediaPlayer.OnCompletionListener l)
           
 void setOnErrorListener(MediaPlayer.OnErrorListener l)
           
 void setOnPreparedListener(MediaPlayer.OnPreparedListener l)
           
 void setVideoPath(String path)
           
 void setVideoURI(Uri uri)
           
 void start()
           
 void stopPlayback()
           
 void suspend()
           
 
Methods inherited from class android.view.SurfaceView
dispatchDraw, draw, gatherTransparentRegion, getHolder, onAttachedToWindow, onDetachedFromWindow, onWindowVisibilityChanged, setVisibility, setZOrderMediaOverlay, setZOrderOnTop
 
Methods inherited from class android.view.View
addFocusables, addFocusables, addTouchables, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, cancelLongPress, checkInputConnectionProxy, clearAnimation, clearFocus, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, destroyDrawingCache, dispatchConfigurationChanged, dispatchDisplayHint, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawableStateChanged, findFocus, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFilterTouchesWhenObscured, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getKeyDispatcherState, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOverScrollMode, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTag, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasFocus, hasFocusable, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isScrollbarFadingEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateDrawableState, onCreateInputConnection, onDisplayHint, onDraw, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onOverScrolled, onRestoreInstanceState, onSaveInstanceState, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onVisibilityChanged, onWindowFocusChanged, overScrollBy, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setOverScrollMode, setPadding, setPressed, setSaveEnabled, setScrollbarFadingEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VideoView

public VideoView(Context context)

VideoView

public VideoView(Context context,
                 AttributeSet attrs)

VideoView

public VideoView(Context context,
                 AttributeSet attrs,
                 int defStyle)
Method Detail

onMeasure

protected void onMeasure(int widthMeasureSpec,
                         int heightMeasureSpec)
Overrides:
onMeasure in class SurfaceView

resolveAdjustedSize

public int resolveAdjustedSize(int desiredSize,
                               int measureSpec)

setVideoPath

public void setVideoPath(String path)

setVideoURI

public void setVideoURI(Uri uri)

stopPlayback

public void stopPlayback()

setMediaController

public void setMediaController(MediaController controller)

setOnPreparedListener

public void setOnPreparedListener(MediaPlayer.OnPreparedListener l)

setOnCompletionListener

public void setOnCompletionListener(MediaPlayer.OnCompletionListener l)

setOnErrorListener

public void setOnErrorListener(MediaPlayer.OnErrorListener l)

onTouchEvent

public boolean onTouchEvent(MotionEvent ev)
Overrides:
onTouchEvent in class View

onTrackballEvent

public boolean onTrackballEvent(MotionEvent ev)
Overrides:
onTrackballEvent in class View

onKeyDown

public boolean onKeyDown(int keyCode,
                         KeyEvent event)
Specified by:
onKeyDown in interface KeyEvent.Callback
Overrides:
onKeyDown in class View

start

public void start()
Specified by:
start in interface MediaController.MediaPlayerControl

pause

public void pause()
Specified by:
pause in interface MediaController.MediaPlayerControl

suspend

public void suspend()

resume

public void resume()

getDuration

public int getDuration()
Specified by:
getDuration in interface MediaController.MediaPlayerControl

getCurrentPosition

public int getCurrentPosition()
Specified by:
getCurrentPosition in interface MediaController.MediaPlayerControl

seekTo

public void seekTo(int msec)
Specified by:
seekTo in interface MediaController.MediaPlayerControl

isPlaying

public boolean isPlaying()
Specified by:
isPlaying in interface MediaController.MediaPlayerControl

getBufferPercentage

public int getBufferPercentage()
Specified by:
getBufferPercentage in interface MediaController.MediaPlayerControl

canPause

public boolean canPause()
Specified by:
canPause in interface MediaController.MediaPlayerControl

canSeekBackward

public boolean canSeekBackward()
Specified by:
canSeekBackward in interface MediaController.MediaPlayerControl

canSeekForward

public boolean canSeekForward()
Specified by:
canSeekForward in interface MediaController.MediaPlayerControl


Copyright © 2008-2010. All Rights Reserved.