Commit graph

1011 commits

Author SHA1 Message Date
Stypox
b6b09b68af Actually there is no need to use flatMap
`null` values returned in the lambda are converted to empty `Optional`s in the `map` method: https://developer.android.com/reference/java/util/Optional#map(java.util.function.Function%3C?%20super%20T,%20?%20extends%20U%3E)
2023-01-11 15:26:46 +01:00
Stypox
8ea120865c Use Optional.map correctly and other improvements 2023-01-11 14:47:53 +01:00
Isira Seneviratne
245406e967 Apply code review suggestions. 2023-01-04 06:10:14 +05:30
Isira Seneviratne
af75d5a055 Use Optional chaining. 2023-01-04 05:16:21 +05:30
Isira Seneviratne
cae0eda806 Remove SimplifyOptionalCallChains. 2023-01-04 05:16:21 +05:30
Stypox
ae0f0b94a3 Merge pull request #9553 from Redirion/exo182
Update ExoPlayer to 2.18.2
2023-01-02 18:21:53 +01:00
Stypox
fc5a5c4e1c Merge pull request #9562 from bravenewpipe/use-videostream-for-audio-only-background-playback
Support audio only background for services only supporting video streams
2023-01-02 17:51:10 +01:00
Robin
b5c19b1d59 Merge branch 'TeamNewPipe:dev' into exo182 2023-01-02 10:35:20 +01:00
Stypox
3a34b0f933 Merge pull request #9496 from Jared234/9437_continue_playing_while_seeking
Seeking no longer pauses the played video
2022-12-31 19:19:21 +01:00
Stypox
a9003d9b55 Merge pull request #9159 from Isira-Seneviratne/Refactor_VideoPlayerUi
Refactor VideoPlayerUi.
2022-12-31 19:01:19 +01:00
Stypox
7a57485107 Merge pull request #9306 from Stypox/target-api-33
Set compileSdk and targetSdk to 33 (Android 13)
2022-12-31 14:49:30 +01:00
Stypox
97892f04d3 Merge pull request #8895 from Isira-Seneviratne/SparseArrayCompat
Use SparseArrayCompat.
2022-12-28 20:37:05 +01:00
evermind
5469887830 Support audio only background for services only supporting video streams
Some services may only have video streams and no separate audio streams available.
This commit will add audio background playback support for those services.
It uses the video source as audio source for background playback.
2022-12-17 21:17:42 +01:00
Robin
f2becad472 Update ExoPlayer to 2.18.2 2022-12-16 17:53:56 +01:00
Jared Fantaye
ca2d6ee6b8 Removed the wasPlaying variable 2022-12-10 21:56:04 +01:00
Isira Seneviratne
3ae0bbc4a3 Merge branch 'dev' into Refactor_VideoPlayerUi 2022-12-06 20:21:08 +05:30
Douile
81df0e05df Only show "Enqueue next" when in the middle of the queue
Add a check that the queue position is not the last in the queue before
showing "Enqueue next".

Previously the "Enqueue next" action would always be shown if the queue
length was greater than one, this meant even if you were at the end of
the queue (when "Enqueue" would have the same effect as "Enqueue next")
the action would still be shown.
2022-12-04 18:20:50 +01:00
Isira Seneviratne
846f59c73b Use BitmapCompat.createScaledBitmap(). 2022-11-29 15:56:19 +01:00
Jared Fantaye
971afd70ca Seeking no longer pauses the played video 2022-11-26 15:35:13 +01:00
Isira Seneviratne
1e42bb6baa Use SparseArrayCompat for thumbnails. 2022-11-22 17:51:54 +05:30
Stypox
2a0fda2849 Set compileSdk and targetSdk to 33 (Android 13)
android:exported in now required in the manifest on all activities/services/receivers/providers. It was set to true for those that need to interact with outside apps or the OS, while others have exported=false.
This also required updating LeakCanary to the latest version as the older version being used was not using android:exported in AndroidManifest.xml.
2022-11-18 08:33:13 +01:00
Isira Seneviratne
def00c8dfd Merge branch 'dev' into Refactor_VideoPlayerUi 2022-11-14 08:59:03 +05:30
Isira Seneviratne
0ca88d029e Add helper methods for adding PendingIntent mutability. 2022-11-07 17:12:22 +05:30
Isira Seneviratne
c0a2b6c1f3 Use OnClickListener and OnLongClickListener lambdas in the player UIs. 2022-11-03 05:09:35 +05:30
Stypox
86d5214e72 Merge pull request #9203 from Callisto404/add-chapter-timestamp-share
Added timestamped link sharing from the start of a chapter with a long hold press
2022-10-30 22:31:09 +01:00
Daniel M
8e08c2abd0 Added an "isYouTube" check to start of long click handler 2022-10-30 13:48:03 +11:00
Stypox
fd1237698d Merge pull request #8747 from Isira-Seneviratne/Range_limit
Use range-limiting methods in more places.
2022-10-28 10:34:04 +02:00
Daniel M
2b9df99617 Added sharing a link with timestamp from a chapter into the long click for each chapter 2022-10-24 14:14:41 +11:00
Tobi
d697191086 Merge pull request #8946 from HybridAU/add_play_queue_button_to_video_details_fragment
Add play queue button to video details fragment
2022-10-06 18:55:50 +02:00
HybridAU
dcca274ecc Add play queue button to video details fragment
* Add play queue button to video details fragment

