-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support delivery methods other than progressive HTTP #8153
Conversation
a64b67f
to
d876f8a
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
That's not related to my changes at all. Anyway, thanks for testing (I will push new code with a few fixes and extractor updates soon, so it would be great if you can test again when I will push it and when the CI will build a new debug APK)! |
d876f8a
to
a75029c
Compare
@@ -3,22 +3,38 @@ | |||
import org.schabi.newpipe.extractor.stream.StreamType; | |||
|
|||
/** | |||
* Utility class for {@link org.schabi.newpipe.extractor.stream.StreamType}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, these methods should be static methods in the StreamType
enum.
But that is a task for a separate PR.
948d1c3
to
6e0caf4
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This bug happens only with your PR while playing this peertube stream. Exception
Crash log` {"user_action":"play stream","request":"Player error[type=ERROR_CODE_IO_UNSPECIFIED] occurred while playing https://peertube.it/videos/watch/a34aedc6-5cda-40c5-9fe2-4aca5587985a","content_language":"it","content_country":"IT","app_language":"it_IT","service":"PeerTube","package":"org.schabi.newpipe.debug.deliverymethodsv2","version":"0.22.1","os":"Linux Android 11 - 30","time":"2022-04-23 11:14","exceptions":["com.google.android.exoplayer2.ExoPlaybackException: Source error\n\tat com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:641)\n\tat com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:617)\n\tat android.os.Handler.dispatchMessage(Handler.java:102)\n\tat android.os.Looper.loop(Looper.java:223)\n\tat android.os.HandlerThread.run(HandlerThread.java:67)\nCaused by: com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected IllegalArgumentException: null\n\tat com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:433)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)\n\tat java.lang.Thread.run(Thread.java:923)\nCaused by: java.lang.IllegalArgumentException\n\tat com.google.android.exoplayer2.util.Assertions.checkArgument(Assertions.java:39)\n\tat com.google.android.exoplayer2.upstream.DataSpec.(DataSpec.java:650)\n\tat com.google.android.exoplayer2.upstream.DataSpec.subrange(DataSpec.java:708)\n\tat com.google.android.exoplayer2.upstream.DataSpec.subrange(DataSpec.java:694)\n\tat com.google.android.exoplayer2.source.hls.HlsMediaChunk.feedDataToExtractor(HlsMediaChunk.java:463)\n\tat com.google.android.exoplayer2.source.hls.HlsMediaChunk.loadMedia(HlsMediaChunk.java:437)\n\tat com.google.android.exoplayer2.source.hls.HlsMediaChunk.load(HlsMediaChunk.java:394)\n\tat com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412)\n\t... 3 more\n"],"user_comment":""}` |
@nicoursi I could not reproduce this bug on my side. It seems be an issue in ExoPlayer itself (I remember I got it when working on implementing YouTube progrerssive DASH streams, but it was probably not related to the issues I had), as to play PeerTube streams, we are not using any custom components, only the ones of ExoPlayer. According to the stacktrace you provided, the line where the crash occured is in the DataSpec ExoPlayer class: Assertions.checkArgument(length > 0 || length == C.LENGTH_UNSET); (so because the argument does not meet the assertion) I'm afraid I cannot do something for this type of things. You may try to clear the application cache and try to seek in the stream, using the playback notification, after trying to play again the stream. |
Clearing the cache fixed the problem. Thanks |
6e0caf4
to
4272e0c
Compare
4272e0c
to
c834534
Compare
…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.
A new exception, ResolverException, a subclass of PlaybackResolver, is now thrown when errors occur in PlaybackResolver, instead of an IOException
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.
6467e96
to
e3c2aea
Compare
In commonCacheKeyOf the result of an Objects.hash() was ignored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I think the code is now understandable and should work well. I only have some non-critical comments. I pushed a few commits solving the comments marked as (already done)
, though there are still a couple of comments that we need to discuss. Thank you!
app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/player/helper/PlayerDataSource.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/player/resolver/PlaybackResolver.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/player/resolver/PlaybackResolver.java
Outdated
Show resolved
Hide resolved
desired = stream.resolution | ||
isDesired2 = stream.isVideoOnly | ||
desired = stream.getResolution() | ||
isDesired2 = stream.isVideoOnly() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small note for the future: when resulution
, isVideoOnly
and other fields will be made completely private in Stream
s, these will be simplifiable with "property access syntax" as Android Studio suggests.
app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java
Outdated
Show resolved
Hide resolved
A ResolverException will be now thrown otherwise.
Kudos, SonarCloud Quality Gate passed! |
I just noticed a small player problem: YouTube livestreams where you are only allowed to seek back at most one hour behave strangely (they keep reaching the end, loading, then playing for a bit, then reaching the end again, ...). See for example https://www.youtube.com/watch?v=5qap5aO4i9A . Other than that everything I tested worked fine, and I don't even know if the mentioned problem would also occur in the current |
I can reproduce this sometimes (also YouTube HLS manifests have sometimes issues). To avoid buffering issues on livestreams which allows rewinding, we already set the default live position 10 seconds before the live edge. We can also a custom ExoPlayer DASH MediaSource for YT live sources, which would require to be able to create DASH live manifests, which may solve these issues + clear the delay between the segment sent to official clients via DASH and the one sent in HLS manifests. |
Previous too-long title: Add support of other delivery methods than progressive HTTP (in the player only), use DASH to fetch YouTube progressive contents, fix extraction of PeerTube streams with separate audio stream and more
What is it?
Description of the changes in your PR
This PR superseeds #6537 and adds so support of other delivery methods of contents than progressive HTTP, in the player only. It also:
Before/After Screenshots/Screen Record
section);Detailed changes
External players:
Player:
HttpDataSource
to play YouTube contents, namedYoutubeHttpDataSource
, based of ExoPlayer's default one, which allows better spoofing of official clients (custom user-agent and headers (depending of the client used), use ofrange
andrn
(set dynamically by theDataSource
) parameters);Integer.MAX_VALUE
for non-live contents and 5 for live contents).Download dialog:
ListHelper
:NumberFormatException
when trying to compare two video streams between them.Tests:
ListHelperTest
andStreamItemAdapterTest
to fix breaking changes in the extractor.Other places:
Before/After Screenshots/Screen Record
Before:
After:
SVID_20220413_160341_1.mp4
New:
Fixes the following issue(s)
Relies on the following changes
APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.
Due diligence