1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-07-02 10:03:30 +00:00
Commit Graph

1077 Commits

Author SHA1 Message Date
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
Alex
6f7298b9db
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
93b913e14d
Merge pull request #8536 from TacoTheDank/bumpExoPlayer
Update ExoPlayer to 2.18.0
2022-07-13 12:59:12 +02:00
litetex
4e285a4e70
Fix compile errors 2022-07-04 23:19:41 +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
cbd3308da6
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
4e87f5aabc
Remove misleading first "Non" from getNonUrlAndNonTorrentStreams 2022-06-18 18:52:32 +02:00
Stypox
2019af831a
Refactor PlaybackResolver and fix cacheKeyOf
In commonCacheKeyOf the result of an Objects.hash() was ignored
2022-06-18 18:41:44 +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
AudricV
21c9530e8b
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
036196a487
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
73855cacb7
Use StreamTypeUtil where possible and add isAudio and isVideo to this utility class 2022-06-17 22:01:26 +02:00
Stypox
e5ffa2aa09
Add comments to PlaybackResolver and remove useless @NonNull 2022-06-17 22:00:52 +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
Isira Seneviratne
a1f64e4774 Merge branch 'dev' into Remove_compat_methods 2022-05-16 12:36:46 +05:30
Isira Seneviratne
23c1fc3544 Remove unnecessary compat method calls. 2022-05-10 07:45:01 +05:30
iTrooz_
61ee1c61df
Make volume progress bar match system volume when we start sliding 2022-05-09 21:40:13 +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
b59a601b52
Merge branch 'master' into dev 2022-04-29 16:41:18 +02: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
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
ZiyanZHANG
4904b48f5c Update PlayQueueActivity.java 2022-04-17 18:15:13 +08: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
9818f179c4 fixed: auto-generated captions to have lower selection priority as manual captions. 2022-04-11 22:06:43 -04:00
karyogamy
55fc3fc177 added: caption language stem utility to support language variant conversion between videos. 2022-04-08 18:21:30 -04:00
karyogamy
724eac9168 fixed: player caption auto-selection not reflected in gui.
fixed: player caption selection skipping on multiple language variants.
2022-04-07 20:02:56 -04:00
TiA4f8R
3261855b8f
Fix fetch of video streams (when switching between tracks in a play queue) and subtitles when using a seamless transition between background and video players
Make the use of the new method setDisabledTrackTypes in DefaultTrackSelector.ParametersBuilder, which disables selection of tracks type for every TrackGroup instead of the current group, which is the current behavior.
This removes the use of the deprecated of setSelectionOverride method.

