raingart / Nova-YouTube-extension

Apache License 2.0
198 stars 9 forks source link

[Feature] Auto-pause background videos #73

Closed venkat2305 closed 1 year ago

venkat2305 commented 1 year ago

Feature request: Auto-pause background videos

Description: I'm watching a video and opened multiple videos in a new tab (using scroll wheel button). when I opened the new video, the new video starts playing pausing the original video (which I wanted to listen). This is undesirable and inconvenient. to avoid this, it would be great to have an option which automatically pauses the videos loaded in the background. This would greatly improve the user experience.

raingart commented 1 year ago

i tried in edge and in my background (if you didn't activate the tab) the video never plays

Are you sure you didn't activate the tab?

venkat2305 commented 1 year ago

it starts playing after i activated the video. but I want the original video to keep playing until I manually start playing the new videos? does it makes sense?

raingart commented 1 year ago

I understand what you mean. If the video is already playing then others should stop

I'll think about how to add it to this plugin. Might have to add a new one

raingart commented 1 year ago

check it

To activate, you just need to enable the plugin "Autopause when switching tabs". The requested function works by default. I guess it's obvious that this is incompatible with the other option "Autoplay on tab focus".

The video just pauses. Stopping is much more difficult to implement than pausing.

venkat2305 commented 1 year ago

the video should be paused in the background itself. when I opened the new tab, the video pauses after playing for a breif moment. this defeats the purpose of having the original video being played continuously without any interuption until we start playing a new video manually.then, the original video should pause and the new video should play.

venkat2305 commented 1 year ago

no it seems like its paused but, it starts playing after a moment. Please check this video.

https://user-images.githubusercontent.com/55329452/226631601-9cc2ec47-6784-4e16-942b-6ce62fba9c3e.mp4

venkat2305 commented 1 year ago

image

this pic is from the settings page of enhancer for YouTube. I'm asking for the features which are checked. In case my explanation above was not adequate or clear, this img should clarify it better.

raingart commented 1 year ago

btw, in this latest version hide buttons is not working. have you changed anything.

Probably not. Unless you are using a browser version lower than 105. then the buttons in the description will not hide

And what buttons - player or descriptions? what's in the console? when lazy loading from another page. It seems to work for me

By the way, I managed to debug the extension code that you provided. I found out the startup code section. I'm not sure if I'll be using his play-blocking method. The author uses the substitution of the built-in video.play function, which is quite dangerous. Complete interception of playback can break the player. It also requires implementation before launching the video. For if you fail, you can break the player

Screenshot_1

raingart commented 1 year ago

@venkat2305 Finally I got a positive result. It took a lot of time to bypass the delay when playing/pausing. But finally I was able to get rid of it.

raingart commented 1 year ago

Hi @venkat2305 I changed the behavior in the latest ver. To select what you requested earlier, switch "Autoplay on tab focus" on "always for not started"