IBM Toolkit
for MPEG-4

player
Interface PlayerListener

All Known Implementing Classes:
PlayerAdapter

public interface PlayerListener

MPEG-4 Player Listener interface. An player shell can implement this to monitor ongoing state and update its user interface. It also allows allows a PlayerControl panel to control the player as well as being controlled via other direct calls, eg from a main player shell menus, such that each controller can maintain current/correct indications of state, volume etc. and cooperate.

Many methods here return values that can be queried via getXXX() methods on the PlayerControl and further information on the values may be had from the PlayerControl interface documentation.


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 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.
 

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).

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).

Parameters:
usePixelMetrics - True if using pixel metrics, false is meter metrics

changedState

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

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.

Parameters:
time - Current time of presentation in ms

volumeChanged

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

Parameters:
volume - Volume in the range [0,1]

muteChanged

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

Parameters:
isMuted - The 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.

This is the first indication of new content being opened. The preferred size and meter metrics indications will follow.

Parameters:
url - String containing the URL for the content

speedChanged

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

Parameters:
speed - New speed value

scalingChanged

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

Parameters:
scaling - New scaling value

speedScalingChanged

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

Parameters:
speedScaling - New speed scaling value

fpsChanged

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

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.

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.

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.


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.


IBM Toolkit
for MPEG-4

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