IBM Toolkit
for MPEG-4

player
Class PlayerAdapter

java.lang.Object
  extended byplayer.PlayerAdapter
All Implemented Interfaces:
PlayerListener

public abstract class PlayerAdapter
extends java.lang.Object
implements PlayerListener

MPEG-4 Player Adapter. A basic player listener class that can be extended so that any reqd events can be obtained by overridding the respective methods. E.g. a player control that had only start/stop/pause buttons would probably only be interested in state changes so that deriving from this class is convenient.

Code that extends this class, rather than directly implements PlayerListener, will make that code transparent to additions of any new callbacks in the PlayerListener as empty methods will be added here. Such additions would not be known by older code, and if the new methods are interesting then the code extending this class can be updated to override the default empty methods and take advantage of the new functionality.


Constructor Summary
PlayerAdapter()
           
 
Method Summary
 void actualFPS(float fps)
          An indication of the FPS from the renderer.
 void changedState(int state)
          Indicates change of player presentation state.
 void fpsChanged(float fps)
          The FPS setting has been altered.
 void handleAnchor(java.lang.String url)
          Called to allow the shell to handle unknown anchor urls by for example exec'ing a known application to support the url.
 void muteChanged(boolean isMuted)
          Indicates new mute state.
 void playerSize(int w, int h)
          Indicates current player size when there has been a change.
 void playerTime(long time)
          Indicates current presentation time.
 void playRequestWhenClosed()
          Indicates that a play request was received in closed state.
 void preferSize(int w, int h)
          Indicates the preferred size from presentation.
 void scalingChanged(boolean scaling)
          The scaling mode has been changed.
 void serverNTPTimeOrigin(long msecs)
          When the presentation is delivered from an RTSP/RTP streaming server part of the protocol which it may send includes an NTP timestamp (see Sender Report packet in RTP RFC 3550).
 void speedChanged(double speed)
          The playback speed has been changed.
 void speedScalingChanged(boolean speedScaling)
          The speed scaling type hint has been changed.
 void urlChanged(java.lang.String url)
          A new URL has been opened.
 void usingMetrics(boolean usePixelMetrics)
          Indicates pixel or meter metrics from presentation.
 void volumeChanged(double volume)
          Indicates new volume level.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlayerAdapter

public PlayerAdapter()
Method Detail

preferSize

public void preferSize(int w,
                       int h)
Indicates the preferred size from presentation. If there is no preferred size then width and height are -1. The method will be called when the content is accessed (as it is opened).

Specified by:
preferSize in interface PlayerListener
Parameters:
w - Preferred width
h - Preferred height

usingMetrics

public void usingMetrics(boolean usePixelMetrics)
Indicates pixel or meter metrics from presentation. The method will be called when the content is accessed (as it is opened).

Specified by:
usingMetrics in interface PlayerListener
Parameters:
usePixelMetrics - True if using pixel metrics, false is meter metrics

changedState

public void changedState(int state)
Indicates change of player presentation state.

Specified by:
changedState in interface PlayerListener
Parameters:
state - State as per PlayerControl
See Also:
PlayerControl

playerTime

public void playerTime(long time)
Indicates current presentation time. Called at approx 100ms intervals so that any visual indicator can includes 1/10ths of seconds if this is desirable.

Specified by:
playerTime in interface PlayerListener
Parameters:
time - Current time of presentation in ms

volumeChanged

public void volumeChanged(double volume)
Indicates new volume level.

Specified by:
volumeChanged in interface PlayerListener
Parameters:
volume - Volume in the range [0,1]

muteChanged

public void muteChanged(boolean isMuted)
Indicates new mute state.

Specified by:
muteChanged in interface PlayerListener
Parameters:
isMuted - Mute state

urlChanged

public void urlChanged(java.lang.String url)
A new URL has been opened. This may be a direct result of an open() call on the PlayerControl interface or as a result of and internal anchor in the scene being executed causing a 'jump' to new content. This callback allows the player to keep any content url indication current.

Specified by:
urlChanged in interface PlayerListener
Parameters:
url - String containing the URL for the content

speedChanged

public void speedChanged(double speed)
The playback speed has been changed.

Specified by:
speedChanged in interface PlayerListener
Parameters:
speed - New speed value

scalingChanged

public void scalingChanged(boolean scaling)
The scaling mode has been changed.

Specified by:
scalingChanged in interface PlayerListener
Parameters:
scaling - New scaling value

speedScalingChanged

public void speedScalingChanged(boolean speedScaling)
The speed scaling type hint has been changed.

Specified by:
speedScalingChanged in interface PlayerListener
Parameters:
speedScaling - New speed scaling value

fpsChanged

public void fpsChanged(float fps)
The FPS setting has been altered.

Specified by:
fpsChanged in interface PlayerListener
Parameters:
fps - FPS value set

actualFPS

public void actualFPS(float fps)
An indication of the FPS from the renderer. This is an actual measured average FPS. Currently the value is just the average number of frames displayed per second over the preceeding 10s interval.

Specified by:
actualFPS in interface PlayerListener
Parameters:
fps - The average fps of scene

playerSize

public void playerSize(int w,
                       int h)
Indicates current player size when there has been a change.

Specified by:
playerSize in interface PlayerListener
Parameters:
w - width
h - height

playRequestWhenClosed

public void playRequestWhenClosed()
Indicates that a play request was received in closed state. This is to allow scenarios where the player remains in CLOSED state but a play button is set ACTIVE such that content can be player. The content url would need to be known and then a player shell receiving this indication can open() and start() playback. This could be used in an applet on a web page where the url is coded as an applet param but we don't want to open the content at all unless the user wants to play. In this case we can set up a PlayerControlPanel to have its play button enabled and listen for this event in the applet as a signal to start.

Specified by:
playRequestWhenClosed in interface PlayerListener

handleAnchor

public void handleAnchor(java.lang.String url)
Called to allow the shell to handle unknown anchor urls by for example exec'ing a known application to support the url. This would be called when the user clicks on a geometry in the scene contained in an Anchor node and when the url is not of MPEG-4 content that the player will handle. Eg a common use might be to embed a web page url.

Specified by:
handleAnchor in interface PlayerListener

serverNTPTimeOrigin

public void serverNTPTimeOrigin(long msecs)
When the presentation is delivered from an RTSP/RTP streaming server part of the protocol which it may send includes an NTP timestamp (see Sender Report packet in RTP RFC 3550). This information is used to create a millisecond timestamp that corresponds to t=0 for the presentation time ie t=0 as per playerTime(). The time given here is UTC milliseconds since Jan 1, 1970 (corresponding to what System.currentTimeMillis() outputs).

Specified by:
serverNTPTimeOrigin in interface PlayerListener
Parameters:
msecs - Milliseconds since Jan 1, 1970 corresponding to the start the player's presentation timeline as given by the server.

IBM Toolkit
for MPEG-4

© Copyright IBM Corp. 1998, 2006. All Rights Reserved.