Java Code Examples for javax.microedition.media.Player#getControl()

The following examples show how to use javax.microedition.media.Player#getControl() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MMAPIPlayer.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
private void bindPlayerCleanupOnComplete(final Player p, final InputStream i, final Runnable onComplete) {
    if (volume > -1) {
        VolumeControl v = (VolumeControl) p.getControl("VolumeControl");
        if (v != null) {
            v.setLevel(volume);
        }
    }
    sourceStream = i;
    this.onComplete = onComplete;
    p.addPlayerListener(this);
}
 
Example 2
Source File: MMAPIPlayer.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
private void bindPlayerCleanupOnComplete(final Player p, final InputStream i, final Runnable onComplete) {
    if(volume > -1) {
        VolumeControl v = (VolumeControl) p.getControl("VolumeControl");
        if(v != null) {
            v.setLevel(volume);
        }
    }
    sourceStream = i;
    this.onComplete = onComplete;
    p.addPlayerListener(this);
}
 
Example 3
Source File: PlayerPool.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set volume level to existing players.
 */
private void updateVolumeLevel() {
    int size = players.size();
    for (int i = 0; i < size; i++) { // Set the same volume level for all players
        Player player = (Player) players.elementAt(i);
        VolumeControl control = (VolumeControl) player.getControl("VolumeControl");
        actualVolume = (int) (((float) globalVolume / 100) * (float) midletVolume);
        control.setLevel(midletVolume);
    }
}
 
Example 4
Source File: PlayerPool.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set current stop-time to existing players.
 */
private void updateStopTime() {
    int size = players.size();
    for (int i = 0; i < size; i++) { // Set the same stop time for all players
        Player player = (Player) players.elementAt(i);
        StopTimeControl control = (StopTimeControl) player.getControl("StopTimeControl");
        control.setStopTime(stopTime);
    }
}
 
Example 5
Source File: PlayerPool.java    From pluotsorbet with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates and initializes the Player
 * 
 * @param sequence -
 *            tone sequence data in byte array
 * @return realized tone sequence Player
 * @throws MediaException
 *             thrown by the system while creating the player
 * @throws IOException
 *             thrown by the system while creating the player
 */
private Player createTonePlayer(byte[] sequence) throws MediaException, IOException {
    Player player = Manager.createPlayer(Manager.TONE_DEVICE_LOCATOR);
    player.addPlayerListener(this);
    player.realize();
    ToneControl tc = (ToneControl) (player.getControl("ToneControl"));
    tc.setSequence(sequence);
    return player;
}