Commit Graph

172 Commits

Author SHA1 Message Date
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 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
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
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
TiA4f8R e103e4817c
Apply suggested changes and remove the CustomHlsPlaylistTracker class 2022-01-30 20:42:02 +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
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 `@Nullable`s
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
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
Stypox c8e2ab4c83
Remove PlayerErrorHandler and correctly set ErrorInfo msg 2021-12-04 10:36:36 +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
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 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 272be36dd9 Removed ``e.printStacktrace`` and used an proper logger 2021-11-05 18:04:49 +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 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
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 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 c6316abbce
Fix opening directly fullscreen on tablets 2021-09-01 20:12:09 +02:00
Stypox 3c2ea7697c
Add option to directly open fullscreen when the main player starts 2021-09-01 20:08:37 +02:00
Stypox 4b7c37e919
Merge pull request #6955 from ktprograms/queue-long-press-menu
Show popup menu when long pressing in play queue (Full screen player)
2021-08-31 12:22:59 +02:00
Stypox 88f1c3a808
Merge pull request #6985 from litetex/set-seekbarjump-when-using-dpad-to-seek-duration-from-preferences
Set ``KeyProgressIncrement`` manually / Fix long seekbar jumps when using a DPad
2021-08-30 23:36:29 +02:00
litetex 703f1550d8 Fixed double tapping the replay button 2021-08-29 17:53:09 +02:00
litetex c6ead351c0 Set ``KeyProgressIncrement`` manually
* Set ``KeyProgressIncrement`` manually to the value of the seek duration in the settings so that it works when using the DPad
* consolidated code inside a new method to avoid duplication
2021-08-26 17:16:51 +02:00
ktprograms a4503eb609 Remove TAG parameter, refactor method calls 2021-08-25 17:04:15 +08:00
ktprograms a1cb3e59d6 Move opening popup menu to utility class 2021-08-25 09:30:40 +08:00
ktprograms 1b05c404d5 Remove Details option in Main Player Queue menu 2021-08-25 08:56:26 +08:00
ktprograms 5de455bb86 Change type of themeWrapper to ContextThemeWrapper 2021-08-25 08:56:26 +08:00
ktprograms acdfee5c25 Show popup menu when long pressing in play queue (Full screen player) 2021-08-25 08:56:26 +08:00
Stypox 6eaff5ca6a
Apply review: move thumbnail loading out of Player 2021-08-24 10:56:25 +02:00
Stypox e229e5355d
Always create new bitmap when resizing thumbnail
This prevents strange crashes on some devices, fixes #4638
2021-08-24 10:56:25 +02:00
Stypox 314964c5f9
Recycle Bitmap in transformation 2021-08-24 10:56:25 +02:00
Stypox fcef783bbb
Replace UniversalImageLoader with Picasso 2021-08-24 10:56:25 +02:00
evermind-zz a536311d56
name the regions according to the comments (#6854)
if a region is named android studio will show its name in the structure view.
2021-08-10 22:38:23 +00:00
Isira Seneviratne 1721817fdb Use WindowInsetsCompat's getInsets() method. 2021-07-19 15:17:44 +05:30
litetex 621af8d812 Removed unused import (rebasing/merge problem) 2021-07-17 16:52:24 +02:00
litetex 384d964827 Added seekbarThumbnailPreview 2021-07-17 16:43:00 +02:00
Stypox a932bc2503
Merge pull request #6637 from Isira-Seneviratne/Use_GestureDetectorCompat
Use GestureDetectorCompat.
2021-07-17 12:58:43 +02:00
Tobi dfa941a9e7
Merge pull request #6503 from evermind-zz/fixes-for-upstream
Prevent error msg: 'Unrecoverable player error occurred' while playin…
2021-07-14 09:53:30 +02:00
Tobi 14dab85ff0
Merge pull request #6566 from evermind-zz/various-fixes-for-upstream
Convert PlayerHolder to Singleton; cleanup in VideoDetailFragment; Player/MainPlayer do not call onDestroy() directly
2021-07-14 09:46:04 +02:00
Isira Seneviratne 6711dae4e0 Use GestureDetectorCompat. 2021-07-10 15:35:11 +05:30
evermind f78d2a5ed8 Prevent error msg: 'Unrecoverable player error occurred' while playing video during rotation (#6502)
Playing a video in VideoDetailFragment and rotating the screen to landscape (back and forth more often)
can trigger this error message. Especially if rotation for whatever reason takes long or
playing a high resolution (1080p) video.

The underlying logcat error messages:
05-12 16:38:38.251 24920 26037 E Surface : getSlotFromBufferLocked: unknown buffer: 0x923fc810
05-12 16:38:38.251 24920 26037 W ACodec  : [OMX.qcom.video.decoder.avc] can not return buffer 35 to native window

The problem is that that Exoplayer is trying to write to our -- during rotation -- no longer existant
(VideoDetailFragment) SurfaceView.

Solution:
Implementing SurfaceHolder.Callback and using DummySurface we can now handle the lifecycle of the Surface.

How?: In case we are no longer able to write to the Surface eg. through rotation/putting in
background we can set a DummySurface. Although it only works on API >= 23.
Result: we get a little video interruption (audio is still fine) but we won't get the
'Unrecoverable player error occurred' error message.

This implementation is based on and more background information:
 'ExoPlayer stuck in buffering after re-adding the surface view a few time 2703'

 -> exoplayer fix suggestion link
  https://github.com/google/ExoPlayer/issues/2703#issuecomment-300599981
2021-07-06 12:49:56 +02:00
Robin 201e5ee09d Fix NPE when connecting via BT 2021-06-25 09:14:15 +02:00
evermind aaa3e20c5a service.onDestroy() should only be called from the system and not manually
instead use service.stopService() which inturn calls stopSelf() and
triggers hopefully onDestroy() to be called. Eventually we have to make
sure that all ServiceConnections are closed to successfully stop the service
now!

Cleanup within stopService() and not only onDestroy()

So we make sure that all listeners can react to onServiceStopped()
and close their ServiceConnections. Afterwards the android framework
is ready to stop the Service.
2021-06-24 10:15:07 +02:00
Tobi be676ad93c
Merge pull request #3371 from mauriciocolli/feed-hide-played-items
Add ability to hide played items in a feed
2021-06-18 09:18:48 +02:00
TiA4f8R d6decc05d7
Move some classes to a new subpackage and adress requested changes
Rename URLHandler and KoreUtil classes to InternalUrlsHandler and KoreUtils.
Move InternalUrlsHandler, KoreUtils, TextLinkfier, ShareUtils classes to external_communication subpackage.
Remove unused param showPreviewText in shareText method of ShareUtils class.
Add initial work to be able to display an image preview of the content shared (not for downloads).
Use a better regular expression to parse timestamps in plain text descriptions.
2021-06-11 12:12:02 +02:00
TiA4f8R d85afd6435
Initial work to add the image of the content in the share sheet
Also do some fixes when sharing a file in downloads and some improvements in JavaDocs of ShareUtils class.
2021-06-11 12:12:00 +02:00
Stypox 0113ad5e14
Correctly save stream progress at the end of a video 2021-06-09 15:53:51 +02:00
Stypox 360f5ac6f7
Save playback state even if stream is finished and add isFinished() 2021-06-09 15:53:51 +02:00
Stypox bede758507
Use url at current time for long click on player share button 2021-06-08 14:34:51 +02:00
Abanoub Sameh 5532666ad5
Long press on player share button to copy url to clipboard 2021-06-08 14:23:33 +02:00
Douile d921e2e61b
Hide queue duration when displaying segment panel
Fixes #6441
2021-06-07 02:10:44 +01:00
TobiGr 87d2f33e55 Add support for PeerTube HLS streams 2021-05-23 11:53:35 +02:00
Robin 95f61542b5 TEST: Downgrade ExoPlayer to 2.12 2021-05-14 14:47:53 +02:00
Robin 98ccd577d6 Fixed checkstyle 2021-05-14 12:15:48 +02:00
Robin 1d43a2362c Add debug option to disable media tunneling 2021-05-14 12:05:52 +02:00
litetex 31ea44ccf1
Fixed player not automatically playing (#6266)
* Fixed player not automatically playing

Should also fix https://github.com/TeamNewPipe/NewPipe/issues/6179

* Added comment
2021-05-12 10:20:39 +02:00