Commit Graph

9088 Commits

Author SHA1 Message Date
Profpatsch d134219da5 resolver: document the `audioTrack` setters better 2024-01-07 19:59:09 +01:00
Profpatsch e242ad42a8 getFilteredAudioStreams: Use language and tracktype for grouping
Instead of the `trackId`, which is only ever set for the `youtube`
backend, we use the audio stream language and tracktype. These are
`null` for youtube videos without language selector, leading to a
single audio stream being selected.

For media.ccc.de, the language on audio tracks is always set
correctly, meaning for a video with German and English tracks we get
two groups, which are then sorted according to the preferences of
users.

I verified that youtube still works by playing
https://www.youtube.com/watch?v=8bDRVP9xSfc
and selecting the different audio streams, going to background etc.
and also tried with a video without multiple audio tracks.

For media.ccc.de, it will select the right audio track as well.

Unfortunately, media.ccc.de returns videos with multiple audio track
muxed into the video itself, which is still buggy because the wrong
track is selected by default. This is gonna be fixed/worked around in
the next commit.
2024-01-07 19:35:18 +01:00
Profpatsch 189c35e89f PlaybackResolver: annotate the uses of ItagResolver 2024-01-07 14:27:22 +01:00
Profpatsch 2f529919ab getFilteredAudioStreams: reflow & more docs 2024-01-06 23:58:25 +01:00
Profpatsch 982d23674b getFilteredAudioStreams: make list nonNull 2024-01-06 23:57:42 +01:00
Profpatsch 24ac6d57f3 getFilteredAudioStreams: make trackId more obvious and document bug
Why would you serialize objects to avoid a null check, that’s just
weird.
2024-01-06 21:13:54 +01:00
Profpatsch 743e16a8a7 Quality/AudioTrack: ensure correct indices at construction
Instead of allowing to pass arbitrary out-of-bounds indexes to these
bean classes, ensure that the index is always valid for the list.

This is always true for our filter functions, except they all return
`-1` if the list was empty. We have to check/assert that beforehand.

This improves the logic somewhat, because fetching the stream always
returns something now.

Ideally, we wouldn’t be filtering stuff and then passing indices
around everywhere, but that’s the current state of things.

~~~

I took the liberty to remove the `.of`-wrappers, because they don’t
really add much compared to just calling the constructor here.
2024-01-06 19:09:44 +01:00
Profpatsch e0cbddfe54 getAudioIndexByHighestRank: simplify & make list NonNull 2024-01-06 18:33:48 +01:00
Profpatsch 64c68cf2f1 VideoPlaybackResolver: implicit -1 videoIndex
All functions that set videoIndex return `-1` if the list is empty, so
we don’t have to check manually for that case.

I’m somewhat more questioning why `StreamInfoTag.of` allows the index
to be out-of-bounds in the constructor, that should be an error.
2024-01-06 17:37:17 +01:00
Profpatsch 71d88d0bc0 ListHelper: rename functions & variables and add documentation
This should make the purpose of these functions more clear.
2024-01-06 16:49:49 +01:00
Profpatsch e5ac6824e8 Remove null check on getDefaultSharedPreferences
The function never returns `null`.
2024-01-06 16:49:49 +01:00
Profpatsch be4e0cb3dc Remove now unnecessary switch 2024-01-06 16:49:49 +01:00
Profpatsch 0148d65cab Inline getDefaultResolutionWithDefaultFormat 2024-01-06 16:49:49 +01:00
Profpatsch 76eb751438 Simplify selection of video stream
I was trying to understand the logic here, and noticed the indirection
via a QualityResolver interfaces is pretty unnecessary. Just branching
directly makes the logic a lot easier to follow.

The `-999` sentinel value is a bit dumb, but java does not recognize
that videoIndex is always initialized.

