Commit graph

9999 commits

Author SHA1 Message Date
Stypox
cd385041da Merge pull request #8153 from AudricV/delivery-methods-v2
Support delivery methods other than progressive HTTP
2022-06-22 11:21:52 +02:00
AudricV
6f9a06c205 Ensure that progressive contents are URL contents for playback
A ResolverException will be now thrown otherwise.
2022-06-19 15:41:29 +02:00
Stypox
3f93974020 Improve download_dialog.xml unsupported streams notice 2022-06-18 19:16:36 +02:00
Stypox
321714eddc Remove misleading first "Non" from getNonUrlAndNonTorrentStreams 2022-06-18 18:52:32 +02:00
Stypox
17c70c58a9 Refactor PlaybackResolver and fix cacheKeyOf
In commonCacheKeyOf the result of an Objects.hash() was ignored
2022-06-18 18:41:44 +02:00
Stypox
3836f29866 Wrap debug log in if(DEBUG) 2022-06-18 18:09:12 +02:00
Stypox
9509b0848c Improve code in VideoDetailFragment 2022-06-18 17:49:04 +02:00
Stypox
bb4a8ebcd8 Refactor creation of DownloadDialog 2022-06-18 17:40:22 +02:00
AudricV
a3369ba3a4 Fix playback of non-URI HLS streams
A custom HlsPlaylistParserFactory cannot be used anymore to play HLS streams.

This needs to be replaced by a custom HlsDataSourceFactory, which returns a ByteArrayDataSource (where the bytes of this DataSource correspond to the bytes of the playlist string) and a specified DataSource for other request types.

This model has two limitations:

- if media requests are relative, the URI from which the manifest comes from (either the manifest URI (preferred) or the master URI (if applicable)) must be returned, otherwise the content will be not playable, as it will be an invalid URL, or it may be treat as something unexpected, for instance as a file for DefaultDataSources;
- if the playlist is a master playlist, endless loops should be encountered because the DataSources created for media playlists will use the master playlist response instead of fetching the corresponding playlist. With the current model of HlsDataSourceFactory, there is no possibility to distinguish the playlist type or the URI that is requested.

If ExoPlayer provides a way to create HlsMediaSources with an HlsPlaylist in the future, it should be used instead of this solution.
2022-06-17 22:01:30 +02:00
AudricV
d4614e176b Throw a dedicated exception when errors occur in PlaybackResolver
A new exception, ResolverException, a subclass of PlaybackResolver, is now thrown when errors occur in PlaybackResolver, instead of an IOException
2022-06-17 22:01:29 +02:00
AudricV
ce58a2df30 Filter streams using Java 8 Stream's API instead of removing streams with list iterators and add a better toast when there is no audio stream for external players
This ensures to not remove streams from the StreamInfo lists themselves, and so to not have to create list copies.

