apwidgets
Class PVideoView

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

public class PVideoView
extends PWidget
implements android.media.MediaPlayer.OnCompletionListener, android.media.MediaPlayer.OnPreparedListener, android.media.MediaPlayer.OnErrorListener

Author:
Rikard Lundstedt

Constructor Summary
PVideoView()
          Creates a new video view that fills the screen and has a media controller
PVideoView(boolean hasMediaController)
          Creates a new video view that fills the screen
PVideoView(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.PWidget
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

PVideoView

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


PVideoView

public PVideoView(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

PVideoView

public PVideoView(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 PWidgetContainer as it is added to it.

Overrides:
init in class PWidget

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