mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-28 18:57:43 +00:00
Speed up audio on double tap
This commit is contained in:
parent
f44e655361
commit
fa71c81ea9
@ -23,6 +23,7 @@ import com.google.android.exoplayer2.DefaultRenderersFactory;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.ExoPlayerFactory;
|
||||
import com.google.android.exoplayer2.LoadControl;
|
||||
import com.google.android.exoplayer2.PlaybackParameters;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
import com.google.android.exoplayer2.audio.AudioAttributes;
|
||||
@ -284,6 +285,16 @@ public class AudioSlidePlayer implements SensorEventListener {
|
||||
}
|
||||
}
|
||||
|
||||
public float getPlaybackSpeed() {
|
||||
if (mediaPlayer == null) { return 1.0f; }
|
||||
return mediaPlayer.getPlaybackParameters().speed;
|
||||
}
|
||||
|
||||
public void setPlaybackSpeed(float speed) {
|
||||
if (mediaPlayer == null) { return; }
|
||||
mediaPlayer.setPlaybackParameters(new PlaybackParameters(speed));
|
||||
}
|
||||
|
||||
private void notifyOnStart() {
|
||||
Util.runOnMain(() -> getListener().onPlayerStart(AudioSlidePlayer.this));
|
||||
}
|
||||
|
@ -105,7 +105,8 @@ class VoiceMessageView : LinearLayout, AudioSlidePlayer.Listener {
|
||||
}
|
||||
|
||||
fun handleDoubleTap() {
|
||||
Log.d("Test", "handleDoubleTap()")
|
||||
val player = this.player ?: return
|
||||
player.playbackSpeed = if (player.playbackSpeed == 1.0f) 1.5f else 1.0f
|
||||
}
|
||||
// endregion
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user