setSpeed()

The τ Player API


setSpeed()

The parameter is a floating point number greater than 0. It must be 0 to 1.0 to play slower, and greater than 1.0 to play faster. The speed can be changed when player is running or before starting. If used before startPlayer(), the required speed is kept/delayed and set during the following call to startPlayer().

This verb is actually only for startRecorder() or startPlayerFromBuffer(). It does not work with startPlayerFromMic() nor startPlayerFromStream().

This verb works fine on

  • iOS
  • Android
  • Web

On iOS and Android, the speed is changed without any impact on the pitch. On web, the pitch is affected : this must be fixed in a future version.

Note : on iOS it is mandatory to call at least one time this verb after opening the player and before the startPlayer(). This call can be dummy. For example myPlayer.setSpeed(1.0). Then, after starting the player, the app will be able to change the speed as it wants.

Note : on Android, it works only with Android API >= 23 (Android M).

Example:

await myPlayer.setSpeed(0.8);
        Lorem ipsum ...

Tags: api player