linphone::Player Class Reference

Player interface. More...

`#include <player.hh>`

Inheritance diagram for linphone::Player:

## Public Types

enum class | State { Closed = 0 , Paused = 1 , Playing = 2 }
| The state of a Player. More...

## Public Member Functions

LINPHONECXX_PUBLIC | Player (void *ptr, bool takeRef=true)
LINPHONECXX_PUBLIC _LinphonePlayer * | cPtr ()
LINPHONECXX_PUBLIC void | addListener (const std::shared_ptr< PlayerListener > &listener)
| Add an application listener to the Player instance.
LINPHONECXX_PUBLIC void | removeListener (const std::shared_ptr< PlayerListener > &listener)
| Remove a previously added listener from the Player instance.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > | getCore () const
| Returns the Core object managing this player's call, if any.
LINPHONECXX_PUBLIC int | getCurrentPosition ()
| Get the current position in the opened file.
LINPHONECXX_PUBLIC int | getDuration ()
| Get the duration of the opened file.
LINPHONECXX_PUBLIC bool | getIsVideoAvailable ()
| Returns whether the file has video and if it can be displayed.
LINPHONECXX_PUBLIC State | getState ()
| Get the current state of a player.
LINPHONECXX_PUBLIC float | getVolumeGain ()
| Get the volume gain of the player.
LINPHONECXX_PUBLIC void | setVolumeGain (float gain)
| Set the volume gain of the player.
LINPHONECXX_PUBLIC void | setWindowId (void *windowId)
| Sets a window id to be used to display video if any.
LINPHONECXX_PUBLIC void | close ()
| Close the opened file.
LINPHONECXX_PUBLIC void * | createWindowId ()
| Create a window id to be used to display video if any.
LINPHONECXX_PUBLIC linphone::Status | open (const std::string &filename)
| Open a file for playing.
LINPHONECXX_PUBLIC linphone::Status | pause ()
| Pause the playing of a file.
LINPHONECXX_PUBLIC linphone::Status | seek (int timeMs)
| Seek in an opened file.
LINPHONECXX_PUBLIC linphone::Status | start ()
| Start playing a file that has been opened with open().

## Detailed Description

Player interface.

## Member Enumeration Documentation

## State

enum class linphone::Player::State

strong

The state of a Player.

Enumerator
Closed | No file is opened for playing.
Paused | The player is paused.
Playing | The player is playing.

## Member Function Documentation

## addListener()

LINPHONECXX_PUBLIC void linphone::Player::addListener | ( | const std::shared_ptr< PlayerListener > & | listener | ) |

Add an application listener to the Player instance.

Parameters

  listener | the application listener

## createWindowId()

LINPHONECXX_PUBLIC void * linphone::Player::createWindowId | ( |  | ) |

Create a window id to be used to display video if any.

Returns
  window_id The window id pointer to use.

## getCore()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > linphone::Player::getCore | ( |  | ) | const

Returns the Core object managing this player's call, if any.

Returns
  the Core object associated

## getCurrentPosition()

LINPHONECXX_PUBLIC int linphone::Player::getCurrentPosition | ( |  | ) |

Get the current position in the opened file.

Returns
  The current position in the opened file

## getDuration()

LINPHONECXX_PUBLIC int linphone::Player::getDuration | ( |  | ) |

Get the duration of the opened file.

Returns
  The duration of the opened file

## getIsVideoAvailable()

LINPHONECXX_PUBLIC bool linphone::Player::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()

LINPHONECXX_PUBLIC State linphone::Player::getState | ( |  | ) |

Get the current state of a player.

Returns
  The current State of the player.

## getVolumeGain()

LINPHONECXX_PUBLIC float linphone::Player::getVolumeGain | ( |  | ) |

Get the volume gain of the player.

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

## open()

LINPHONECXX_PUBLIC linphone::Status linphone::Player::open | ( | const std::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:

Parameters

  filename | The path to the file to open

## pause()

LINPHONECXX_PUBLIC linphone::Status linphone::Player::pause | ( |  | ) |

Pause the playing of a file.

Returns
  0 on success, a negative value otherwise

## removeListener()

LINPHONECXX_PUBLIC void linphone::Player::removeListener | ( | const std::shared_ptr< PlayerListener > & | listener | ) |

Remove a previously added listener from the Player instance.

Parameters

  listener | the application listener

## seek()

LINPHONECXX_PUBLIC linphone::Status linphone::Player::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.

## setVolumeGain()

LINPHONECXX_PUBLIC void linphone::Player::setVolumeGain | ( | float | gain | ) |

Set the volume gain of the player.

Parameters

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

## setWindowId()

LINPHONECXX_PUBLIC void linphone::Player::setWindowId | ( | void * | windowId | ) |

Sets a window id to be used to display video if any.

Parameters

  windowId | The window id pointer to use.

## start()

LINPHONECXX_PUBLIC linphone::Status linphone::Player::start | ( |  | ) |

Start playing a file that has been opened with open().

Returns
  0 on success, a negative value otherwise

The documentation for this class was generated from the following file:

- player.hh