Fixes https://github.com/TeamNewPipe/NewPipe/issues/11013
We finally are at the point where we can have good logic around
clicking on timestamps.
This is pretty straightforward:
1) if we are already playing the stream (usual case), we skip to the
correct second directly
2) If we don’t have a queue yet, create a trivial one with the stream
3) If we have a queue, we insert the video as next item and start
playing it.
The skipping logic in 1) is similar to the one further down in the old
optimization block, but will always correctly fire for timestamps now.
I copied it because it’s not quite the same code, and moving into a
separate method at this stage would complicate the code too much.
Instead of implicitely reconstructing whether the intent was
intended (lol) to be a timestamp change, we create a new kind of
intent that *only* sets the data we need to switch to a new timestamp.
This means that the logic of what to do (opening a popup player) gets
moved from `InternalUrlsHandler.playOnPopup` to the
`Player.handleIntent` method, we only pass that we want to jump to a
new timestamp. Thus, the stream is now loaded *after* sending the
intent instead of before sending.
This is somewhat messy right now and still does not fix the issue of
queue deletion, but from now on the queue logic should get more
straightforward to implement.
In the end, everything should be a giant switch. Thus we don’t
fall-through anymore, but run the post-setup code manually by calling
`handeIntentPost` and then returning.
The goal here is to convert all player intents to use a single enum
with extra data for each case. The queue ones are pretty easy, they
don’t carry any extra data. We fall through for everything else for
now.
We can do this, because:
1. if `playQueue` is not null, we return early
2. if `playQueue` is null and we need to enqueue:
- the only “proper” case that could be triggered is
the `RESUME_PLAYBACK` case, which is never `true` for the queuing
intents, see the comment in `NavigationHelper.enqueueOnPlayer`
- the generic `else` case is degenerate, because it would crash on
`playQueue` being `null`.
This makes some sense, because there is no way to trigger the
enqueueing logic via the UI currently if there is no video playing
yet, in which case `playQueue` is not `null`.
So we need to transform this whole if desaster into a big switch.
Okay, so this is the … only? branch in this if-chain that will
conditionally fire if `playQueue` *is* `null`, sometimes.
This is why the unconditional `initPlayback` in `else` is not passed a
`null` in many cases … because `RESUME_PLAYBACK` is `true` and
`playQueue` is `null`.
It’s gonna be hard to figure out which parts of that are intentional,
I say.
Fixes a regression, where if the challenge data array size was one, the second element
would be accessed, leading to a crash.
This was introduced when porting the challenge parsing from JS to
Kotlin.
Ref: 53b599b042
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Swedish)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Catalan)
Currently translated at 88.2% (653 of 740 strings)
Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 90.4% (76 of 84 strings)
Translated using Weblate (Belarusian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Hindi)
Currently translated at 100.0% (84 of 84 strings)
Translated using Weblate (Punjabi)
Currently translated at 100.0% (84 of 84 strings)
Translated using Weblate (Belarusian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Punjabi)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Hindi)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Portuguese)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Bulgarian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (German)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (German)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Bulgarian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Croatian)
Currently translated at 99.7% (738 of 740 strings)
Translated using Weblate (Russian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Indonesian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Belarusian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Belarusian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Belarusian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Italian)
Currently translated at 100.0% (84 of 84 strings)
Translated using Weblate (Czech)
Currently translated at 100.0% (84 of 84 strings)
Translated using Weblate (Portuguese)
Currently translated at 99.8% (739 of 740 strings)
Translated using Weblate (Ukrainian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Czech)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Russian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Hungarian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (French)
Currently translated at 100.0% (84 of 84 strings)
Translated using Weblate (Arabic)
Currently translated at 100.0% (84 of 84 strings)
Translated using Weblate (Arabic)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Belarusian)
Currently translated at 99.5% (737 of 740 strings)
Translated using Weblate (Turkish)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Hebrew)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Icelandic)
Currently translated at 99.4% (736 of 740 strings)
Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Ukrainian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Greek)
Currently translated at 25.0% (21 of 84 strings)
Translated using Weblate (Greek)
Currently translated at 23.8% (20 of 84 strings)
Translated using Weblate (Estonian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (Bulgarian)
Currently translated at 100.0% (740 of 740 strings)
Translated using Weblate (French)
Currently translated at 99.5% (737 of 740 strings)
Co-authored-by: 439JBYL80IGQTF25UXNR0X1BG <439JBYL80IGQTF25UXNR0X1BG@users.noreply.hosted.weblate.org>
Co-authored-by: Andrey F <firsan777@mail.ru>
Co-authored-by: Anonymous <noreply@weblate.org>
Co-authored-by: Antonin Del Fabbro <message@antonin.one>
Co-authored-by: Christian Eichert <c@zp1.net>
Co-authored-by: Drugi Sapog <dindrugi@users.noreply.hosted.weblate.org>
Co-authored-by: Eduardo Calixto <eduardogubertcalixto@gmail.com>
Co-authored-by: Emin Tufan Çetin <etcetin@gmail.com>
Co-authored-by: Fjuro <fjuro@users.noreply.hosted.weblate.org>
Co-authored-by: Ghost of Sparta <makesocialfoss32@keemail.me>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Igor Rückert <igorruckert@yahoo.com.br>
Co-authored-by: Ihor Hordiichuk <igor_ck@outlook.com>
Co-authored-by: Jan Layola <gilajan@protonmail.com>
Co-authored-by: Kevin Wang <wmk153024@gmail.com>
Co-authored-by: Linerly <linerly@proton.me>
Co-authored-by: Massimo Pissarello <mapi68@gmail.com>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Petr Kadlec <mormegil@centrum.cz>
Co-authored-by: Priit Jõerüüt <hwlate@joeruut.com>
Co-authored-by: Rex_sa <rex.sa@pm.me>
Co-authored-by: Sergio Marques <so.boston.android@gmail.com>
Co-authored-by: Sveinn í Felli <sv1@fellsnet.is>
Co-authored-by: XxVictoriaxX <evakonoob@gmail.com>
Co-authored-by: Yaron Shahrabani <sh.yaron@gmail.com>
Co-authored-by: bittin1ddc447d824349b2 <bittin@reimu.nl>
Co-authored-by: trunars <trunars@gmail.com>
Co-authored-by: whistlingwoods <72640314+whistlingwoods@users.noreply.github.com>
Co-authored-by: Максим Горпиніч <maksimgorpinic2005a@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/newpipe/metadata/ar/
Translate-URL: https://hosted.weblate.org/projects/newpipe/metadata/cs/
Translate-URL: https://hosted.weblate.org/projects/newpipe/metadata/el/
Translate-URL: https://hosted.weblate.org/projects/newpipe/metadata/fr/
Translate-URL: https://hosted.weblate.org/projects/newpipe/metadata/hi/
Translate-URL: https://hosted.weblate.org/projects/newpipe/metadata/it/
Translate-URL: https://hosted.weblate.org/projects/newpipe/metadata/pa/
Translate-URL: https://hosted.weblate.org/projects/newpipe/metadata/zh_Hans/
Translation: NewPipe/Metadata
<string name="share_playlist_with_titles_message">Share playlist with details such as playlist name and video titles or as a simple list of video URLs</string>
Share playlist with details such as playlist name and video titles or as a simple list of video URLs</string>
(Discussion: https://github.com/TeamNewPipe/NewPipe/pull/12065#discussion_r1994349485)