Package org.linphone.core

# Interface Player

public interface Player
Player interface.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static enum`
`Player.State`

## Method Summary

Modifier and Type
Method
Description
`void`
`addListener(PlayerListener listener)`
`void`
`close()`
Close the opened file.
`Object`
`createWindowId()`
Creates a window id to be used to display video if any.
`Object`
`createWindowId(Object context)`
Creates a window id to be used to display video if any.
`Core`
`getCore()`
Returns the `Core` object managing this player's call, if any.
`int`
`getCurrentPosition()`
Gets the current position in the opened file.
`int`
`getDuration()`
Gets the duration of the opened file.
`boolean`
`getIsVideoAvailable()`
Returns whether the file has video and if it can be displayed.
`long`
`getNativePointer()`
Gets the native pointer used by this class to make native method calls.
`Player.State`
`getState()`
Gets the current state of a player.
`Object`
`getUserData()`
Gets the object stored in this object user's data
`float`
`getVolumeGain()`
Gets the volume gain of the player.
`int`
`open(String filename)`
Open a file for playing.
`int`
`pause()`
Pause the playing of a file.
`void`
`removeListener(PlayerListener listener)`
`int`
`seek(int timeMs)`
Seek in an opened file.
`void`
`setUserData(Object data)`
Sets the object to store in this object user's data
`void`
`setVolumeGain(float gain)`
Sets the volume gain of the player.
`void`
`setWindowId(Object windowId)`
Sets a window id to be used to display video if any.
`int`
`start()`
Start playing a file that has been opened with `open(java.lang.String)`.
`String`
`toString()`

## Method Details

### getCore

@NonNull Core getCore()
Returns the `Core` object managing this player's call, if any.

Returns:
  the `Core` object associated

### getCurrentPosition

int getCurrentPosition()
Gets the current position in the opened file.

Returns:
  The current position in the opened file

### getDuration

int getDuration()
Gets the duration of the opened file.

Returns:
  The duration of the opened file

### getIsVideoAvailable

boolean getIsVideoAvailable()
Returns whether the file has video and if it can be displayed.

Returns:
  true if file has video and it can be displayed, false otherwise

### getState

Player.State getState()
Gets the current state of a player.

Returns:
  The current `Player.State` of the player.

### getVolumeGain

float getVolumeGain()
Gets the volume gain of the player.

Returns:
  Percentage of the gain. Valid values are in [ 0.0 : 1.0 ].

### setVolumeGain

void setVolumeGain(float gain)
Sets the volume gain of the player.

Parameters:
  `gain` - Percentage of the gain. Valid values are in [ 0.0 : 1.0 ].

### setWindowId

void setWindowId(@Nullable Object windowId)
Sets a window id to be used to display video if any.

Parameters:
  `windowId` - The window id pointer to use.

### close

void close()
Close the opened file.

### createWindowId

@Nullable Object createWindowId(@Nullable Object context)
Creates a window id to be used to display video if any.
A context can be used to prevent Linphone from allocating the container
(MSOglContextInfo for MSOGL). null if not used.
A context can be used to prevent Linphone from allocating the container
(MSOglContextInfo for MSOGL). null if not used.

Parameters:
  `context` - preallocated Window ID (Used only for MSOGL)
Returns:
  window_id The window id pointer to use.

### createWindowId

@Nullable Object createWindowId()
Creates a window id to be used to display video if any.

Returns:
  window_id The window id pointer to use.

### open

int open(@NonNull String filename)
Open a file for playing.
Actually, only WAVE and MKV/MKA file formats are supported and a limited set of
codecs depending of the selected format. Here are the list of working
combinations:
-WAVE format: only PCM s16le codec is supported.
-MKV/MKA format:

Parameters:
  `filename` - The path to the file to open

### pause

int pause()
Pause the playing of a file.

Returns:
  0 on success, a negative value otherwise

### seek

int seek(int timeMs)
Seek in an opened file.

Parameters:
  `timeMs` - The time we want to go to in the file (in milliseconds).
Returns:
  0 on success, a negative value otherwise.

### start

int start()
Start playing a file that has been opened with `open(java.lang.String)`.

Returns:
  0 on success, a negative value otherwise

### addListener

void addListener(PlayerListener listener)

### removeListener

void removeListener(PlayerListener listener)

### setUserData

void setUserData(Object data)
Sets the object to store in this object user's data

Parameters:
  `data` - the object to store

### getUserData

Object getUserData()
Gets the object stored in this object user's data

Returns:
  the object store if any, null otherwise

### getNativePointer

long getNativePointer()
Gets the native pointer used by this class to make native method calls.

Returns:
  the nativer pointer, as long

### toString

String toString()

Overrides:
  `toString` in class `Object`