Commit Graph

212 Commits

Author SHA1 Message Date
Stypox c054ea0737 Create MediaSessionPlayerUi 2022-08-25 17:00:41 +02:00
TacoTheDank d7a654fc27 Update AndroidX Fragment to 1.4.1 2022-07-24 15:35:33 -04:00
Stypox cacce6d2d0
Merge pull request #8651 from Isira-Seneviratne/Use_limiting_methods
Use range-limiting methods.
2022-07-20 15:06:45 +02:00
Isira Seneviratne d62cdc659f Use MathUtils.clamp().
Co-authored-by: Stypox <stypox@pm.me>
2022-07-20 05:36:01 +05:30
Isira Seneviratne a6cc13845a Use Map.of(). 2022-07-20 04:39:11 +05:30
litetex 8b209df253 Changed the code accordingly
+ Removed some unused code
2022-07-15 19:55:19 +02:00
Stypox 8187a3bc04
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 3692858a3d
Move popup layout param to PopupPlayerUi 2022-07-13 23:33:18 +02:00
Stypox 76ced59b62
Refactor player: separate UIs and more 2022-07-13 23:25:26 +02:00
Stypox 1e076ea63d
Wrap debug log in if(DEBUG) 2022-06-18 18:09:12 +02:00
AudricV e3c2aea3cc
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
Stypox 8445c381c5
Use DownloaderImpl.USER_AGENT directly
instead of passing it as a parameter
2022-06-17 22:00:52 +02:00
Stypox fa46b7bf85
Add comments and use downloader user agent in YT data source
YoutubeHttpDataSource
2022-06-17 22:00:52 +02:00
Stypox 7ce2250d85
Improve CacheFactory and PlayerDataSource code 2022-06-17 22:00:51 +02:00
Stypox ef20d9b91a
Move stream's cache key generation in PlaybackResolver and improve PlaybackResolver's code 2022-06-17 22:00:51 +02:00
AudricV fbee310261
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 210834fbe9
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
Robin b84c6b4b32
Merge pull request #8315 from ktprograms/fix-media-button-hide-controls
Fix hiding player controls when playing from media button
2022-05-04 11:28:05 +02:00
litetex c2bf7f09ce Fixed accidental reset of ``PlaybackParameterDialog`` on initialization 2022-05-03 21:42:09 +02:00
Stypox 173b6c3f00
Fix wrong NonNull 2022-04-30 21:46:06 +02:00
Stypox 7646c683b5
Merge pull request #7989 from litetex/refactor-playback-parameter-dialog
Rewrote ``PlaybackParameterDialog``
2022-04-30 17:53:26 +02:00
kt programs 047fe21c14 Fix hiding player controls when playing from media button
DefaultControlDispatcher was removed in ExoPlayer 2.16.0, so the class
extending it that handled play/pause was removed in #8020.

The new solution is to use an instance of ForwardingPlayer. Call
sessionConnector.setPlayer with an instance of ForwardingPlayer that
overrides play() and pause() and calls the callback methods.
2022-04-30 17:43:30 +08:00
Stypox b8dbb3f073
Use 64 KiB as the default progressive load interval
This ensures a small value is used by default, solving buffering issues at the beginning of videos
2022-04-29 16:10:39 +02:00
opusforlife2 9b3e43ffc1
Merge pull request #8279 from TiA4f8R/set-maximum-allowed-opacity-for-close-overlay-android-12-and-higher
Adapt opacity of popup close button to allow touches in other apps on Android >=12
2022-04-23 17:39:15 +00:00
TiA4f8R d5a0f8f23c
Set opacity of the popup close button to 0.8 on Android 12 and higher
Setting this opacity should allow touches outside NewPipe when using the popup player.

