Commit Graph

200 Commits

Author SHA1 Message Date
Stypox 0a8f28b1c6
Add image quality preference 2023-09-22 10:14:43 +02:00
Stypox af2375948d
Support obtaining multiple images from the extractor 2023-09-22 09:57:33 +02:00
J-Stutzmann c06d61a83c Made audio-focus calls respect mute state. 2023-08-02 23:44:23 -04:00
AudricV 5ab3a4a9e0
Refactor Player.useVideoSource logic and improve its comments
- don't check for isAudioOnly == !videoEnabled, as this prevents enabling again
video and text tracks renderers in some cases;
- when reloading play queue manager if that's needed, disable or enable video
and text tracks renderers, as they may need to be enabled again in some cases
like starting a video in main player, opening play queue, switching to
background player on it and switching back to main player;
- disable or enable video renderers also for streams with AUDIO_STREAM
StreamType, as doing so doesn't raise any issue and simplifies code;
- reword and move some comments to make them easier to understand.
2023-07-19 22:52:18 +02:00
ThetaDev b567d428ad fix: small codestyle fixes 2023-04-21 23:15:37 +02:00
ThetaDev 2edc223e77 Merge branch 'dev' into alang-selector 2023-04-17 23:01:07 +02:00
AudricV 787758a436
[Android 6+] Add ability to always use ExoPlayer's MediaVideoCodecRenderer setOutputSurface workaround
As some devices not present in ExoPlayer's list may not implement
MediaCodec.setOutputSurface(Surface) properly, this workaround could be useful
on these devices.

It forces ExoPlayer to fall back on releasing and re-instantiating video codec
instances, which is always used on Android 5 and lower due to addition of this
method in Android 6.

To do so, a CustomMediaCodecVideoRenderer, based on ExoPlayer's
MediaVideoCodecRenderer which always return true for the
codecNeedsSetOutputSurfaceWorkaround method has been added, which is used in
CustomRenderersFactory, a class based on DefaultRenderersFactory which always
returns our CustomMediaCodecVideoRenderer as the video renderers.

CustomRenderersFactory replaces DefaultRenderersFactory in the player, in the
case this setting is enabled.
2023-04-10 17:39:27 +02:00
AudricV a6ff85a208
Move media tunneling setting to ExoPlayer settings and make this setting available on release builds
Media tunneling may be not supported by more devices than the ones we
whitelisted before.

As a matter of fact, the list of devices on which media tunneling is disabled
could be not maintainable in the future, especially if the list of devices
grows more and more.

A preferable solution is to allow users to configure this setting themselves,
allowing them to not wait for their device(s) to be whitelisted in a future
NewPipe update.

This solution has been applied in this commit and works on every build type.

The corresponding preference in the debug settings has been of course removed
and the code used to prevent media tunneling activation on specific devices has
been removed.
2023-04-10 17:37:30 +02:00
AudricV 41da8fc05f
Add ability to use ExoPlayer's decoder fallback option
This option could help to avoid decoder initialization issues, which falls back
to lower-priority decoders if decoder initialization fails. This may result in
poor playback performance than when using primary decoders.

It is disabled by default, but can be enabled in ExoPlayer settings.
2023-04-10 17:37:30 +02:00
ThetaDev 366c39d4c6 feat: add language selector to audio player 2023-03-19 01:15:36 +01:00
ThetaDev de7872d8f2 feat: add audio language selector 2023-03-17 21:51:40 +01:00
Stypox 097c2368f4
Merge pull request #8180 from Trust04zh/fix-4053-8176
Make UI behavior for playback information display more consistent
2023-02-26 13:22:13 +01:00
Trust_04zh e947e86eae
Make positions in list depend on watch history, remove confusing animations
The following is the list of all commits squashed together:

Regain function for option `Positions in lists`

use option `Resume playback` to control display of progress info in VideoDetailFragment, remove this (extra) function from option `Positions in lists`.
remove extra check for live streams, live streams updates just as non-live streams.

fix #8176 by eliminating exit delay

Regain function for option `Positions in lists`

update code with developer's comments

 apply static import to methods in util class DependentPreferenceHelper

Regain function for option `Positions in lists`

use option `Resume playback` to control display of progress info in VideoDetailFragment, remove this (extra) function from option `Positions in lists`.
remove extra check for live streams, live streams updates just as non-live streams.

fix behavior for displaying progress bar when autoplay off but video resume on

not to retrieve unnecessary states when position in lists disabled

fix mistake in code

simplify conditional logic

update doc comment and remove unused method

Fix not showing duration if position indicators disabled

