Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</service>

<activity
android:name=".player.BackgroundPlayerActivity"
android:name=".player.PlayQueueActivity"
android:label="@string/title_activity_play_queue"
android:launchMode="singleTask" />

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/schabi/newpipe/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
import org.schabi.newpipe.fragments.MainFragment;
import org.schabi.newpipe.fragments.detail.VideoDetailFragment;
import org.schabi.newpipe.fragments.list.search.SearchFragment;
import org.schabi.newpipe.player.VideoPlayer;
import org.schabi.newpipe.player.Player;
import org.schabi.newpipe.player.event.OnKeyDownListener;
import org.schabi.newpipe.player.helper.PlayerHolder;
import org.schabi.newpipe.player.playqueue.PlayQueue;
Expand Down Expand Up @@ -763,7 +763,7 @@ private void handleIntent(final Intent intent) {
switch (linkType) {
case STREAM:
final String intentCacheKey = intent.getStringExtra(
VideoPlayer.PLAY_QUEUE_KEY);
Player.PLAY_QUEUE_KEY);
final PlayQueue playQueue = intentCacheKey != null
? SerializedCache.getInstance()
.take(intentCacheKey, PlayQueue.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.tabs.TabLayout;
Expand Down Expand Up @@ -80,9 +79,8 @@
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
import org.schabi.newpipe.local.dialog.PlaylistCreationDialog;
import org.schabi.newpipe.local.history.HistoryRecordManager;
import org.schabi.newpipe.player.BasePlayer;
import org.schabi.newpipe.player.Player;
import org.schabi.newpipe.player.MainPlayer;
import org.schabi.newpipe.player.VideoPlayerImpl;
import org.schabi.newpipe.player.event.OnKeyDownListener;
import org.schabi.newpipe.player.event.PlayerServiceExtendedEventListener;
import org.schabi.newpipe.player.helper.PlayerHelper;
Expand Down Expand Up @@ -255,14 +253,14 @@ public final class VideoDetailFragment

private ContentObserver settingsContentObserver;
private MainPlayer playerService;
private VideoPlayerImpl player;
private Player player;


/*//////////////////////////////////////////////////////////////////////////
// Service management
//////////////////////////////////////////////////////////////////////////*/
@Override
public void onServiceConnected(final VideoPlayerImpl connectedPlayer,
public void onServiceConnected(final Player connectedPlayer,
final MainPlayer connectedPlayerService,
final boolean playAfterConnect) {
player = connectedPlayer;
Expand Down Expand Up @@ -539,7 +537,7 @@ public void onClick(final View v) {
break;
case R.id.overlay_play_pause_button:
if (playerIsNotStopped()) {
player.onPlayPause();
player.playPause();
player.hideControls(0, 0);
showSystemUi();
} else {
Expand Down Expand Up @@ -805,7 +803,7 @@ public boolean onBackPressed() {
// If we are in fullscreen mode just exit from it via first back press
if (player != null && player.isFullscreen()) {
if (!DeviceUtils.isTablet(activity)) {
player.onPause();
player.pause();
}
restoreDefaultOrientation();
setAutoPlay(false);
Expand Down Expand Up @@ -850,7 +848,7 @@ private void setupFromHistoryItem(final StackItem item) {

final PlayQueueItem playQueueItem = item.getPlayQueue().getItem();
// Update title, url, uploader from the last item in the stack (it's current now)
final boolean isPlayerStopped = player == null || player.isPlayerStopped();
final boolean isPlayerStopped = player == null || player.isStopped();
if (playQueueItem != null && isPlayerStopped) {
updateOverlayData(playQueueItem.getTitle(),
playQueueItem.getUploader(), playQueueItem.getThumbnailUrl());
Expand Down Expand Up @@ -1569,7 +1567,7 @@ public void handleResult(@NonNull final StreamInfo info) {
showMetaInfoInTextView(info.getMetaInfo(), detailMetaInfoTextView, detailMetaInfoSeparator);


if (player == null || player.isPlayerStopped()) {
if (player == null || player.isStopped()) {
updateOverlayData(info.getName(), info.getUploaderName(), info.getThumbnailUrl());
}

Expand Down Expand Up @@ -1797,7 +1795,7 @@ public void onPlaybackUpdate(final int state,
setOverlayPlayPauseImage(player != null && player.isPlaying());

switch (state) {
case BasePlayer.STATE_PLAYING:
case Player.STATE_PLAYING:
if (positionView.getAlpha() != 1.0f
&& player.getPlayQueue() != null
&& player.getPlayQueue().getItem() != null
Expand All @@ -1814,7 +1812,7 @@ public void onProgressUpdate(final int currentProgress,
final int duration,
final int bufferPercent) {
// Progress updates every second even if media is paused. It's useless until playing
if (!player.getPlayer().isPlaying() || playQueue == null) {
if (!player.isPlaying() || playQueue == null) {
return;
}

Expand Down Expand Up @@ -1891,10 +1889,8 @@ public void onFullscreenStateChanged(final boolean fullscreen) {

if (fullscreen) {
hideSystemUiIfNeeded();
viewPager.setVisibility(View.GONE);
} else {
showSystemUi();
viewPager.setVisibility(View.VISIBLE);
}

if (relatedStreamsLayout != null) {
Expand Down Expand Up @@ -2020,9 +2016,7 @@ public void hideSystemUiIfNeeded() {
}

private boolean playerIsNotStopped() {
return player != null
&& player.getPlayer() != null
&& player.getPlayer().getPlaybackState() != Player.STATE_IDLE;
return player != null && !player.isStopped();
}

private void restoreDefaultBrightness() {
Expand Down Expand Up @@ -2073,7 +2067,7 @@ private void checkLandscape() {
player.checkLandscape();
// Let's give a user time to look at video information page if video is not playing
if (globalScreenOrientationLocked(activity) && !player.isPlaying()) {
player.onPlay();
player.play();
}
}

Expand Down Expand Up @@ -2287,7 +2281,7 @@ public void onStateChanged(@NonNull final View bottomSheet, final int newState)
// Re-enable clicks
setOverlayElementsClickable(true);
if (player != null) {
player.onQueueClosed();
player.closeQueue();
}
setOverlayLook(appBarLayout, behavior, 0);
break;
Expand Down

This file was deleted.

Loading