forked from TeamNewPipe/NewPipe
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature implementation from commits a0b76c3..f39eda0 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yashuatla
wants to merge
26
commits into
feature-base-1
Choose a base branch
from
feature-head-1
base: feature-base-1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
b764ad3
Drop some assumptions on how PlayerService is started and reused
Stypox 5819546
Have PlayerService implement MediaBrowserServiceCompat
Stypox 7d17468
Instantiate media session and connector in PlayerService
Stypox 1e08cc8
Add MediaBrowserCommon with info item's and pages' IDs
Stypox 9bb2c0b
Add getPlaylist(id) to RemotePlaylistManager
Stypox 690b40d
Allow creating PlayQueue from ListInfo and index
Stypox 5eabcb5
Add getThumbnailUrl() to PlaylistLocalItem interface
Stypox 6cedd11
Add StreamHistoryEntry.toStreamInfoItem()
Stypox 3fcac10
Add MediaBrowserPlaybackPreparer
Stypox 4c88a19
Add MediaBrowserImpl
Stypox 064e1d3
Use the media browser implementation in PlayerService
Stypox ec6612d
Call exoPlayer.prepare() on PlaybackPreparer.onPrepare()
Stypox dc62d21
Properly stop PlayerService
Stypox e5458bc
Properly handle item errors during media browser loading
Stypox 1d98518
Fix loading remote playlists in media browser
Stypox 6558794
Try to bind to PlayerService when MainActivity starts
Stypox 126f4b0
Fix crash when closing video detail fragment
Stypox a7a7dc5
Handle player and player service separately
Stypox 49b7194
Fix style and add comment about null player
Stypox b378931
Merge pull request #12104 from TeamNewPipe/update-npe
Stypox 196c277
Merge pull request #12044 from TeamNewPipe/android-auto
Stypox 6d6b73e
textview for download date added
malania02 536b78f
textview for download date added
malania02 63be322
Show download date
malania02 912f07a
Missing lines added
malania02 f39eda0
Fix for overlapping
malania02 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,7 @@ | |
| import android.graphics.Bitmap; | ||
| import android.graphics.drawable.Drawable; | ||
| import android.media.AudioManager; | ||
| import android.support.v4.media.session.MediaSessionCompat; | ||
| import android.util.Log; | ||
| import android.view.LayoutInflater; | ||
|
|
||
|
|
@@ -71,6 +72,7 @@ | |
| import com.google.android.exoplayer2.Player.PositionInfo; | ||
| import com.google.android.exoplayer2.Timeline; | ||
| import com.google.android.exoplayer2.Tracks; | ||
| import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector; | ||
| import com.google.android.exoplayer2.source.MediaSource; | ||
| import com.google.android.exoplayer2.text.CueGroup; | ||
| import com.google.android.exoplayer2.trackselection.DefaultTrackSelector; | ||
|
|
@@ -269,7 +271,16 @@ public final class Player implements PlaybackListener, Listener { | |
| //////////////////////////////////////////////////////////////////////////*/ | ||
| //region Constructor | ||
|
|
||
| public Player(@NonNull final PlayerService service) { | ||
| /** | ||
| * @param service the service this player resides in | ||
| * @param mediaSession used to build the {@link MediaSessionPlayerUi}, lives in the service and | ||
| * could possibly be reused with multiple player instances | ||
| * @param sessionConnector used to build the {@link MediaSessionPlayerUi}, lives in the service | ||
| * and could possibly be reused with multiple player instances | ||
| */ | ||
| public Player(@NonNull final PlayerService service, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🐛 Correctness Issue Breaking Constructor Signature Change. The Player constructor now requires two additional parameters which will break all existing code that instantiates this class. Proposed Code: |
||
| @NonNull final MediaSessionCompat mediaSession, | ||
| @NonNull final MediaSessionConnector sessionConnector) { | ||
| this.service = service; | ||
| context = service; | ||
| prefs = PreferenceManager.getDefaultSharedPreferences(context); | ||
|
|
@@ -302,7 +313,7 @@ public Player(@NonNull final PlayerService service) { | |
| // notification ui in the UIs list, since the notification depends on the media session in | ||
| // PlayerUi#initPlayer(), and UIs.call() guarantees UI order is preserved. | ||
| UIs = new PlayerUiList( | ||
| new MediaSessionPlayerUi(this), | ||
| new MediaSessionPlayerUi(this, mediaSession, sessionConnector), | ||
| new NotificationPlayerUi(this) | ||
| ); | ||
| } | ||
|
|
@@ -646,7 +657,7 @@ public void onPlaybackShutdown() { | |
| Log.d(TAG, "onPlaybackShutdown() called"); | ||
| } | ||
| // destroys the service, which in turn will destroy the player | ||
| service.stopService(); | ||
| service.destroyPlayerAndStopService(); | ||
| } | ||
|
|
||
| public void smoothStopForImmediateReusing() { | ||
|
|
@@ -718,7 +729,7 @@ private void onBroadcastReceived(final Intent intent) { | |
| pause(); | ||
| break; | ||
| case ACTION_CLOSE: | ||
| service.stopService(); | ||
| service.destroyPlayerAndStopService(); | ||
| break; | ||
| case ACTION_PLAY_PAUSE: | ||
| playPause(); | ||
|
|
@@ -1375,6 +1386,19 @@ public void onRenderedFirstFrame() { | |
| public void onCues(@NonNull final CueGroup cueGroup) { | ||
| UIs.call(playerUi -> playerUi.onCues(cueGroup.cues)); | ||
| } | ||
|
|
||
| /** | ||
| * To be called when the {@code PlaybackPreparer} set in the {@link MediaSessionConnector} | ||
| * receives an {@code onPrepare()} call. This function allows restoring the default behavior | ||
| * that would happen if there was no playback preparer set, i.e. to just call | ||
| * {@code player.prepare()}. You can find the default behavior in `onPlay()` inside the | ||
| * {@link MediaSessionConnector} file. | ||
| */ | ||
| public void onPrepare() { | ||
| if (!exoPlayerIsNull()) { | ||
| simpleExoPlayer.prepare(); | ||
| } | ||
| } | ||
| //endregion | ||
|
|
||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Breaking API Change: Return Type Modification.
Changing return type from Flowable<List> to Flowable will break code that expects a list structure.
Current Code (Diff):
📝 Committable suggestion