Commit graph

130 commits

Author SHA1 Message Date
Yevhen Babiichuk (DustDFG)
c20e3a6bb8 Accomodate extractor changes (EnumSet for service media capabilities) 2026-02-21 16:55:31 +01:00
TobiGr
15ebe18852 Fix rebase 2025-12-20 21:23:58 +01:00
TobiGr
a05ff38ffa Only show enqueue option if play queue is not empty in RouterActivity
Make enqueue option avilable for playlists as well
2025-12-20 20:59:32 +01:00
Hatake Kakashri
54bdb66624 Add enqueue option to router dialog
- This allows users to enqueue a stream directly to the current player queue when sharing a link with the app, improving the user experience for queue management.
- The 'Enqueue' option is now available in the action selection dialog and can also be set as the preferred open action in the settings.
2025-12-20 20:59:25 +01:00
Stypox
ea27448612 Even more centralized error handling in ErrorInfo 2025-09-05 12:39:16 +02:00
Stypox
fc567dae55 Allow ErrorInfo messages with formatArgs
- ErrorInfo.getMessage() now returns an ErrorMessage instance that can be formatted into a string using a context (this allows the construction of an ErrorInfo to remain independent of a Context)
- now the service ID is used in ErrorInfo.getMessage() to customize some messages based on the currently selected service
- player HTTP invalid statuses are now included in the message
- building a custom error message for AccountTerminatedException was moved from ErrorPanelHelper to ErrorInfo
2025-08-30 14:36:27 +02:00
Stypox
c01d1b9434 Add more specific error messages and deduplicate their handling 2025-08-28 17:05:52 +02:00
Isira Seneviratne
15f79507c4 Enable per-app language preferences for Android < 13 2025-07-20 04:50:49 +05:30
litetex
2c2904d59c Replaced `Icepick with Bridge and Android-State`
* IcePick fails on Java 21 (default in Android Studio 2024.2)
* Bridge is the most modern alternative that is currently available. It is backed by ``Android-State`` and can be configured with various frameworks
* In the long term this should be replaced with something better
2024-10-23 21:28:07 +02:00
Stypox
aa4ec2f39e Channels are now an Info
The previous "main" tab is now just a normal tab returned in getTabs().
Various part of the code that used to handle channels as ListInfo now either take the first (playable, i.e. with streams) tab (e.g. the ChannelTabPlayQueue), or take all of them combined (e.g. the feed).
2023-09-18 23:22:32 +02:00
Rishab Aggarwal
04b7fe4939 Improved downloading experience (#10407)
* added LoadingDialog for improving download experience

* [LoadingDialog] Apply some review comments and make title customizable.

* removed permission handling from loading Dialog

* fix checks

* remove <p> Tag from first sentence

---------

Co-authored-by: rishabaggarwal <Rishabaggarwal@sharechat.com>
Co-authored-by: TobiGr <tobigr@users.noreply.github.com>
2023-09-18 05:24:03 +05:30
Stypox
2def965f65 Fix toast crash on API 33
You shouldn't call getView() on toasts.
Also simplified some duplicate code.
2023-01-12 11:39:25 +01:00
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
3dde6c70bc Use Optional for simpler code 2023-01-11 15:14:18 +01:00
devlearner
345ee656cf Improve showing of toast
We provide visual feedback via a toast to the user that, well, they're supposed to wait; but with the benefit of the cache openAddToPlaylistDialog() may return (almost) immediately, which would render the toast otiose (if not a bit confusing). This commit improves that by cancelling the toast once the wait's over

... (by 'abusing' RxJava's ambWith();
ref on compose() and Transformer: https://blog.danlew.net/2015/03/02/dont-break-the-chain/
and for me, first time laying my hands at RxJava so kindly bear with me; open for suggestions)
2023-01-11 14:53:48 +01:00
devlearner
a6381ce3b3 Utilize Lifecycle observer
I thought it would have required an extra dependency; apparently that doesn't seem to be the case...
2023-01-11 14:53:48 +01:00
devlearner
cedc02bd73 Oops, added back missing return; 2023-01-11 14:53:48 +01:00
devlearner
ebf314b7ab Fix Sonar reported code smell 2023-01-11 14:53:48 +01:00
devlearner
9a334187c6 Skip REORDER_TO_FRONT trick which doesn't seem to work on newer Androids
probably due to background restrictions on Android 10+
2023-01-11 14:53:48 +01:00
devlearner
06351cc12c Utilize a retained fragment to safekeep network requests in flight
pending result for openAddToPlaylistDialog() and openDownloadDialog()
Despite marked deprecated, setRetainInstance(true) is probably our best bet (since a ViewModel is probably too overkill for our present purpose)
2023-01-11 14:53:48 +01:00
devlearner
fcd556e555 Improve (un)registering FragmentLifecycleCallbacks
to avoid adding it multiple times and ensure proper cleanup
2023-01-11 14:53:48 +01:00
devlearner
c9ff6b1e56 Address LayoutParams.FLAG_NOT_TOUCHABLE restriction on Andriod 12+ 2023-01-11 14:53:48 +01:00
devlearner
e7a61358f7 Ensure our transparent activity doesn't block touch events to underlying windows
so we won't hold up UI while fetching media info for Add to Playlist or Download actions
lest user might think it freezes when in fact a network request is underway
2023-01-11 14:53:48 +01:00
devlearner
2612c1cdf3 Also show toast in openDownloadDialog()
and lengthened a bit to inform user to wait...
2023-01-11 14:53:48 +01:00
devlearner
0d430f99e6 Try to amicably handle DialogFragment in FragmentManager when recreated from orientation change
- Handle finish() call instead of passing around callbacks to setOnDismissListener()
- Don't start over again if returning to DialogFragment before orientation change
2023-01-11 14:53:48 +01:00
devlearner
c173e04aa4 Don't finish() to allow recreate
when orientation change is on foot
2023-01-11 14:53:48 +01:00
devlearner
94cc1f2982 Set up theme/locale before super.create()
This seems to solve a bug where the Open action menu dialog does not appear the first time on cold start on older Android (8.0).
This is also the order of things in MainActivity and probably good practice.
2023-01-11 14:53:48 +01:00
Stypox
24dad270d9 Merge pull request #8651 from Isira-Seneviratne/Use_limiting_methods
Use range-limiting methods.
2022-07-20 15:06:45 +02:00
Isira Seneviratne
000da24de2 Use MathUtils.clamp().
Co-authored-by: Stypox <stypox@pm.me>
2022-07-20 05:36:01 +05:30
Isira Seneviratne
6f77ff6c53 Use List.of(). 2022-07-20 04:39:11 +05:30
Stypox
d71da66cc5 Move PlayerType into its own class and add documentation
Also replace some `isPlayerOpen` with direct `playerType == null` checks.
2022-07-13 23:33:18 +02:00
Stypox
5ba14c4b7c Refactor player: separate UIs and more 2022-07-13 23:25:26 +02:00
Stypox
bb4a8ebcd8 Refactor creation of DownloadDialog 2022-06-18 17:40:22 +02:00
AudricV
f7d2975ad1 Add support of other delivery methods than progressive HTTP (in the player only)
Detailed changes:

- External players:

  - Add a message instruction about stream selection;
  - Add a message when there is no stream available for external players;
  - Return now HLS, DASH and SmoothStreaming URL contents, in addition to progressive HTTP ones.

- Player:

  - Support DASH, HLS and SmoothStreaming streams for videos, whether they are content URLs or the manifests themselves, in addition to progressive HTTP ones;
  - Use a custom HttpDataSource to play YouTube contents, based of ExoPlayer's default one, which allows better spoofing of official clients (custom user-agent and headers (depending of the client used), use of range and rn (set dynamically by the DataSource) parameters);
  - Fetch YouTube progressive contents as DASH streams, like official clients, support fully playback of livestreams which have ended recently and OTF streams;
  - Use ExoPlayer's default retries count for contents on non-fatal errors (instead of Integer.MAX_VALUE for non-live contents and 5 for live contents).

- Download dialog:

  - Add message about support of progressive HTTP streams only for downloading;
  - Remove several duplicated code and update relevant usages;
  - Support downloading of contents with an unknown media format.

- ListHelper:

  - Catch NumberFormatException when trying to compare two video streams between them.

- Tests:

  - Update ListHelperTest and StreamItemAdapterTest to fix breaking changes in the extractor.

- Other places:

  - Fixes deprecation of changes made in the extractor;
  - Improve some code related to the files changed.

- Issues fixed and/or improved with the changes:

  - Seeking of PeerTube HLS streams (the duration shown was the one from the stream duration and not the one parsed, incomplete because HLS streams are fragmented MP4s with multiple sidx boxes, for which seeking is not supported by ExoPlayer) (the app now uses the HLS manifest returned for each quality, in the master playlist (not fetched and computed by the extractor));
  - Crash when loading PeerTube streams with a separated audio;
  - Lack of some streams on some YouTube videos (OTF streams);
  - Loading times of YouTube streams, after a quality change or a playback start;
  - View count of YouTube ended livestreams interpreted as watching count (this type of streams is not interpreted anymore as livestreams);
  - Watchable time of YouTube ended livestreams;
  - Playback of SoundCloud HLS-only tracks (which cannot be downloaded anymore because the workaround which was used is being removed by SoundCloud, so it has been removed from the extractor).
2022-06-17 22:00:22 +02:00
litetex
481152acdd Bonus fix: Made `single_choice_dialog_view` scrollable + use viewbinding 2022-05-28 00:46:28 +02:00
litetex
5c1d5341ff Code cleanup 2022-05-28 00:46:27 +02:00
litetex
d624bce55e Improved docs, format and code style 2022-05-28 00:46:27 +02:00
litetex
201acb9347 Reworked incorrect choice handling and centralized it 2022-05-28 00:39:13 +02:00
litetex
6d53fe1339 Fix add to playlist 2022-05-28 00:39:13 +02:00
Isira Seneviratne
37fdd548c9 Remove unnecessary compat method calls. 2022-05-10 07:45:01 +05:30
litetex
bb55c420fe Use non-static method 2022-05-04 19:09:41 +02:00
litetex
269d9e933a Make sure Routeractivity does the same as MainActivity 2022-05-01 21:59:00 +02:00
TiA4f8R
7786a18517 Prefer video-only streams to video streams
Prefering video-only streams to video streams for our player will allow us to make seamless transitions on 360 and 720p qualities on YouTube.
External players and the downloader are not affected by this change.
2022-02-20 19:38:40 +01:00
Stypox
5583f71a8e Replace ErrorActivity with ErrorUtil 2021-12-04 10:36:36 +01:00
litetex
3c4e392ce1 Add to playlist - Showing toast that this may take a moment 2021-10-09 18:47:36 +02:00
litetex
2361d32f75 Cleaned up PlaylistDialog-related code 2021-10-09 18:46:20 +02:00
Kalle Struik
dc999b4f71 Add a add to playlist option in the share menu. 2021-10-02 19:21:25 +02:00
Stypox
1663da64a2 Call DownloadDialog dismiss() in the correct way 2021-07-19 10:59:45 +02:00
evermind
61a54d9a64 convert PlayerHolder to Singleton, handle context within, bugfix ServiceConnection leak
- bugfix: have ServiceConnection created only once!

- select the context within the PlayerHolder to start, stop, bind or unbind the service
  -> we have to make sure the Service is started AND stopped within the same context
  -> so let PlayerHolder be the one to select the context

- remove removeListener() and replace the call with setListener(null)
- Compatibility: use ContextCompat.startForegroundService instead of startService()
2021-07-06 12:31:26 +02:00
Stypox
4a963858ba Merge pull request #6394 from TacoTheDank/androidx-fragment-134
Update AndroidX Fragment to 1.3.4
2021-06-18 13:14:30 +02:00