Sun Java Solaris Communities My SDN Account Join SDN

1.0 Programmers Guide

1.0 Overview

 
TOC  Prev  Next  
The Clock and Player interfaces define the methods for starting and stopping a Player.

4.1 Starting a Player

You typically start a Player by calling start. The start method tells the Player to begin presenting media data as soon as possible. If necessary, start prepares the Player to start by performing the realize and prefetch operations. If start is called on a Started Player, the only effect is that a StartEvent is posted in acknowledgment of the method call.

Clock defines a syncStart method that can be used for synchronization. See "Synchronizing Players" on page 27 for more information.

To start a Player at a specific point in a media stream:

  1. Specify the point in the media stream at which you want to start by calling setMediaTime.
  2. Call start on the Player.

4.2 Stopping a Player

There are four situations in which a Player will stop:

  • When the stop method is called on the Player.

  • When the Player has reached the specified stop time.

  • When the Player has run out of media data.

  • When the Player is receiving data too slowly to allow acceptable playback.

When a non-broadcast Player is stopped, its media time is frozen. If the Stopped Player is subsequently restarted, media time resumes from the stop time. When you stop a broadcast Player, only the receipt of the media data is stopped; the data continues to be broadcast. When you restart a broadcast Player, the playback will resume wherever the broadcast is at that point in time.

You use the stop method to stop a Player immediately. If you call stop on a Stopped Player, the only effect is that a StopByRequestEvent is posted in acknowledgment of the method call.

4.2.1 Stopping a Player at a Specified Time

You can call setStopTime to indicate when a Player should stop. The Player stops when its media time passes the specified stop time. If the Player's rate is positive, the Player stops when the media time becomes greater than or equal to the stop time. If the Player's rate is negative, the Player stops when the media time becomes less than or equal to the stop time. The Player stops immediately if its current media time is already beyond the specified stop time.

For example, assume that a Player's media time is 5.0 and setStopTime is called to set the stop time to 6.0. If the Player's rate is positive, media time is increasing and the Player will stop when the media time becomes greater than or equal to 6.0. However, if the Player's rate is negative, it is playing in reverse and the Player will stop immediately because the media time is already beyond the stop time. (For more information about Player rates, see "Setting a Player's Rate" on page 26.)

You can always call setStopTime on a stopped Player. However, you can only set the stop time on a Started Player if the stop time is not currently set. If the Player already has a stop time, setStopTime throws an error.

You can call getStopTime to get the currently scheduled stop time. If the clock has no scheduled stop time, getStopTime returns Clock.RESET. To remove the stop time so that the Player continues until it reaches end-of-media, call
setStopTime(RESET).

TOC  Prev  Next