See https://developer.android.com/reference/android/view/WindowManager.LayoutParams#FLAG_NOT_TOUCHABLE for more details.
2022-04-22 15:09:20 +02:00
litetex a311519314 Fix merge conflicts 2022-04-16 21:24:01 +02:00
litetex 1dc146322c Merged ``DrawableResolver`` into ``ThemeHelper`` 2022-04-16 21:21:57 +02:00
litetex 0f551baf37 Refactored code 2022-04-16 21:21:56 +02:00
litetex 20602889be Added some doc and abstracted more methods 2022-04-16 21:21:52 +02:00
litetex 4b06536582 Reworked switching to semitones
Using an expandable Tab-like component instead of a combobox
2022-04-16 21:21:51 +02:00
litetex 621b38c98b Code improvements regarding stepSize 2022-04-16 21:21:50 +02:00
litetex 762cdc812c Reworked/Implemented PlaybackParameterDialog functionallity
* Add support for semitones
* Fixed some minor bugs
* Improved some methods
2022-04-16 21:21:48 +02:00
litetex 4cdf6eda2c Use viewbinding 2022-04-16 21:21:45 +02:00
litetex 652d50173e Major refactoring of PlaybackParameterDialog
* Removed/Renamed methods
* Use ``IcePick``
* Better structuring
* Keep skipSilence when rotating the device (PlayQueueActivity only)
2022-04-16 21:21:45 +02:00
karyogamy 55fc3fc177 added: caption language stem utility to support language variant conversion between videos. 2022-04-08 18:21:30 -04:00
karyogamy 4e459b3383 updated: ExoPlayer to 2.17.1.
added: MediaItemTag for ManagedMediaSources.
added: silent track for FailedMediaSource.
added: keyframe fast forward at initial playback buffer.
added: error notification on silently skipped streams.
2022-03-19 15:56:45 -04:00
litetex 6d2b5d976d
Merge pull request #8068 from TacoTheDank/lintCleaning
Some lint cleaning
2022-03-19 14:37:34 +01:00
TacoTheDank cf213affa2 Annotate some NonNulls, some lint cleaning 2022-03-18 13:15:44 -04:00
TacoTheDank 86f335b01f Create stub implementation for OnSeekBarChangeListener 2022-03-17 21:49:04 -04:00
karyogamy ab45efceab - added: variable load check interval for progressive stream.
- added: preferences to allow user setting of above.
2022-03-01 20:14:53 +01:00
kt programs 62c0e6605c Remember adjustment step size for playback controls (speed and pitch)
- Add adjustment_step_key to settings_keys.xml to be used when
saving/loading the step size.
- Remove the global stepSize variable and the code that saves it to
outState/loads it from savedInstanceState because it's now saved to
Shared Preferences.
- Move initially setting step size to setupStepSizeSelector to be
consistent with the other view setup methods, using the value loaded
from Shared Preferences.
- Save the step size to Shared Preferences inside setStepSize.

Fixes: #7031
2022-03-01 16:27:20 +08:00
Martin 616fb47983
Merge branch 'TeamNewPipe:dev' into dev 2022-02-17 10:20:44 +01:00
litetex be95d7fe0f
Merge pull request #7704 from Stypox/fix-stream-menu-crash
Fix crash when long-pressing stream while player is starting
2022-02-09 19:53:09 +01:00
martin 906ee75278 Fixed checkstyle violation 2022-02-05 12:31:07 +01:00
martin 4049abf2c0 Addressed comment in PR 2022-02-04 16:15:55 +01:00
martin 47798febed fetch and merge 2022-02-04 15:34:00 +01:00
TiA4f8R 52cc4a0a05
Add JavaDoc for PlayerDataSource.PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENT 2022-01-30 20:42:02 +01:00
TiA4f8R e103e4817c
Apply suggested changes and remove the CustomHlsPlaylistTracker class 2022-01-30 20:42:02 +01:00
TiA4f8R 94f774b82d
Use a custom HlsPlaylistTracker, based on DefaultHlsPlaylistTracker to allow more stucking on HLS livestreams
ExoPlayer's default behavior is to use a multiplication of target segment by a coefficient (3,5).
This coefficient (and this behavior) cannot be customized without using a custom HlsPlaylistTracker right now.

New behavior is to wait 15 seconds before throwing a PlaylistStuckException.
This should improve a lot HLS live streaming on (very) low-latency livestreams with buffering issues, especially on YouTube with their HLS manifests.
2022-01-30 20:42:01 +01:00
Stypox 71c5aaa11e
Do not show enqueue button if play queue not ready 2022-01-27 17:11:16 +01:00