Positions in lists only depends on watch history
2023-02-07 09:48:18 +01:00
Stypox 1e724eba6c
Merge pull request #9706 from Jared234/9131_bug_background_player
Fixed a bug that caused the background player to stop working
2023-01-28 21:56:00 +01:00
Jared Fantaye 5b3f8a3d30 Replaced the equals method 2023-01-21 14:56:55 +01:00
Stypox 9c7ed80662
Use Optional.map correctly and other improvements 2023-01-11 14:47:53 +01:00
Isira Seneviratne e8216b2e80 Apply code review suggestions. 2023-01-04 06:10:14 +05:30
Isira Seneviratne e3062d7c66 Use Optional chaining. 2023-01-04 05:16:21 +05:30
Isira Seneviratne fd55d85bbf Remove SimplifyOptionalCallChains. 2023-01-04 05:16:21 +05:30
Jared Fantaye 12796920a3 Removed the wasPlaying variable 2022-12-10 21:56:04 +01:00
Stypox 4a7af6f9ac
Remove thumbnail before sync, if outdated
Also refactor onPlaybackSynchronize and add comments
2022-08-28 18:32:27 +02:00
Stypox 7fbef35daa
Unify onThumbnailLoaded calls to ensure UIs always updated 2022-08-28 17:24:51 +02:00
litetex 59d1ded94e Fixed sonar detected problems
+ Automatically fixed code style (imports)
2022-08-25 17:02:53 +02:00
Stypox 510efaae97 Keep strong reference to Picasso thumbnail loading target
Before the Target would sometimes be garbage collected before being called with the loaded thumbnail, since Picasso holds weak references to targets
2022-08-25 17:02:52 +02:00
Stypox 8bff445ec3 Remove useless checks before updating metadata
A while ago NewPipe called the metadata update function very often, so checks were needed to ensure not wasting time updating metadata if it were already up to date. Now, instead, the metadata update function is called exactly when needed, i.e. when metadata changes, so such checks are not needed anymore (and were probably also a little resource-heavy).
2022-08-25 17:02:51 +02:00
Stypox f3a9b81b67 Fix sometimes seeing outdated thumbnail in notification
Before the thumbnail finishes loading for the new video the player is now playing, the old thumbnail was being used, leading to wrong thumbnails set in the media session and the notification.
2022-08-25 17:02:51 +02:00
Stypox c054ea0737 Create MediaSessionPlayerUi 2022-08-25 17:00:41 +02:00
Isira Seneviratne d62cdc659f Use MathUtils.clamp().
Co-authored-by: Stypox <stypox@pm.me>
2022-07-20 05:36:01 +05:30
litetex b7a44560f5
Merge pull request #8170 from Stypox/player-refactor
Refactor player and extract UI components
2022-07-15 19:41:23 +02:00
Stypox 6ea85e6380
Rename dummy_* and more to placeholder_* 2022-07-14 14:27:33 +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 4979f84e41
Solve some Sonarlint warnings 2022-07-13 23:33:16 +02:00
Stypox a19073ec01
Restore checkstyle and solve its errors 2022-07-13 23:32:27 +02:00
Stypox 1b39b5376f
Add some javadocs; move preparing player uis to PlayerUiList 2022-07-13 23:31:59 +02:00
Stypox fa25ecf521
Add comment about broadcast receiver 2022-07-13 23:27:24 +02:00
Stypox 90a89f8ca5
Move player-notification files into their package 2022-07-13 23:27:24 +02:00
Stypox 0bba1d95de
Move all notification-related calls to NotificationPlayerUi 2022-07-13 23:27:24 +02:00
Stypox b3f99645a3
Fix some crashes / issues after player refactor 2022-07-13 23:27:23 +02:00
Stypox 76ced59b62
Refactor player: separate UIs and more 2022-07-13 23:25:26 +02:00
litetex 99104fc11d
Clean up pre-Lollipop checks 2022-07-13 19:02:24 +02:00
Robin 93b913e14d
Merge pull request #8536 from TacoTheDank/bumpExoPlayer
Update ExoPlayer to 2.18.0
2022-07-13 12:59:12 +02:00
TacoTheDank 00b9c082a3 Set setUsePlatformDiagnostics to false 2022-07-02 15:01:39 -04:00
Stypox 085d1e0d38
Actually fix wrong view count 2022-07-01 16:07:19 +02:00
TacoTheDank 1404581e9b Update ExoPlayer to 2.18.0 2022-06-25 21:14:42 -04:00
AudricV 73855cacb7
Use StreamTypeUtil where possible and add isAudio and isVideo to this utility class 2022-06-17 22:01:26 +02:00
Stypox 8445c381c5
Use DownloaderImpl.USER_AGENT directly
instead of passing it as a parameter
2022-06-17 22:00:52 +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
Isira Seneviratne 23c1fc3544 Remove unnecessary compat method calls. 2022-05-10 07:45:01 +05:30
karyogamy 29fc0eff38 fixed: added comments for DefaultTrackSelector auto-select fix. 2022-04-17 18:34:31 -04:00
karyogamy 4917da2d2e fixed: disabled caption to no longer automatically re-enable on new player instance. 2022-04-17 13:26:39 -04:00