Nice side-effect, the `Resolver` interface was completely unused and
can be dropped.
2024-01-05 19:36:09 +01:00
Stypox 1d8850d1b2
Merge pull request #10712 from Stypox/notification-actions-api-33-2
[Android 13+] Restore support of custom notification actions
2023-12-30 21:55:44 +01:00
Stypox f98548698a
Android 33 -> Android 13
Co-authored-by: Tobi <TobiGr@users.noreply.github.com>
2023-12-30 21:55:32 +01:00
Stypox 4b1824e8c1
Allow play/pausing from notification when buffering
This change is in line with a recent change in how the play/pause button behaves in the player ui: if the buffering indicator is shown, it's still possible to toggle play/pause, to allow e.g. pausing videos before they even start.
This change was needed because on Android 13+ notification actions can't be null, and thus the buffering hourglass action wasn't shown.
2023-12-29 16:18:26 +01:00
Stypox 17e88f1749
Do not update notification actions if nothing changed
This should avoid costly updates of the media session.
2023-12-29 16:16:45 +01:00
Stypox 5edafca05a
Implement notification actions via MediaSessionConnector on Android 13+ 2023-12-29 15:54:15 +01:00
Stypox 2c4c283099
Extract NotificationActionData from NotificationUtil 2023-12-29 15:54:15 +01:00
Stypox 9fb8125655
Allow each notification slot to contain any possible action 2023-12-29 15:54:15 +01:00
Stypox aab6580195
Extract NotificationSlot from NotificationActionsPreference 2023-12-29 12:31:59 +01:00
Stypox 30f0db1d28
Customize only 2 notification actions on Android 13+ 2023-12-29 12:13:08 +01:00
Stypox 5a4dae2070
Fix settings_notification.xml indentation 2023-12-29 11:37:17 +01:00
Stypox 8345f348f6
Merge pull request #10091 from TeamNewPipe/feat/playlist_description
Add playlist description to playlist fragment
2023-12-29 10:58:13 +01:00
Stypox 9220e32463
Fix FeedDAOTest 2023-12-29 10:54:31 +01:00
Stypox 845e72bf4a
Merge branch 'master' into dev 2023-12-29 10:48:37 +01:00
TobiGr 0fa2e76c3e Fix NPE when ChannelTabLHFactory not implemented for a service
Fixes #10698
2023-12-26 16:55:52 +01:00
Stypox 9ff1b5230f
Improve TextEllipsizer class 2023-12-23 18:04:05 +01:00
TobiGr 65eb631711
Ellipsize playlist description if it is longer than 5 lines
The description can be expanded / collapsed via a "show more" / "show less" button.
2023-12-23 12:33:52 +01:00
TobiGr 6c99557553
Add playlist description to PlaylistFragment 2023-12-23 12:13:34 +01:00
TacoTheDank b31d3831e6
Change Converters to class to fix build 2023-12-23 11:47:57 +01:00
TacoTheDank 4a7fda95ae
Update miscellaneous libraries 2023-12-23 11:47:57 +01:00
Stypox ee3455e1e5
Merge pull request #10086 from TacoTheDank/bumpAndroidX
Update some AndroidX libraries and compileSdk to 34
2023-12-23 11:46:28 +01:00
Isira Seneviratne f9fc1cd817
Store/retrieve parcelable arrays as lists instead. 2023-12-23 11:38:40 +01:00
TacoTheDank 76f1e588f7
Utilize BundleCompat and IntentCompat methods 2023-12-23 11:38:40 +01:00
Isira Seneviratne f3b458c803
Bump compileSdk to 34 2023-12-23 11:38:32 +01:00
TacoTheDank 00566ed4d4
Fix AndroidX Work deprecation 2023-12-23 11:36:33 +01:00
Stypox aa84d6fc8f
Add @NonNull annotations 2023-12-22 18:52:42 +01:00
Stypox d76e9b0bd8
Fix scrolling to correct comment after closing replies 2023-12-22 18:52:42 +01:00
TobiGr b4016c91c1
scroll last comment into view 2023-12-22 11:57:55 +01:00
TobiGr 5f32d001cc
Expand DetailFragment again when exiting the CommentRepliesFragment 2023-12-22 11:57:55 +01:00
Stypox 8c9287d0c8
Revert relying on source ListInfo, use commentsInfoItem.getUrl() instead
This reverts commit bb01da3691ff1d5c3dccd41b7ca1a5deb1b5676f. This commit was not needed
2023-12-22 11:57:55 +01:00
Stypox 3f37e27852
Add some documentation and javadocs
Also further simplify CommentRepliesInfo and RelatedItemsInfo
2023-12-22 11:57:55 +01:00
Stypox f41ab8b086
Add comment replies fragment header 2023-12-22 11:57:55 +01:00
Stypox ad68f784ae
Extract some utility methods from CommentInfoItemHolder 2023-12-22 11:48:07 +01:00
Stypox 4b6392df54
Set comment replies fragment title 2023-12-22 11:48:07 +01:00
Stypox 94ea329b50
Always show comment replies in list mode 2023-12-22 11:48:07 +01:00
Stypox 591ed2e01f
Fix some code smells 2023-12-22 11:48:07 +01:00
Stypox 78cf9aaa7d
Save and restore state in CommentRepliesFragment 2023-12-22 11:48:07 +01:00