* Use existing ic_list icon

* Still open play queue even when queue is empty

* Change app:srcCompat to android:src
2022-09-14 21:00:44 +08:00
Stypox
0e5ad2ec3a Only update notification large icon when it changes 2022-08-28 23:14:02 +02:00
Stypox
3cdc9154ea Use player.getThumbnail() instead of field in VideoPlayerUi 2022-08-28 18:35:21 +02:00
Stypox
9d45c80324 Remove thumbnail before sync, if outdated
Also refactor onPlaybackSynchronize and add comments
2022-08-28 18:32:27 +02:00
Stypox
2fd24b745d Unify onThumbnailLoaded calls to ensure UIs always updated 2022-08-28 17:24:51 +02:00
litetex
cac64a9964 Fixed sonar detected problems
+ Automatically fixed code style (imports)
2022-08-25 17:02:53 +02:00
Stypox
624292abe4 Review suggestions 2022-08-25 17:02:53 +02:00
Stypox
ce1b88eeec Keep strong reference to Picasso thumbnail loading target
Before the Target would sometimes be garbage collected before being called with the loaded thumbnail, since Picasso holds weak references to targets
2022-08-25 17:02:52 +02:00
Stypox
573b4ff8bc Merge MediaSessionManager into MediaSessionPlayerUi 2022-08-25 17:02:52 +02:00
Stypox
c8066c6eb7 Let exoplayer decide when to update metadata
Though still make sure metadata is updated after the thumbnail is loaded.
This fixes the wrong seekbar properties (duration and current position) being shown in the notification sometimes.
2022-08-25 17:02:52 +02:00
Stypox
a4c5d1ee3b Remove useless checks before updating metadata
A while ago NewPipe called the metadata update function very often, so checks were needed to ensure not wasting time updating metadata if it were already up to date. Now, instead, the metadata update function is called exactly when needed, i.e. when metadata changes, so such checks are not needed anymore (and were probably also a little resource-heavy).
2022-08-25 17:02:51 +02:00
Stypox
1a4e886d4b Even when thumbnails should not be shown, set it to null in notification
This makes sure the thumbnail is removed from the notification if the user disables thumbnails
2022-08-25 17:02:51 +02:00
Stypox
9fe370cda1 Fix sometimes seeing outdated thumbnail in notification
Before the thumbnail finishes loading for the new video the player is now playing, the old thumbnail was being used, leading to wrong thumbnails set in the media session and the notification.
2022-08-25 17:02:51 +02:00
Stypox
356fa3f12d Fix thumbnail sometimes not set to media session metadata
The thumbnail was not being updated in the media session metadata after it was loaded, since there was no metadata update in that case, only a notification update.
2022-08-25 17:00:41 +02:00
Stypox
97892be897 Remove useless MediaSessionCallback
The player is now passed directly, it made no sense to wrap around it in a callback that was not really a callback but rather, actually, a wrapper.
2022-08-25 17:00:41 +02:00
Stypox
aa0a1cd70e Create MediaSessionPlayerUi 2022-08-25 17:00:41 +02:00
Isira Seneviratne
2e350c9675 Use range-limiting methods in more places. 2022-08-08 07:10:16 +05:30
Stypox
2fac881694 Merge pull request #8724 from Isira-Seneviratne/toArray_improvements
Use toArray() with zero-length arrays.
2022-08-06 11:33:05 +02:00
Isira Seneviratne
fbf3df2c60 Applied code review changes. 2022-08-05 06:54:03 +05:30
Isira Seneviratne
b49b8f325d Use toArray() with zero-length arrays. 2022-08-05 06:50:55 +05:30
Isira Seneviratne
177dffdcbd Replace coerceIn() with MathUtils.clamp(). 2022-08-05 06:19:06 +05:30