Commit graph

933 commits

Author SHA1 Message Date
Stypox
9b701b373f Improve //region comments in player UIs 2022-07-13 23:30:30 +02:00
Stypox
9f2d912691 Add comment about broadcast receiver 2022-07-13 23:27:24 +02:00
Stypox
d689c9013b Remove unused PlayerServiceBinder 2022-07-13 23:27:24 +02:00
Stypox
e707113920 Remove unused PlayerState 2022-07-13 23:27:24 +02:00
Stypox
0352d546fd Move player-notification files into their package 2022-07-13 23:27:24 +02:00
Stypox
7f99dbbfe8 Move all notification-related calls to NotificationPlayerUi 2022-07-13 23:27:24 +02:00
Stypox
eba3996878 Fix some crashes / issues after player refactor 2022-07-13 23:27:23 +02:00
Stypox
5ba14c4b7c Refactor player: separate UIs and more 2022-07-13 23:25:26 +02:00
litetex
4a4ca3c18e Clean up pre-Lollipop checks 2022-07-13 19:02:24 +02:00
Alex
a68e34b430 Crop the notification thumbnail in 1:1 mode instead of stretching it (#8533)
Change square bitmap transformation strategy: change the bitmap transformation strategy when a 1:1 aspect ratio is
enabled to not stretch the bitmap but rather crop it.

On Android 11/12, the way the whole thumbnail was used for the
notification icon was not ideal, however the setting to toggle a 1:1
(as it states in settings) resulted in distortions.

Fix this by simply cropping the bitmap.

Also update the 1:1 mode strings to remove mentions of scaling or
distortions, as those no longer apply.
2022-07-13 17:19:44 +02:00
Robin
e1029800f3 Merge pull request #8536 from TacoTheDank/bumpExoPlayer
Update ExoPlayer to 2.18.0
2022-07-13 12:59:12 +02:00
litetex
eff828aeea Fix compile errors 2022-07-04 23:19:41 +02:00
TacoTheDank
bc6d68980f Set setUsePlatformDiagnostics to false 2022-07-02 15:01:39 -04:00
Stypox
0581ad0075 Actually fix wrong view count 2022-07-01 16:07:19 +02:00
TacoTheDank
ee609330d7 Update ExoPlayer to 2.18.0 2022-06-25 21:14:42 -04: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
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
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
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
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
Isira Seneviratne
11bc5177b8 Merge branch 'dev' into Remove_compat_methods 2022-05-16 12:36:46 +05:30
Isira Seneviratne
37fdd548c9 Remove unnecessary compat method calls. 2022-05-10 07:45:01 +05:30
iTrooz_
d80d522838 Make volume progress bar match system volume when we start sliding 2022-05-09 21:40:13 +02:00
Robin
3d65d3e2ab 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
2dd5800d73 Fixed accidental reset of `PlaybackParameterDialog` on initialization 2022-05-03 21:42:09 +02:00
Stypox
35187cf2de Fix wrong NonNull 2022-04-30 21:46:06 +02:00
Stypox
24567937cc Merge pull request #7989 from litetex/refactor-playback-parameter-dialog
Rewrote ``PlaybackParameterDialog``
2022-04-30 17:53:26 +02:00
kt programs
154d15b167 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
925c4a8cbf Merge branch 'master' into dev 2022-04-29 16:41:18 +02:00
Stypox
64d71beeb4 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
0fe72eb50b 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
e01971422e 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
karyogamy
a02d22c1b2 fixed: added comments for DefaultTrackSelector auto-select fix. 2022-04-17 18:34:31 -04:00
karyogamy
c147ca01f6 fixed: disabled caption to no longer automatically re-enable on new player instance. 2022-04-17 13:26:39 -04:00
ZiyanZHANG
2ddc220a04 Update PlayQueueActivity.java 2022-04-17 18:15:13 +08:00
litetex
172fc11bf4 Fix merge conflicts 2022-04-16 21:24:01 +02:00
litetex
284b44414b Merged `DrawableResolver into ThemeHelper` 2022-04-16 21:21:57 +02:00
litetex
a2eec54019 Refactored code 2022-04-16 21:21:56 +02:00
litetex
6f662aba7a Added some doc and abstracted more methods 2022-04-16 21:21:52 +02:00
litetex
7723a51c9c Reworked switching to semitones
Using an expandable Tab-like component instead of a combobox
2022-04-16 21:21:51 +02:00