Note that for progressive media, the content is still fetched, but only for initialization purposes (so requests are pretty small, most of times with a few kilobytes size).
2022-04-03 14:07:56 +02:00
karyogamy
a00bc95acc updated: source loading error for FailedMediaSource to wait for 3 seconds before allowing retry.
updated: minor style fixes.
2022-03-27 13:24:37 -04:00
karyogamy
d289dc8a53 updated: onPlayerError to not catch unspecified source errors so notifications are created.
updated: Throwable usage to Exceptions.
updated: minor styles and documentations.
2022-03-26 20:17:52 -04:00
karyogamy
b81eb35f3d added: documentations on lifecycles for FailedMediaSource and LoadedMediaSource.
fixed: onPlaybackSynchronize to rewind when not playing, which was incorrectly removed in previous commit.
fixed: sonar and checkstyle issues.
2022-03-19 22:40:32 -04:00
karyogamy
69646e5b5d added: documentations to MediaItemTags and Player.
fixed: checkStyle failures.
2022-03-19 15:56:45 -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
70d9a77e9b
Merge pull request #8073 from Stypox/bump-checkstyle
Update checkstyle to 10.0 and fix various related issues
2022-03-19 14:37:52 +01:00
litetex
6d2b5d976d
Merge pull request #8068 from TacoTheDank/lintCleaning
Some lint cleaning
2022-03-19 14:37:34 +01:00
Stypox
53f8415e9b
Use @SuppressWarnings for checkstyle suppressions & warnings
It's better to use @SuppressWarnings instead of the suppressions file, so that the warning suppression is at the place where it acts.
2022-03-18 23:57:11 +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
litetex
67651354d5 Fixed conflicts 2022-03-16 15:58:46 +01:00
litetex
cefb52471f Better naming 2022-03-16 15:52:30 +01:00
litetex
ee5e0e13b7 Made `onClick` less (cognitive) complex 2022-03-16 15:52:30 +01:00
litetex
30a8f25d52 Refactored code 2022-03-16 15:47:04 +01:00
XiangRongLin
d348c2099e stupid checkstyle 2022-03-16 15:47:04 +01:00
XiangRongLin
6a400dda7b delete unused methods 2022-03-16 15:47:03 +01:00
XiangRongLin
080c4ba680 Extract 2 view click listeners from Player 2022-03-16 15:47:03 +01:00
litetex
00e4631b3b
Merge pull request #7963 from Stypox/android-tv-player
Improve player UI and navigability for Android TV
2022-03-15 21:41:48 +01:00
ktprograms
02fa5aa0fa
Implement appending queue to playlist in main player (#8008)
This also allows saving a remote playlist locally.

- Add an "Add to playlist" button to the queue menu in the Player.
- Move the appendAllToPlaylist functionality from PlayQueueActivity to
Player.

Fixes: #8004
2022-03-15 18:32:39 +01:00
Stypox
af89f05011
Merge pull request #7341 from ktprograms/external-play-hide-controls
Fix player controls not hiding if resumed from media button
2022-03-15 13:43:35 +01:00
Stypox
e588abd4e7
Restore handling SPACE as play-pause only in fullscreen
When not in fullscreen SPACE should be not handled by the player, and hence result in a scroll down
2022-03-03 10:14:58 +01: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
Stypox
146062d921
Fix player pop-ups not giving feedback on touch/focus 2022-02-27 18:49:16 +01:00
Stypox
96c4201929
Fix controls shown below queue/segments list when using DPAD
Also invert if
2022-02-27 18:49:16 +01:00
Stypox
a0bbcd2fee
Fix player queue/segments list buttons not focusable with DPAD
Now the in-player play queue and the segments list are closeable
2022-02-27 18:49:16 +01:00
Stypox
3f7ba2e3d1
Merge pull request #7565 from haklc/dev
Change pitch by semitones
2022-02-27 09:58:38 +01:00
litetex
ccc3d38c45
Merge pull request #7910 from avently/equalscheck
Better equals check
2022-02-26 16:20:27 +01:00
litetex
a95318a4f9
Merge pull request #7349 from TiA4f8R/seamless-transition-players
Add seamless transition between background and video players when putting the app in background (for video-only streams and audio-only streams only)
2022-02-26 16:16:18 +01:00
litetex
5be40f62f3
Merge pull request #7904 from Stypox/fix-raw-use-of-parameterized-class
Solve Java warning "Raw use of parameterized class"
2022-02-26 16:14:23 +01:00
Avently
01e0dd50ad Added serviceId check while comparing PlayQueues 2022-02-23 00:53:39 +03:00
litetex
1030e09fc1
Merge pull request #7901 from Stypox/player-small-refactor
Small refactor in player class
2022-02-21 20:48:03 +01:00
TiA4f8R
c5fc37150d
Update JavaDoc of VideoPlaybackResolver.getStreamSourceType() 2022-02-20 19:40:03 +01:00
TiA4f8R
8932adbf88
Apply suggested change and add a note about data consumption for HLS streams in background
ExoPlayer right now fetches HLS video tracks even if you disable them (with setRendererDisabled or setSelectionOverride).
See issue 9282 of ExoPlayer's issue tracker for more information.
2022-02-20 19:40:03 +01:00
TiA4f8R
d27d36b76a
Adress requested changes 2022-02-20 19:40:02 +01:00
TiA4f8R
ba804c7d4a
Use a enum to understand better what source type is used.
This commit also allows a seamless transition for livestreams.
2022-02-20 19:40:02 +01:00
TiA4f8R
3db37166b4
Apply suggestion 2022-02-20 19:40:02 +01:00
TiA4f8R
bf02a569ee
Fix a NullPointerException when the current metadata is null
Reload the play queue manager and set the recovery in this case, like on the current behavior (without this PR).
2022-02-20 19:40:02 +01:00
TiA4f8R
a1c5c94753
Add some comments and a JavaDoc 2022-02-20 19:40:01 +01:00
litetex
bb27bf9d34
Resolver: Cleaned up `isVideoStreamVideoOnly`
* Replaced by ``wasLastResolvedVideoAndAudioSeparated``
* Uses an ``Optional`` instead (we can't determine if the video and audio streams are separated when we did not fetch it)
2022-02-20 19:38:41 +01:00
TiA4f8R
cc96ac173c
Apply suggestion 2022-02-20 19:38:40 +01:00
TiA4f8R
79f8270c35
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
TiA4f8R
336f9f3813
Add seamless transition between background player and video players (for video-only and audio-only streams only)
This is only available when playing video-only streams (and when there is no audio stream and only video streams with audio) and audio-only streams.
For more details about which conditions are required to get this transition, look at the changes in the useVideoSource(boolean) method of the Player class.
2022-02-20 19:38:39 +01:00
Avently
835c5e9d43 Better equals check
It ensures that queues are not the same. Without this check when you have multiple videos in the backstack and navigating back via Back button you'll get duplicated videos
2022-02-19 22:12:31 +03:00
Stypox
4789cf6c31
Use Java streams in AbstractInfoPlayQueue 2022-02-19 18:01:16 +01:00
Stypox
5f1f52b6ce
Remove useless constructor in *PlayQueue
Also removes unused <> parameter in AbstractInfoPlayQueue and deduplicates constructor code in extending classes
2022-02-19 17:49:43 +01:00
Stypox
62abfa96b8
Solve Java warning "Raw use of parameterized class" 2022-02-19 17:30:38 +01:00
Stypox
3c23fb0b13
Small refactor in player class 2022-02-19 13:30:55 +01:00
Stypox
da12b92d75
Fix fast seek arc not going under system ui 2022-02-19 11:29:33 +01:00
Stypox
00767f4bf3 Fix fast seek overlay arc not correctly centered
This happened in fullscreen player: while play-pause, brightness, volume, ... buttons were correctly centered in the app UI, the fast seek overlay was centered in the system UI, causing a mismatch between the two that looked ugly
2022-02-18 22:34:55 +01: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
d0637a8832
Suppress SonarLint NullPointerException warnings in CustomHlsPlaylistTracker
They seem to be wrong, by looking at the class work and at the return of CustomHlsPlaylistTracker's methods.
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
TiA4f8R
651b79d3ed
Catch properly BehindLiveWindowExceptions
Instead of trying to reload the play queue manager and then throwing an error, BehindLiveWindowExceptions now make the app seek to the default playback position, like recommended by ExoPlayer.
The buffering state is shown in this case.

Error handling of other exceptions is not changed.
2022-01-30 20:42:01 +01:00
litetex
2886bc3b01
Merge pull request #4833 from vkay94/youtube-rewind-forward
YouTube's Fast Forward/Rewind behavior
2022-01-30 17:07:15 +01:00
Stypox
71c5aaa11e
Do not show enqueue button if play queue not ready 2022-01-27 17:11:16 +01:00
litetex
af79479716 Fixed "Changing the seeks duration does not update the displayed seconds" 2022-01-25 20:44:49 +01:00
Stypox
5108d75682
Fix NPE and add some @Nullables
Fix NullPointerException in PlayerHolder.getQueueSize() and add `@Nullable` here and there so that the linter reports risks of NPEs
2022-01-25 17:37:20 +01:00
TiA4f8R
ea07d7751b
Fix first item played in playlists when switching player type or resolution
The issue was caused by an ExoPlayer change, which when setting a media source, resets the current playback position and the current window index by default.

Also set player recovery in more places to fix playback position not propely set in some cases after a player type switch.
2022-01-24 21:40:16 +01:00
litetex
54ef604569 Improved docs 2022-01-21 22:49:25 +01:00
litetex
30ce906f72 Apply seek conditions based on direction
* When rewinding: Check if <0,5s
* When fast-forwarding: Check if player has completed or the current playback has ended

This allows rewinding on the endscreen
2022-01-21 22:49:25 +01:00
litetex
1c20eabb48 Code cleanup 2022-01-21 22:49:25 +01:00
litetex
f8c52c4dac Fixed SonarLint problems
* Removed alphaRelativeDuration as there is no use for it
2022-01-21 22:49:24 +01:00
litetex
345ba74d58 Fixed naming 2022-01-21 22:49:24 +01:00
litetex
d2aaf152a0 Removed related import 2022-01-21 22:49:24 +01:00
litetex
7bf1f3dba6 Removed unused field 2022-01-21 22:49:24 +01:00
litetex
c25e523df6 Removed all animations to be consistent with the current behavior 2022-01-21 22:49:23 +01:00
litetex
65bb1dcdbf Refactored code 2022-01-21 22:49:23 +01:00
litetex
fe42206e94 Code cleanup and minimization
* Deduplicated and simplified a lot of code
* Fixed ``invalidSeekConditions`` so that it's possible to seek while the player is loading (like currently the case)
2022-01-21 22:49:23 +01:00
TobiGr
dac47d9f52 Replace NotNull annotation with NonNull annotation 2022-01-21 22:49:23 +01:00
Stypox
83a3d11f38 Small improvements to player 2022-01-21 22:49:22 +01:00
Stypox
a454a41b51 Fix controls not hiding correctly when switching player 2022-01-21 22:49:22 +01:00
vkay94
3aebfa22e9 SeekOverlay: Switch to merge for SecondsView and other adjustments 2022-01-21 22:49:21 +01:00
vkay94
72eb3b4415 SeekOverlay: Add seek overlay logic to player 2022-01-21 22:49:21 +01:00
litetex
41faf70da1 Workaround: Set recovery before switching player
Quick fix
2022-01-17 20:52:07 +01:00
Martin
5134080f87
Merge branch 'TeamNewPipe:dev' into dev 2021-12-25 15:14:24 +01:00
Tobi
215880207e
Merge pull request #7562 from TeamNewPipe/code-quality
Small improvements to code quality and readability
2021-12-23 23:54:29 +01:00
Martin
3e44856d01
Merge branch 'TeamNewPipe:dev' into dev 2021-12-23 15:44:09 +01:00
TobiGr
37b8a9375f Small improvements to code quality and readability
Add annotations to methods and parameters.
Replace Jetbrains' @NotNull with Androidx' @NonNull annotatiation.
Make class variables static if possible.
Use constants for some Strings.
Simplify if conditions.
2021-12-21 20:55:41 +01:00
TobiGr
a163d5461d Make PlayerHolder.bound private 2021-12-21 20:51:18 +01:00
martin
5514616372 Change pitch by semitones 2021-12-21 18:17:48 +01:00
litetex
eea2768633 Removed/Reverted MediaParser support (Android 11+) due to bugs 2021-12-19 20:16:10 +01:00
Stypox
c8e2ab4c83
Remove PlayerErrorHandler and correctly set ErrorInfo msg 2021-12-04 10:36:36 +01:00
Stypox
397f93b079
Prevent exception from being serialized in ErrorInfo
The wrong @Decorator was put in the wrong place to mark the throwable fieldd as transient, now this is fixed and the exception is not serialized. So if a non-serializable throwable is passed, that's not an issue, since it's not going to be serialized. The need for EnsureExceptionSerializable is also gone.
2021-12-04 10:36:36 +01:00
Stypox
81f740d409
Replace ErrorActivity with ErrorUtil 2021-12-04 10:36:36 +01:00
litetex
aa28a85747 Added a workaround for not serializable exceptions 2021-11-23 20:12:14 +01:00
litetex
fb58967766 PlayerErrorHandler refactor + docs 2021-11-23 20:12:12 +01:00
litetex
e632fab4d0 Added option to report player errors
* Added a new setting so that player errors are reported (under Video and Audio > Player)
* Moved the player error logic to separate class specially created for this purpose
2021-11-23 20:12:07 +01:00
Stypox
6cd25d7e55
Merge pull request #7412 from litetex/code-cleanup
Some code cleanup(s)
2021-11-23 08:59:34 +01:00
litetex
c9488eb042
Removed useless lines 2021-11-22 19:49:52 +01:00
litetex
c8516a04dc
Formatted code 2021-11-21 19:56:50 +01:00
litetex
02d1b98b1c
Removed useless doc 2021-11-21 19:46:11 +01:00
litetex
d8236bbedd
Merge pull request #7406 from Redirion/usedefaultloadcontrol
Use DefaultLoadcontrol
2021-11-21 15:11:21 +01:00
XiangRongLin
bd9dcfb28a
Merge pull request #7381 from litetex/prevent-automatic-replay-after-returning-from-background
Prevent automatic replay after returning from background
2021-11-17 09:38:09 +01:00
litetex
316db0e4c6 setRecovery: Remove checks and use Math.min/max 2021-11-15 19:56:14 +01:00
litetex
010c607e40 Prevent automatic replay after returning from background
See also https://github.com/TeamNewPipe/NewPipe/pull/7195#issuecomment-962624380
2021-11-15 19:47:08 +01:00
Robin
3e099fb2a3 Fixed Period Transition 2021-11-14 21:19:36 +01:00
Robin
9c9730b152 Use DefaultLoadcontrol 2021-11-14 20:12:12 +01:00
Robin
344fbff59a
Merge pull request #7363 from litetex/playback-speed-ctrls-simple-landscape-improvements
Simple playback-speed-controls improvements
2021-11-12 21:19:17 +01:00
litetex
48a1ab64b0 Refactored `PlaybackResolver`
* fixes the deprecation of ``setTag``
* makes the code more consistent
* de-duplicates some code
2021-11-12 20:14:39 +01:00
litetex
dd2cde3c1a De-duplicated PlayerDataSource-code 2021-11-12 19:40:00 +01:00
Robin
1b9c2b37c5 Use Android11+ extractors 2021-11-12 19:17:52 +01:00
Robin
eae1f8b597 Update ExoPlayer to 2.14.2 2021-11-12 19:17:51 +01:00
litetex
62efb588ef Removed obvious title from the "Playback Speed Controls" 2021-11-07 13:51:43 +01:00
litetex
a23f941ac8 Simplified some code and added some comments 2021-11-05 19:07:56 +01:00
litetex
b0a10f0542 Merged extremely similar code together / parity between video and popup player
* Removed ``player.getPlayPauseButton().requestFocus();`` as there is no reason why it was introduced there documented
* Use the same delay to hide the controls on both players
2021-11-05 18:10:55 +01:00
litetex
478ad42977 De-Duplicated some code 2021-11-05 18:07:21 +01:00
litetex
0764983ac6 Why log double? 2021-11-05 18:06:32 +01:00
litetex
2b2f1ee8f5 Added some doc 2021-11-05 18:06:10 +01:00
litetex
272be36dd9 Removed `e.printStacktrace` and used an proper logger 2021-11-05 18:04:49 +01:00
litetex
f933db8117 Added a custom title
to also save some margin/padding/etc
2021-11-04 19:47:08 +01:00
litetex
2e862b4ccc
Merge pull request #6844 from 0x416c6578/shuffle-mode-ui-fix
Fixed shuffle button opacity UI bug
2021-11-03 18:18:31 +01:00
litetex
ecac897e7b
Fixed typo 2021-11-03 17:30:30 +01:00
ktprograms
2934841152 Enable play/pause with space key even when not in fullscreen player 2021-11-03 08:26:13 +08:00
ktprograms
34ab93c9bd Fix player controls not hiding if resumed from media button 2021-11-01 11:50:33 +08:00
litetex
af936bc646 Always create a backup list when shuffling
The backup-list has to be created at all cost (even when current list size <= 2). Otherwise it's not possible to enter shuffle-mode (as ``isShuffled()`` always returns false)!
2021-10-23 17:35:42 +02:00
litetex
d66f933c69 Fixing the shuffle button on the UI is enough.
No need for doing the heavier method ``onShuffleModeEnabledChanged(false);``
2021-10-23 16:46:56 +02:00
0x416c6578
cf81c37683 Removed changes to the intent handler 2021-10-23 16:43:29 +02:00
0x416c6578
d2306b0fd7 Fixed shuffle button opacity bug
Parameterised shuffle state into initPlayback for potentially passing the shuffle state into the player in the future
2021-10-23 16:43:28 +02:00
TacoTheDank
b6b19b474e Update RecyclerView & Groupie 2021-10-19 17:31:59 -04:00
litetex
4af49ee5a6
Merge pull request #7194 from KalleStruik/add-to-playlist-in-share
Add a "add to playlist" option in the share menu
2021-10-13 20:34:07 +02:00
TobiGr
658d988254 Simplify code and add annotations 2021-10-10 20:33:05 +02:00
litetex
731640997e Cleaned up PlaylistDialog-related code 2021-10-09 18:46:20 +02:00
Tobi
4fc9f2e5fd
Merge pull request #7176 from litetex/fix-progress-bar-end-not-synced
Fixed seekbar not completed after video end
2021-10-02 09:24:59 +02:00
litetex
d45182cb5c Referenced issue in code 2021-09-26 20:58:49 +02:00
litetex
22847c6c92 Fixed progress bar not completing after video end 2021-09-26 20:50:24 +02:00
litetex
72dbb9441e Improved streamType check and documentation 2021-09-25 10:31:42 +02:00
litetex
bbc13756f3 Removed useless check for livestreams 2021-09-25 00:04:53 +02:00
litetex
ba0876b43b Reformatted MediaSessionManager code 2021-09-24 23:55:06 +02:00
litetex
c0d41661e8 Fixed performance problems with mediaSessionManager
* Built on top of Redirons changes
* MediaSessionManager-Metadata get's only update when metadata changes - not every second as it only changes when the metadata changes
* Reworked mediasessionmanager
2021-09-24 23:40:12 +02:00
Robin
b2e2551e33 Two fixes for setMetadata 2021-09-24 23:28:55 +02:00
Stypox
7e26748dc4
Merge branch 'master' into dev 2021-09-19 22:37:00 +02:00
z3r0r4
70354eb73e
Add play next to long press menu & refactor enqueue methods (#6872)
* added mvp play next button in long press menu; new intent handling, new long press dialog entry, new dialog functions, new strings

* changed line length for checkstyle pass

* cleaned comments, moved strings

* Update app/src/main/res/values/strings.xml

to make long press entry more descriptive

Co-authored-by: opusforlife2 <53176348+opusforlife2@users.noreply.github.com>

* Update app/src/main/res/values/strings.xml

Co-authored-by: Stypox <stypox@pm.me>

* replace redundant nextOnVideoPlayer methods

Co-authored-by: Stypox <stypox@pm.me>

* add enqueueNextOnPlayer and enqueueOnPlayer without selectOnAppend and RESUME_PLAYBACK/ deprecate enqueueNextOn*Player and enqueueOn*Player methods
add getPlayerIntent, getPlayerEnqueueIntent and getPlayerEnqueueNextIntent without selectOnAppend and RESUME_PLAYBACK/ deprecate those with
add section comments

* removed deprecated methods
removed redundant methods

* removed deprecated methods
removed redundant methods

* replaced APPEND_ONLY, removed SELECT_ON_APPEND / replaced remaining enqueueOn*Player methods

* now works with playlists

* renamed dialog entry

* checking for >1 items in the queue using the PlayerHolder

* making enqueue*OnPlayer safe to call when no video is playing (defaulting to audio)

* corrected strings

* improve getQueueSize in PlayerHolder

* long press to enqueue only if queue isnt empty

* add Whitespace

Co-authored-by: Stypox <stypox@pm.me>

* clarify comments / add spaces

* PlayerType as parameter of the enqueueOnPlayer method
add Helper method

* using the helper function everywhere (except for the background and popup long-press actions (also on playlists, history, ...)), so basically nowhere
/ passing checkstyle

* assimilated the enqueue*OnPlayer methods

* removed redundant comment, variable

* simplify code line

Co-authored-by: Stypox <stypox@pm.me>

* move if

* replace workaround for isPlayerOpen()

Co-authored-by: Stypox <stypox@pm.me>

* replaced workarounds (getType), corrected static access with getInstance

* remove unused imports

* changed method call to original, new method doesnt exist yet.

* Use getter method instead of property access syntax.

* improve conditional for play next entry

Co-authored-by: Stypox <stypox@pm.me>

* show play next btn in feed fragment

Co-authored-by: Stypox <stypox@pm.me>

* add play next to local playlist and statistics fragment

Co-authored-by: Stypox <stypox@pm.me>

* formating

Co-authored-by: Stypox <stypox@pm.me>

* correcting logic

Co-authored-by: Stypox <stypox@pm.me>

* remove 2 year old unused string, formating

Co-authored-by: Stypox <stypox@pm.me>

* correct enqueue (next) conditionals, default to background if no player is open. Dont generally default to background play.

* remove player open checks from button long press enqueue actions

* improve log msg

* Rename next to enqueue_next

* Refactor kotlin

Co-authored-by: opusforlife2 <53176348+opusforlife2@users.noreply.github.com>
Co-authored-by: Stypox <stypox@pm.me>
2021-09-18 11:22:49 +02:00
Tobi
7eb5aa1bc5
Merge pull request #7056 from TeamNewPipe/fix/playOnPopup
Fix handling exception in `playOnPopup` and toggle description tab
2021-09-10 18:21:41 +02:00
thefalsedev
892b4a15f6
Change player progress bar update from 500 ms to 1 s
Just like in the issue 7062, https://github.com/TeamNewPipe/NewPipe/issues/7062, this doesn't affect UI as it updates every one second anyway, but reduces very heavy android widget progress bar high cpu usage. With every 500s there is 6% cpu usage and with 1s only 4%. However further changes will have to be made to disable updating of player progress bar when screen is off to further reduce power consumption. With this, total power savings would be 20% in mAh consumption.
2021-09-07 00:04:05 +02:00
TobiGr
4d51ebc37a Fix a few SonarLint warnings 2021-09-05 19:54:28 +02:00
Stypox
ed408b2094
Move fullscreen-related comments to javadocs 2021-09-01 20:13:27 +02:00
Stypox
3bc661f583
Fix null pointer exception in player initialization 2021-09-01 20:13:27 +02:00
Stypox
cf9b482be2
Completely close player when changing stream w/o autoplay 2021-09-01 20:13:27 +02:00
Stypox
c6316abbce
Fix opening directly fullscreen on tablets 2021-09-01 20:12:09 +02:00
Stypox
2dfe837c35
Extract isLandscape and isInMultiWindow to DeviceUtils 2021-09-01 20:09:08 +02:00
Stypox
3c2ea7697c
Add option to directly open fullscreen when the main player starts 2021-09-01 20:08:37 +02:00