mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	-Fixed popup and main video players not using different quality resolution.
This commit is contained in:
		| @@ -47,14 +47,18 @@ import com.google.android.exoplayer2.trackselection.DefaultTrackSelector; | ||||
|  | ||||
| import org.schabi.newpipe.R; | ||||
| import org.schabi.newpipe.extractor.stream.StreamInfo; | ||||
| import org.schabi.newpipe.extractor.stream.VideoStream; | ||||
| import org.schabi.newpipe.playlist.PlayQueueItem; | ||||
| import org.schabi.newpipe.playlist.PlayQueueItemBuilder; | ||||
| import org.schabi.newpipe.playlist.PlayQueueItemHolder; | ||||
| import org.schabi.newpipe.util.AnimationUtils; | ||||
| import org.schabi.newpipe.util.ListHelper; | ||||
| import org.schabi.newpipe.util.NavigationHelper; | ||||
| import org.schabi.newpipe.util.PermissionHelper; | ||||
| import org.schabi.newpipe.util.ThemeHelper; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import static org.schabi.newpipe.util.AnimationUtils.animateView; | ||||
|  | ||||
| /** | ||||
| @@ -316,6 +320,10 @@ public final class MainVideoPlayer extends Activity { | ||||
|             updatePlaybackButtons(); | ||||
|         } | ||||
|  | ||||
|         /*////////////////////////////////////////////////////////////////////////// | ||||
|         // Player Overrides | ||||
|         //////////////////////////////////////////////////////////////////////////*/ | ||||
|  | ||||
|         @Override | ||||
|         public void onFullScreenButtonClicked() { | ||||
|             super.onFullScreenButtonClicked(); | ||||
| @@ -434,6 +442,11 @@ public final class MainVideoPlayer extends Activity { | ||||
|             shutdown(); | ||||
|         } | ||||
|  | ||||
|         @Override | ||||
|         protected int getDefaultResolutionIndex(final List<VideoStream> sortedVideos) { | ||||
|             return ListHelper.getDefaultResolutionIndex(context, sortedVideos); | ||||
|         } | ||||
|  | ||||
|         /*////////////////////////////////////////////////////////////////////////// | ||||
|         // States | ||||
|         //////////////////////////////////////////////////////////////////////////*/ | ||||
|   | ||||
| @@ -64,6 +64,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; | ||||
| import org.schabi.newpipe.extractor.exceptions.ReCaptchaException; | ||||
| import org.schabi.newpipe.extractor.services.youtube.YoutubeStreamExtractor; | ||||
| import org.schabi.newpipe.extractor.stream.StreamInfo; | ||||
| import org.schabi.newpipe.extractor.stream.VideoStream; | ||||
| import org.schabi.newpipe.player.event.PlayerEventListener; | ||||
| import org.schabi.newpipe.player.old.PlayVideoActivity; | ||||
| import org.schabi.newpipe.playlist.PlayQueueItem; | ||||
| @@ -72,11 +73,12 @@ import org.schabi.newpipe.report.ErrorActivity; | ||||
| import org.schabi.newpipe.report.UserAction; | ||||
| import org.schabi.newpipe.util.Constants; | ||||
| import org.schabi.newpipe.util.ExtractorHelper; | ||||
| import org.schabi.newpipe.util.Localization; | ||||
| import org.schabi.newpipe.util.ListHelper; | ||||
| import org.schabi.newpipe.util.NavigationHelper; | ||||
| import org.schabi.newpipe.util.ThemeHelper; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.util.List; | ||||
|  | ||||
| import io.reactivex.android.schedulers.AndroidSchedulers; | ||||
| import io.reactivex.disposables.Disposable; | ||||
| @@ -496,6 +498,11 @@ public final class PopupVideoPlayer extends Service { | ||||
|             updateProgress(currentProgress, duration, bufferPercent); | ||||
|         } | ||||
|  | ||||
|         @Override | ||||
|         protected int getDefaultResolutionIndex(final List<VideoStream> sortedVideos) { | ||||
|             return ListHelper.getPopupDefaultResolutionIndex(context, sortedVideos); | ||||
|         } | ||||
|  | ||||
|         /*////////////////////////////////////////////////////////////////////////// | ||||
|         // Activity Event Listener | ||||
|         //////////////////////////////////////////////////////////////////////////*/ | ||||
|   | ||||
| @@ -230,6 +230,8 @@ public abstract class VideoPlayer extends BasePlayer implements SimpleExoPlayer. | ||||
|     // Playback Listener | ||||
|     //////////////////////////////////////////////////////////////////////////*/ | ||||
|  | ||||
|     protected abstract int getDefaultResolutionIndex(final List<VideoStream> sortedVideos); | ||||
|  | ||||
|     @Override | ||||
|     public void sync(@NonNull final PlayQueueItem item, @Nullable final StreamInfo info) { | ||||
|         super.sync(item, info); | ||||
| @@ -241,7 +243,7 @@ public abstract class VideoPlayer extends BasePlayer implements SimpleExoPlayer. | ||||
|             availableStreams = new ArrayList<>(videos); | ||||
|             final int qualityIndex = item.getQualityIndex(); | ||||
|             if (qualityIndex == PlayQueueItem.DEFAULT_QUALITY) { | ||||
|                 selectedStreamIndex = ListHelper.getDefaultResolutionIndex(context, videos); | ||||
|                 selectedStreamIndex = getDefaultResolutionIndex(videos); | ||||
|             } else { | ||||
|                 selectedStreamIndex = qualityIndex; | ||||
|             } | ||||
| @@ -260,7 +262,7 @@ public abstract class VideoPlayer extends BasePlayer implements SimpleExoPlayer. | ||||
|  | ||||
|         final VideoStream video; | ||||
|         if (sortedStreamsIndex == PlayQueueItem.DEFAULT_QUALITY) { | ||||
|             final int index = ListHelper.getDefaultResolutionIndex(context, videos); | ||||
|             final int index = getDefaultResolutionIndex(videos); | ||||
|             video = videos.get(index); | ||||
|         } else { | ||||
|             video = videos.get(sortedStreamsIndex); | ||||
|   | ||||
| @@ -6,7 +6,6 @@ import android.content.Intent; | ||||
| import android.preference.PreferenceManager; | ||||
| import android.support.v4.app.Fragment; | ||||
| import android.support.v4.app.FragmentManager; | ||||
| import android.text.TextUtils; | ||||
|  | ||||
| import com.nostra13.universalimageloader.core.ImageLoader; | ||||
|  | ||||
| @@ -14,14 +13,10 @@ import org.schabi.newpipe.MainActivity; | ||||
| import org.schabi.newpipe.R; | ||||
| import org.schabi.newpipe.about.AboutActivity; | ||||
| import org.schabi.newpipe.download.DownloadActivity; | ||||
| import org.schabi.newpipe.extractor.InfoItem; | ||||
| import org.schabi.newpipe.extractor.NewPipe; | ||||
| import org.schabi.newpipe.extractor.ServiceList; | ||||
| import org.schabi.newpipe.extractor.StreamingService; | ||||
| import org.schabi.newpipe.extractor.exceptions.ExtractionException; | ||||
| import org.schabi.newpipe.extractor.playlist.PlaylistInfo; | ||||
| import org.schabi.newpipe.extractor.stream.AudioStream; | ||||
| import org.schabi.newpipe.extractor.stream.StreamInfo; | ||||
| import org.schabi.newpipe.fragments.MainFragment; | ||||
| import org.schabi.newpipe.fragments.detail.VideoDetailFragment; | ||||
| import org.schabi.newpipe.fragments.list.channel.ChannelFragment; | ||||
| @@ -30,19 +25,11 @@ import org.schabi.newpipe.fragments.list.kiosk.KioskFragment; | ||||
| import org.schabi.newpipe.fragments.list.playlist.PlaylistFragment; | ||||
| import org.schabi.newpipe.fragments.list.search.SearchFragment; | ||||
| import org.schabi.newpipe.history.HistoryActivity; | ||||
| import org.schabi.newpipe.player.BackgroundPlayer; | ||||
| import org.schabi.newpipe.player.BasePlayer; | ||||
| import org.schabi.newpipe.player.VideoPlayer; | ||||
| import org.schabi.newpipe.playlist.ExternalPlayQueue; | ||||
| import org.schabi.newpipe.playlist.PlayQueue; | ||||
| import org.schabi.newpipe.playlist.SinglePlayQueue; | ||||
| import org.schabi.newpipe.settings.SettingsActivity; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import static android.text.TextUtils.split; | ||||
|  | ||||
| @SuppressWarnings({"unused", "WeakerAccess"}) | ||||
| public class NavigationHelper { | ||||
|     public static final String MAIN_FRAGMENT_TAG = "main_fragment_tag"; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 John Zhen Mo
					John Zhen Mo