public final class

PlayerManager

extends Object
java.lang.Object
   ↳ com.neomades.media.PlayerManager

Class Overview

A manager of many players.

Default Manager

This class provides a default main PlayerManager thanks to the getDefaultManager() method. The returned instance contains all created Player in the application.

Note : the addPlayer(Player) method is useless for this instance, because the main manager will automatically have all the created players.

Group of players

Instead of using the Main Manager, you could use a specific player manager which contains a group of players.

The addPlayer(Player) method will insert a player into a group.

Summary

Public Constructors
PlayerManager()
Creates a new player manager.
Public Methods
void addPlayer(Player player)
Adds a player to the manager.
static PlayerManager getDefaultManager()
Returns the default manager that contains all created players.
int getMainVolume()
Returns the main volume level between 0 and 100.
boolean isMainMuted()
Returns if the manager has muted all players.
void pauseAll()
Pauses all the players.
void playAll()
Starts or resumes in parallel all the players.
void releaseAll()
Releases all the players.
void setMainMuted(boolean muted)
Set the main mute state for a group of players.
void setMainVolume(int volume)
Set the main volume for a group of players.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PlayerManager ()

Creates a new player manager.

Public Methods

public void addPlayer (Player player)

Adds a player to the manager.

Parameters
player the player to add

public static PlayerManager getDefaultManager ()

Returns the default manager that contains all created players.

To create and manage a specific group of players, another manager could be created with the constructor : PlayerManager().

But this main manager continues to contain all created players.

Returns
  • the main player manager
See Also

public int getMainVolume ()

Returns the main volume level between 0 and 100.

Returns
  • the main volume level

public boolean isMainMuted ()

Returns if the manager has muted all players.

Returns
  • true if all players are muted.

public void pauseAll ()

Pauses all the players.

public void playAll ()

Starts or resumes in parallel all the players.

public void releaseAll ()

Releases all the players.

The PlayerManager is no longer available after calling this method.

public void setMainMuted (boolean muted)

Set the main mute state for a group of players.

If the mainMute is false, each track has a mute state. Otherwise, all the tracks are muted.

Parameters
muted true to mute all players

public void setMainVolume (int volume)

Set the main volume for a group of players.

The real volume of each track depends on two volume levels (the track volume and the main volume).

 realVolume = mainVolume x trackVolume
 

By default, the mainVolume and trackVolume are equal to 100.

If the volume given in parameter is less than zero, the volume will be 0. For values greater than 100 volume will be 100.

Parameters
volume level between 0 and 100
See Also