Enqueue: Add auto-select StreamDialogEntry for current PlayerType
This commit is contained in:
parent
dd55ad61f4
commit
cd515993f5
4 changed files with 78 additions and 2 deletions
|
|
@ -6,8 +6,12 @@ import android.content.Intent;
|
|||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.PlaybackParameters;
|
||||
|
||||
import org.schabi.newpipe.App;
|
||||
import org.schabi.newpipe.MainActivity;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
||||
|
|
@ -31,6 +35,22 @@ public final class PlayerHolder {
|
|||
private static MainPlayer playerService;
|
||||
private static VideoPlayerImpl player;
|
||||
|
||||
/**
|
||||
* Returns the current {@link MainPlayer.PlayerType} of the {@link MainPlayer} service,
|
||||
* otherwise `null` if no service running.
|
||||
*/
|
||||
@Nullable
|
||||
public static MainPlayer.PlayerType getType() {
|
||||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return player.videoPlayerSelected() ? MainPlayer.PlayerType.VIDEO
|
||||
: player.popupPlayerSelected() ? MainPlayer.PlayerType.POPUP
|
||||
: player.audioPlayerSelected() ? MainPlayer.PlayerType.AUDIO
|
||||
: null;
|
||||
}
|
||||
|
||||
public static void setListener(final PlayerServiceExtendedEventListener newListener) {
|
||||
listener = newListener;
|
||||
// Force reload data from service
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue