Skip to content
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

Multiple tabs with video content collide with Picture in Picture #953

Open
BPerlakiH opened this issue Aug 25, 2024 · 0 comments
Open

Multiple tabs with video content collide with Picture in Picture #953

BPerlakiH opened this issue Aug 25, 2024 · 0 comments
Assignees

Comments

@BPerlakiH
Copy link
Collaborator

BPerlakiH commented Aug 25, 2024

iPadOS 17.5

Used content:

Steps to reproduce:

  • We need 2 tabs (A and B) both with video content, each of them needs to be at a non-zero progress position (eg: at the middle of the stream)
  • From tab A start the video, launch in full screen, switch to picture in picture
  • Select tab B
  • Notice that tab B is "fixed up" (by play and pause), but that pauses the picture in picture (PIP) playback

Recording:

RPReplay_Final1724573838.MP4

Initial investigation:

It seems we have opposing forces:

  • if a video content re-appears we want to "fix it" with play + pause, so it's not causing the black screen issue
  • currently we only fixing it if the current tab's browser is not using Picture in Picture (and has some progress, meaning it's not the poster)
  • the issue is that the picture in picture video can come from another tab, further more it can even come from a tab, that has been closed, as closing the tab won't close picture in picture (which in itself is correct).
    Note: we have a separate webView/browser instance per tab.

Possible solution:

Unfortunately from swift there seems to be no easy way to get to the picture in picture video player that was created by the WKWebView
With some not so elegant JS code, by listening on each video elements entering picture and picture, and leaving picture in picture events we can get this information about individual webViews, but we need to pass these back from all webView instances to swift and gather them in one place, so we can track if we have any picture in picture or not, since a single webView is not even aware of existence of other webViews.

This way we could potentially fix the current issue, BUT:

  • it would open up the possibility to have the black screen issue again. Under the condition of foregrounding the Kiwix app and landing on tab B, while tab A's picture in picture video was playing all the time
  • it would create even more JS hacks, similar and based on [the ones we wished not to have](Re-assess / rollback JS fixes for videos #939).

Question:

I think it's a rare corner case, so worth to discuss if fixing it in a very complicate way is the way to go.

@BPerlakiH BPerlakiH added this to the 3.5.1 milestone Aug 25, 2024
@BPerlakiH BPerlakiH self-assigned this Aug 25, 2024
@kiwix kiwix locked as spam and limited conversation to collaborators Aug 25, 2024
@kiwix kiwix deleted a comment Aug 25, 2024
@kiwix kiwix deleted a comment Aug 25, 2024
@kiwix kiwix deleted a comment Aug 25, 2024
@kiwix kiwix deleted a comment Aug 25, 2024
@kiwix kiwix deleted a comment Aug 25, 2024
@BPerlakiH BPerlakiH removed this from the 3.5.1 milestone Aug 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants
@BPerlakiH and others