mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 03:58:48 +00:00
Fix voice note playback for single voice notes.
This commit is contained in:
@@ -111,6 +111,7 @@ public class VoiceNotePlaybackService extends MediaSessionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class VoiceNotePlayerEventListener implements Player.Listener {
|
private class VoiceNotePlayerEventListener implements Player.Listener {
|
||||||
|
private int previousPlaybackState = player.getPlaybackState();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayWhenReadyChanged(boolean playWhenReady, int reason) {
|
public void onPlayWhenReadyChanged(boolean playWhenReady, int reason) {
|
||||||
@@ -123,6 +124,7 @@ public class VoiceNotePlaybackService extends MediaSessionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onPlaybackStateChanged(boolean playWhenReady, int playbackState) {
|
private void onPlaybackStateChanged(boolean playWhenReady, int playbackState) {
|
||||||
|
Log.d(TAG, "playWhenReady: " + playWhenReady + "\nplaybackState: " + playbackState);
|
||||||
switch (playbackState) {
|
switch (playbackState) {
|
||||||
case Player.STATE_BUFFERING:
|
case Player.STATE_BUFFERING:
|
||||||
case Player.STATE_READY:
|
case Player.STATE_READY:
|
||||||
@@ -134,10 +136,13 @@ public class VoiceNotePlaybackService extends MediaSessionService {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Player.STATE_ENDED:
|
case Player.STATE_ENDED:
|
||||||
|
if (previousPlaybackState == Player.STATE_READY) {
|
||||||
player.clearMediaItems();
|
player.clearMediaItems();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
previousPlaybackState = playbackState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user