mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 00:20:32 +00:00
Merge pull request #8315 from ktprograms/fix-media-button-hide-controls
Fix hiding player controls when playing from media button
This commit is contained in:
commit
b84c6b4b32
@ -13,6 +13,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media.session.MediaButtonReceiver;
|
import androidx.media.session.MediaButtonReceiver;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.ForwardingPlayer;
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector;
|
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector;
|
||||||
|
|
||||||
@ -55,7 +56,17 @@ public class MediaSessionManager {
|
|||||||
|
|
||||||
sessionConnector = new MediaSessionConnector(mediaSession);
|
sessionConnector = new MediaSessionConnector(mediaSession);
|
||||||
sessionConnector.setQueueNavigator(new PlayQueueNavigator(mediaSession, callback));
|
sessionConnector.setQueueNavigator(new PlayQueueNavigator(mediaSession, callback));
|
||||||
sessionConnector.setPlayer(player);
|
sessionConnector.setPlayer(new ForwardingPlayer(player) {
|
||||||
|
@Override
|
||||||
|
public void play() {
|
||||||
|
callback.play();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pause() {
|
||||||
|
callback.pause();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
Loading…
Reference in New Issue
Block a user