-
Notifications
You must be signed in to change notification settings - Fork 845
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
Picture-in-picture - Returning to normal player after changing tab #966
Comments
This is working as intended and was recently talked about in our Matrix channel. FreeTube is not able to differentiate between the user clicking on the "Close" button and the "Back to video player" button if you are on a different page. Because of this, we have no way of identifying the user's intention when PiP is closed. If we forced FreeTube to always navigate back to that video, then it would more than likely not be the user's intention. It's always possible the user simply wanted to stop watching the video. Because of this, closing the video is the better option and will not be changed. |
@PrestonN I understand your reasoning here, but you are expecting user to remember that if they changed the tab while having PiP opened when they they can only close it. The main issue here is that the player is somewhere in the background and still playing, only closing the app can close this player or waiting for it to end playback. |
The issue you're mentioning is something that I believe should be fixed in the latest nightly builds. There is logic that prevents the PiP video from playing in the background and there was a bug where this logic wouldn't run if your history is disabled. If you do keep history enabled and you're still experiencing this bug on the latest nightly builds, then please provide step by step instructions to reproduce and I will look into it. |
I'm sorry for creating a PR before continuing this issue here. I propose, and already created a PR for, a solution that will check if the video is currently paused or playing to determine if the PiP window should close or return to the regular video window. This works because the underlying difference between the "Close" and "Back to video player" mode is that the "Close" button pauses the video before sending the "leavepictureinpicture" event. Therefore, we can just check if the video player is paused or not when the "leavepictureinpicture" event is triggered to determine if we should close the PiP window or close the PiP window and navigate back to the original video screen. If the video is paused: Close PiP window The one down side to this is that if the video in the PiP window is paused and the user clicks the "Back to video player" button, the window close and not return to the original videos window. It will be closed as if the "Close" button is pressed, for the same reason as described above. One other thing I added is to make sure the current video progress time of the PiP video is saved before closing the PiP window to make sure you resume in the regular video window where the PiP window left off. I think this is something that should be looked into further though because it seems that the progress of watching a video in PiP mode after navigating away from the video page is not tracked. Let me know if this works or not and I can close the PR if this is not an implementation you want to add. Again, I apologize for not re-opening this issue before creating a PR. To make sure all credit is given where it's due, the idea came from this stack-overflow post: |
Wow, thanks for checking this out and finding a way to do this. Further discussion should be moved to the PR #1262 |
Behavior of the program
When User tries to come back to normal player with picture-in-picture player is opened after changing tab the player is in the background.
Expected behavior
Application should return to normal player even if User changed tabs with picture-in-picture player is opened.
Preconditions
To Reproduce
Please add all steps to reproduce the behavior:
Environment Information (please complete the following information):
The text was updated successfully, but these errors were encountered: