Skip to content
Merged
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
61 changes: 31 additions & 30 deletions app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public final class Player implements
/*//////////////////////////////////////////////////////////////////////////
// Constructor
//////////////////////////////////////////////////////////////////////////*/
//region
//region Constructor

public Player(@NonNull final MainPlayer service) {
this.service = service;
Expand Down Expand Up @@ -437,7 +437,7 @@ public int getOverrideResolutionIndex(final List<VideoStream> sortedVideos,
/*//////////////////////////////////////////////////////////////////////////
// Setup and initialization
//////////////////////////////////////////////////////////////////////////*/
//region
//region Setup and initialization

public void setupFromView(@NonNull final PlayerBinding playerBinding) {
initViews(playerBinding);
Expand Down Expand Up @@ -585,7 +585,7 @@ public void onChange(final boolean selfChange) {
/*//////////////////////////////////////////////////////////////////////////
// Playback initialization via intent
//////////////////////////////////////////////////////////////////////////*/
//region
//region Playback initialization via intent

public void handleIntent(@NonNull final Intent intent) {
// fail fast if no play queue was provided
Expand Down Expand Up @@ -774,7 +774,7 @@ private void initPlayback(@NonNull final PlayQueue queue,
/*//////////////////////////////////////////////////////////////////////////
// Destroy and recovery
//////////////////////////////////////////////////////////////////////////*/
//region
//region Destroy and recovery

private void destroyPlayer() {
if (DEBUG) {
Expand Down Expand Up @@ -883,7 +883,7 @@ public void smoothStopPlayer() {
/*//////////////////////////////////////////////////////////////////////////
// Player type specific setup
//////////////////////////////////////////////////////////////////////////*/
//region
//region Player type specific setup

private void initVideoPlayer() {
// restore last resize mode
Expand Down Expand Up @@ -945,7 +945,7 @@ private void initPopupCloseOverlay() {
/*//////////////////////////////////////////////////////////////////////////
// Elements visibility and size: popup and main players have different look
//////////////////////////////////////////////////////////////////////////*/
//region
//region Elements visibility and size: popup and main players have different look

/**
* This method ensures that popup and main players have different look.
Expand Down Expand Up @@ -1059,7 +1059,7 @@ private void showHideKodiButton() {
/*//////////////////////////////////////////////////////////////////////////
// Broadcast receiver
//////////////////////////////////////////////////////////////////////////*/
//region
//region Broadcast receiver

private void setupBroadcastReceiver() {
if (DEBUG) {
Expand Down Expand Up @@ -1211,7 +1211,7 @@ private void unregisterBroadcastReceiver() {
/*//////////////////////////////////////////////////////////////////////////
// Thumbnail loading
//////////////////////////////////////////////////////////////////////////*/
//region
//region Thumbnail loading

private void initThumbnail(final String url) {
if (DEBUG) {
Expand Down Expand Up @@ -1358,7 +1358,7 @@ public void onLoadingCancelled(final String imageUri, final View view) {
/*//////////////////////////////////////////////////////////////////////////
// Popup player utils
//////////////////////////////////////////////////////////////////////////*/
//region
//region Popup player utils

/**
* Check if {@link #popupLayoutParams}' position is within a arbitrary boundary
Expand Down Expand Up @@ -1533,7 +1533,7 @@ private boolean anyPopupViewIsNull() {
/*//////////////////////////////////////////////////////////////////////////
// Playback parameters
//////////////////////////////////////////////////////////////////////////*/
//region
//region Playback parameters

public float getPlaybackSpeed() {
return getPlaybackParameters().speed;
Expand Down Expand Up @@ -1586,7 +1586,7 @@ public void setPlaybackParameters(final float speed, final float pitch,
/*//////////////////////////////////////////////////////////////////////////
// Progress loop and updates
//////////////////////////////////////////////////////////////////////////*/
//region
//region Progress loop and updates

private void onUpdateProgress(final int currentProgress,
final int duration,
Expand Down Expand Up @@ -1802,7 +1802,7 @@ public void saveWasPlaying() {
/*//////////////////////////////////////////////////////////////////////////
// Controls showing / hiding
//////////////////////////////////////////////////////////////////////////*/
//region
//region Controls showing / hiding

public boolean isControlsVisible() {
return binding != null && binding.playbackControlRoot.getVisibility() == View.VISIBLE;
Expand Down Expand Up @@ -1972,7 +1972,7 @@ private void hideSystemUIIfNeeded() {
/*//////////////////////////////////////////////////////////////////////////
// Playback states
//////////////////////////////////////////////////////////////////////////*/
//region
//region Playback states

@Override // exoplayer listener
public void onPlayerStateChanged(final boolean playWhenReady, final int playbackState) {
Expand Down Expand Up @@ -2293,7 +2293,7 @@ private void animatePlayButtons(final boolean show, final int duration) {
/*//////////////////////////////////////////////////////////////////////////
// Repeat and shuffle
//////////////////////////////////////////////////////////////////////////*/
//region
//region Repeat and shuffle

public void onRepeatClicked() {
if (DEBUG) {
Expand Down Expand Up @@ -2382,7 +2382,7 @@ private void setShuffleButton(final ImageButton button, final boolean shuffled)
/*//////////////////////////////////////////////////////////////////////////
// Mute / Unmute
//////////////////////////////////////////////////////////////////////////*/
//region
//region Mute / Unmute

public void onMuteUnmuteButtonClicked() {
if (DEBUG) {
Expand All @@ -2408,7 +2408,7 @@ private void setMuteButton(final ImageButton button, final boolean isMuted) {
/*//////////////////////////////////////////////////////////////////////////
// ExoPlayer listeners (that didn't fit in other categories)
//////////////////////////////////////////////////////////////////////////*/
//region
//region ExoPlayer listeners (that didn't fit in other categories)

@Override
public void onTimelineChanged(@NonNull final Timeline timeline, final int reason) {
Expand Down Expand Up @@ -2496,7 +2496,7 @@ public void onRenderedFirstFrame() {
/*//////////////////////////////////////////////////////////////////////////
// Errors
//////////////////////////////////////////////////////////////////////////*/
//region
//region Errors
/**
* Process exceptions produced by {@link com.google.android.exoplayer2.ExoPlayer ExoPlayer}.
* <p>There are multiple types of errors:</p>
Expand Down Expand Up @@ -2597,7 +2597,7 @@ private void showUnrecoverableError(final Exception exception) {
/*//////////////////////////////////////////////////////////////////////////
// Playback position and seek
//////////////////////////////////////////////////////////////////////////*/
//region
//region Playback position and seek

@Override // own playback listener (this is a getter)
public boolean isApproachingPlaybackEdge(final long timeToEndMillis) {
Expand Down Expand Up @@ -2747,7 +2747,7 @@ public void seekToDefault() {
/*//////////////////////////////////////////////////////////////////////////
// Player actions (play, pause, previous, fast-forward, ...)
//////////////////////////////////////////////////////////////////////////*/
//region
//region Player actions (play, pause, previous, fast-forward, ...)

public void play() {
if (DEBUG) {
Expand Down Expand Up @@ -2855,7 +2855,7 @@ public void fastRewind() {
/*//////////////////////////////////////////////////////////////////////////
// StreamInfo history: views and progress
//////////////////////////////////////////////////////////////////////////*/
//region
//region StreamInfo history: views and progress

private void registerStreamViewed() {
if (currentMetadata != null) {
Expand Down Expand Up @@ -2913,7 +2913,7 @@ public void saveStreamProgressStateCompleted() {
/*//////////////////////////////////////////////////////////////////////////
// Metadata
//////////////////////////////////////////////////////////////////////////*/
//region
//region Metadata

private void onMetadataChanged(@NonNull final MediaSourceTag tag) {
final StreamInfo info = tag.getMetadata();
Expand Down Expand Up @@ -3022,7 +3022,7 @@ public Bitmap getThumbnail() {
/*//////////////////////////////////////////////////////////////////////////
// Play queue, segments and streams
//////////////////////////////////////////////////////////////////////////*/
//region
//region Play queue, segments and streams

private void maybeAutoQueueNextStream(@NonNull final MediaSourceTag metadata) {
if (playQueue == null || playQueue.getIndex() != playQueue.size() - 1
Expand Down Expand Up @@ -3338,7 +3338,7 @@ private void updateQueueTime(final int currentTime) {
/*//////////////////////////////////////////////////////////////////////////
// Popup menus ("popup" means that they pop up, not that they belong to the popup player)
//////////////////////////////////////////////////////////////////////////*/
//region
//region Popup menus ("popup" means that they pop up, not that they belong to the popup player)

private void buildQualityMenu() {
if (qualityPopupMenu == null) {
Expand Down Expand Up @@ -3541,7 +3541,7 @@ private void setPlaybackQuality(final String quality) {
/*//////////////////////////////////////////////////////////////////////////
// Captions (text tracks)
//////////////////////////////////////////////////////////////////////////*/
//region
//region Captions (text tracks)

private void setupSubtitleView() {
final float captionScale = PlayerHelper.getCaptionScale(context);
Expand Down Expand Up @@ -3620,7 +3620,7 @@ private int getCaptionRendererIndex() {
/*//////////////////////////////////////////////////////////////////////////
// Click listeners
//////////////////////////////////////////////////////////////////////////*/
//region
//region Click listeners

@Override
public void onClick(final View v) {
Expand Down Expand Up @@ -3808,7 +3808,7 @@ private void onOpenInBrowserClicked() {
/*//////////////////////////////////////////////////////////////////////////
// Video size, resize, orientation, fullscreen
//////////////////////////////////////////////////////////////////////////*/
//region
//region Video size, resize, orientation, fullscreen

private void setupScreenRotationButton() {
binding.screenRotationButton.setVisibility(videoPlayerSelected()
Expand Down Expand Up @@ -3915,7 +3915,7 @@ public void checkLandscape() {
/*//////////////////////////////////////////////////////////////////////////
// Gestures
//////////////////////////////////////////////////////////////////////////*/
//region
//region Gestures

@SuppressWarnings("checkstyle:ParameterNumber")
private void onLayoutChange(final View view, final int l, final int t, final int r, final int b,
Expand Down Expand Up @@ -3979,7 +3979,7 @@ public boolean isInsideClosingRadius(final MotionEvent popupMotionEvent) {
/*//////////////////////////////////////////////////////////////////////////
// Activity / fragment binding
//////////////////////////////////////////////////////////////////////////*/
//region
//region Activity / fragment binding

public void setFragmentListener(final PlayerServiceEventListener listener) {
fragmentListener = listener;
Expand Down Expand Up @@ -4118,7 +4118,7 @@ private void useVideoSource(final boolean video) {
/*//////////////////////////////////////////////////////////////////////////
// Getters
//////////////////////////////////////////////////////////////////////////*/
//region
//region Getters

public int getCurrentState() {
return currentState;
Expand Down Expand Up @@ -4304,6 +4304,7 @@ public PlayQueueAdapter getPlayQueueAdapter() {
// SurfaceHolderCallback helpers
//////////////////////////////////////////////////////////////////////////*/
//region SurfaceHolderCallback helpers

private void setupVideoSurface() {
// make sure there is nothing left over from previous calls
cleanupVideoSurface();
Expand Down Expand Up @@ -4331,5 +4332,5 @@ private void cleanupVideoSurface() {
}
}
}
//endregion SurfaceHolderCallback helpers
//endregion
}