The toast shown in RouterActivity, when there is no audio stream available for external players, is now shown, in the same case, when pressing the background button in VideoDetailFragment.
2022-06-17 22:01:29 +02:00
AudricV
c0b4c41aff Use StreamTypeUtil where possible and add isAudio and isVideo to this utility class 2022-06-17 22:01:26 +02:00
Stypox
5f2c519700 Code improvements here and there 2022-06-17 22:00:53 +02:00
Stypox
beeb8ae24b Add comments to PlaybackResolver and remove useless @NonNull 2022-06-17 22:00:52 +02:00
Stypox
72aa2515b7 Use DownloaderImpl.USER_AGENT directly
instead of passing it as a parameter
2022-06-17 22:00:52 +02:00
Stypox
68a94843a4 Add comments and use downloader user agent in YT data source
YoutubeHttpDataSource
2022-06-17 22:00:52 +02:00
Stypox
633ab9a81f Improve CacheFactory and PlayerDataSource code 2022-06-17 22:00:51 +02:00
Stypox
1ce460537f Move stream's cache key generation in PlaybackResolver and improve PlaybackResolver's code 2022-06-17 22:00:51 +02:00
AudricV
74ea59288d Move SimpleCache creation in PlayerDataSource to avoid an IllegalStateException
This IllegalStateException, almost not reproducible, indicates that another SimpleCache instance uses the cache folder, which was so trying to be created at least twice.
Moving the SimpleCache creation in PlayerDataSource should avoid this exception.
2022-06-17 22:00:51 +02:00
AudricV
c3e9768b94 Improve dialog of streams for external players and fix use of the wrong codec in the list of available streams in it after a codec change in Video and Audio settings
The VideoDetailFragment will now get video streams dynamically instead of storing them as a field, so the good codec can be chosen by ListHelper.
To select a stream to play, user has now to select the quality in the list of available qualities and then press the new OK button in the alert dialog.
2022-06-17 22:00:50 +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
Stypox
4fb953c068 Merge pull request #8340 from litetex/fix-add-to-playlist
Fix "Add to playlist" not working and cleanup "RouterActivity" choice handling
2022-06-05 11:47:51 +02:00
litetex
08c75f5c5e Made statusbar color transparent for RouterActivity (Android 5+)
Fix for https://github.com/TeamNewPipe/NewPipe/pull/8332
2022-06-04 15:22:36 +02:00
Stypox
cb6f1340b6 Merge pull request #8404 from Isira-Seneviratne/Use_AppCompatResources
Use AppCompatResources.
2022-05-30 15:42:04 +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
Stypox
044aae5c02 Merge pull request #8382 from Isira-Seneviratne/Remove_compat_methods
Remove unnecessary compat method calls.
2022-05-22 21:59:04 +02:00
Stypox
4a6654fbb8 Merge pull request #8391 from Isira-Seneviratne/Use_JvmOverloads
Use JvmOverloads.
2022-05-22 21:56:17 +02:00
Stypox
6217af6acb Merge pull request #8143 from TiA4f8R/image-preview-sharesheet
Add image preview of the content shared where possible in Android share sheet (for Android 10+ devices only)
2022-05-22 21:45:53 +02:00
Stypox
9ee456b908 Improvements to sharing content with thumbnail 2022-05-22 21:34:10 +02:00
Jorge Maldonado Ventura
c9d7a2da5b Spanish Readme fix (#8413) 2022-05-19 16:39:08 +03:00
litetex
2266b00ca8 Merge pull request #8406 from TacoTheDank/bumpPlugins
Update AGP and Kotlin
2022-05-18 19:56:32 +02:00
litetex
b1bc030a69 Merge pull request #8407 from TacoTheDank/bumpACRAGroupie
Update Groupie and ACRA libraries
2022-05-18 19:56:09 +02:00
TacoTheDank
4ee77d9249 Update Groupie and ACRA libraries 2022-05-16 11:45:56 -04:00
TacoTheDank
3b5ed53326 Fix AndroidX library order 2022-05-16 10:54:44 -04:00
TacoTheDank
065cc9754f Update AGP and Kotlin 2022-05-16 10:53:43 -04:00
Isira Seneviratne
761f066ff6 Merge branch 'dev' into Use_JvmOverloads 2022-05-16 12:43:24 +05:30
Isira Seneviratne
11bc5177b8 Merge branch 'dev' into Remove_compat_methods 2022-05-16 12:36:46 +05:30
Isira Seneviratne
c06115fc85 Merge branch 'dev' into Use_AppCompatResources
# Conflicts:
#	app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java
2022-05-16 12:36:00 +05:30
Isira Seneviratne
d02b988138 Use AppCompatResources. 2022-05-16 12:27:44 +05:30
TiA4f8R
f1307b32a3 [Android 10+] Add image preview of the content shared where possible
These previews will be only available for images cached in the cache used by Picasso.
The Bitmap of the content is compressed in JPEG 90 and saved inside the application cache folder under the name android_share_sheet_image_preview.jpg.
The current image will be, of course, always overwritten by the next one and cleared when the application cache is cleared.
2022-05-14 16:53:24 +02:00
Isira Seneviratne
50922d2f29 Use JvmOverloads. 2022-05-13 07:46:02 +05:30
Stypox
28a6d30488 Merge pull request #7458 from litetex/rework-subscription-import-export-ui
Moved subscription import/export options to (overflow) menu
2022-05-12 13:03:12 +02:00
Stypox
2dc8d766b3 Merge pull request #7355 from petlyh/append-remote-playlist
Add a "Add to playlist" item to the remote playlist menu
2022-05-12 12:03:58 +02:00
petlyh
ac5cf455d2 Add a "Add to playlist" item to the remote playlist menu 2022-05-10 08:48:21 +02:00
Isira Seneviratne
37fdd548c9 Remove unnecessary compat method calls. 2022-05-10 07:45:01 +05:30
Robin
0cfb329783 Merge pull request #8377 from iTrooz/vol_slider
Make volume progress bar match system volume when we start sliding
2022-05-10 00:33:29 +02:00