apwidgets
Class APVideoView

java.lang.Object
  extended by apwidgets.APWidget
      extended by apwidgets.APVideoView
All Implemented Interfaces:
android.media.MediaPlayer.OnCompletionListener, android.media.MediaPlayer.OnErrorListener, android.media.MediaPlayer.OnPreparedListener, android.view.View.OnClickListener

public class APVideoView
extends APWidget
implements android.media.MediaPlayer.OnCompletionListener, android.media.MediaPlayer.OnPreparedListener, android.media.MediaPlayer.OnErrorListener

Author:
Rikard Lundstedt

Constructor Summary
APVideoView()
          Creates a new video view that fills the screen and has a media controller
APVideoView(boolean hasMediaController)
          Creates a new video view that fills the screen
APVideoView(int x, int y, int width, int height, boolean hasMediaController)
          Creates a new video view
 
Method Summary
 int getCurrentPosition()
          Returns the current position.
 int getDuration()
          Returns the duration of the video
 java.lang.String getVideoPath()
          Get the path of the video file
 void init(processing.core.PApplet pApplet)
          Initializes the video view.
 void onCompletion(android.media.MediaPlayer mediaPlayer)
           
 boolean onError(android.media.MediaPlayer mediaPlayer, int a, int b)
           
 void onPrepared(android.media.MediaPlayer mp)
           
 void pause()
          Pauses the playing of the video file
 void seekTo(int msec)
          Move to a certain point in the file, counted from the beginning in millisecond.
 void setLooping(boolean looping)
          Makes the video start from the beginning when the end of the video has been reached
 void setVideoPath(java.lang.String videoPath)
          Sets the path of the video file.
 void start()
          Starts playing the video file
 void stopPlayBack()
          Stops the playback I guess.
 
Methods inherited from class apwidgets.APWidget
addOnClickWidgetListener, getHeight, getPApplet, getWidth, getView, getX, getY, onClick, setPosition, setSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

APVideoView

public APVideoView()
Creates a new video view that fills the screen and has a media controller


APVideoView

public APVideoView(boolean hasMediaController)
Creates a new video view that fills the screen

Parameters:
hasMediaController - Specifies whether the video view should have a media controller or not

APVideoView

public APVideoView(int x,
                   int y,
                   int width,
                   int height,
                   boolean hasMediaController)
Creates a new video view

Parameters:
x - The x-position of the video view
y - The y-position of the video view
width - The width of the video view
height - The height of the video view
hasMediaController - Specifies whether the video view should have a media controller or not
Method Detail

setLooping

public void setLooping(boolean looping)
Makes the video start from the beginning when the end of the video has been reached

Parameters:
looping -

setVideoPath

public void setVideoPath(java.lang.String videoPath)
Sets the path of the video file. It should be placed on the SD-card

Parameters:
videoPath - The path of the video file

start

public void start()
Starts playing the video file


stopPlayBack

public void stopPlayBack()
Stops the playback I guess. I haven't tested this.


pause

public void pause()
Pauses the playing of the video file


seekTo

public void seekTo(int msec)
Move to a certain point in the file, counted from the beginning in millisecond.

Parameters:
msec -

init

public void init(processing.core.PApplet pApplet)
Initializes the video view. Is called by APWidgetContainer as it is added to it.

Overrides:
init in class APWidget

getVideoPath

public java.lang.String getVideoPath()
Get the path of the video file

Returns:

getDuration

public int getDuration()
Returns the duration of the video

Returns:

getCurrentPosition

public int getCurrentPosition()
Returns the current position.

Returns:

onCompletion

public void onCompletion(android.media.MediaPlayer mediaPlayer)
Specified by:
onCompletion in interface android.media.MediaPlayer.OnCompletionListener

onError

public boolean onError(android.media.MediaPlayer mediaPlayer,
                       int a,
                       int b)
Specified by:
onError in interface android.media.MediaPlayer.OnErrorListener

onPrepared

public void onPrepared(android.media.MediaPlayer mp)
Specified by:
onPrepared in interface android.media.MediaPlayer.OnPreparedListener