es.upm.dit.multimedia.piplayer.vlc4osgi
Class VLCPlayer

java.lang.Object
  extended by es.upm.dit.multimedia.piplayer.vlc4osgi.VLCPlayer
All Implemented Interfaces:
COBRAPlayer

public class VLCPlayer
extends java.lang.Object
implements COBRAPlayer

Implements COBRAPlayer for JVLC

Author:
Rodrigo Garcia

Constructor Summary
VLCPlayer(java.lang.String URL, java.lang.String[] args)
          Creates a player instance from a given url and arguments
 
Method Summary
 void fullScreen()
          Toggles the full screen function of the player.
 long getLength()
           
 float getPosition()
           
 long getTime()
           
 java.lang.Object getUIComponent()
          The visual component needs to be downcasted to specific GUI library.
 int getVolume()
           
 boolean hasVisualComponent()
           
 boolean isPlaying()
           
 void mute()
          Toggles the mute function of the player
 void pause()
          Pauses the player
 void setPosition(float position)
          Sets the current position in the media between 0 and 1 (%)
 void setTime(long time)
          Sets the current time in the media in milliseconds
 void setVolume(int volume)
          Sets the current volume in a scale between 0 and 100
 void start()
          Starts the player
 void stop()
          Stops the player
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VLCPlayer

public VLCPlayer(java.lang.String URL,
                 java.lang.String[] args)
Creates a player instance from a given url and arguments

Parameters:
URL - the url that points to the media file
args - the arguments to be passed to the player
Method Detail

getUIComponent

public java.lang.Object getUIComponent()
                                throws VLCException
Description copied from interface: COBRAPlayer
The visual component needs to be downcasted to specific GUI library. For example, if AWT is used, the returned object will be -at least- of type java.awt.Component.

Specified by:
getUIComponent in interface COBRAPlayer
Returns:
An AWT Canvas visual component if exists.
Throws:
java.lang.Exception - if there is no available visual component
VLCException

hasVisualComponent

public boolean hasVisualComponent()
Specified by:
hasVisualComponent in interface COBRAPlayer
Returns:
true if this player has got a visual component

pause

public void pause()
           throws VLCException

Pauses the player

Specified by:
pause in interface COBRAPlayer
Throws:
VLCException

start

public void start()
           throws VLCException

Starts the player

Specified by:
start in interface COBRAPlayer
Throws:
VLCException

stop

public void stop()
          throws VLCException

Stops the player

Specified by:
stop in interface COBRAPlayer
Throws:
VLCException

fullScreen

public void fullScreen()
                throws VLCException
Toggles the full screen function of the player. Only works if the video has been started and has a visual component

Specified by:
fullScreen in interface COBRAPlayer
Throws:
VLCException

getLength

public long getLength()
               throws VLCException
Specified by:
getLength in interface COBRAPlayer
Returns:
the length of the media in milliseconds
Throws:
VLCException

getPosition

public float getPosition()
                  throws VLCException
Specified by:
getPosition in interface COBRAPlayer
Returns:
the current position in the media between 0 and 1 (%)
Throws:
VLCException

getTime

public long getTime()
             throws VLCException
Specified by:
getTime in interface COBRAPlayer
Returns:
the current position in the media in milliseconds
Throws:
VLCException

setPosition

public void setPosition(float position)
                 throws VLCException
Description copied from interface: COBRAPlayer
Sets the current position in the media between 0 and 1 (%)

Specified by:
setPosition in interface COBRAPlayer
Throws:
VLCException

setTime

public void setTime(long time)
             throws VLCException
Description copied from interface: COBRAPlayer
Sets the current time in the media in milliseconds

Specified by:
setTime in interface COBRAPlayer
Throws:
VLCException

getVolume

public int getVolume()
              throws java.lang.Exception
Specified by:
getVolume in interface COBRAPlayer
Returns:
the current volume in a scale between 0 and 100
Throws:
java.lang.Exception

mute

public void mute()
          throws java.lang.Exception
Description copied from interface: COBRAPlayer
Toggles the mute function of the player

Specified by:
mute in interface COBRAPlayer
Throws:
java.lang.Exception

setVolume

public void setVolume(int volume)
               throws java.lang.Exception
Description copied from interface: COBRAPlayer
Sets the current volume in a scale between 0 and 100

Specified by:
setVolume in interface COBRAPlayer
Throws:
java.lang.Exception

isPlaying

public boolean isPlaying()
Specified by:
isPlaying in interface COBRAPlayer