GoogleChromeLabs / picture-in-picture-chrome-extension

https://chrome.google.com/webstore/detail/hkgfoiooedgoejojocmhlaklaeopbecg
Apache License 2.0
680 stars 157 forks source link

Update pip window when largest video changes #42

Closed beaufortfrancois closed 4 years ago

beaufortfrancois commented 4 years ago

After PiP window has been created, monitor every second if largest playing video changed so that video conferencing web apps always show the most appropriate video.

@mounirlamouri PTAL

mounirlamouri commented 4 years ago

Could we use the ResizeObserver API when available in order to avoid polling?

beaufortfrancois commented 4 years ago

This API is only useful for existing videos. We would still need to poll for new videos sadly

mounirlamouri commented 4 years ago

The way I see it, there is only one largest video, if we assume that the main video has to be resized in order for it to not be the main video, wouldn't that resize be caught by the ResizeObserver and at that point, we could run the algorithm to check which video is now the main video?

beaufortfrancois commented 4 years ago

Your observation is correct. https://github.com/GoogleChromeLabs/picture-in-picture-chrome-extension/pull/42/commits/d250e99a3693f360642e93d2edcecd706570c5b0 addresses it. Let me know what you think.