I'm frustrated because I don't really know what's the best way to implement a pop-out media player for when you scroll away from a post that's playing and I'm worried that the approach I chose is the wrong one ๐ฆ
Kinda have to create a new media element that's not part of the status component because you don't want to lose it if the status gets unmounted, but starting playback from a new element isn't gapless.
@Gargron you could create an off screen media element and proxy to another media element or canvas that you then mount and use to proxy events, kind of like how bbc/VideoContext does it
@Gargron for now users can PiP in Chrome
A new way to PIP
Just head over to
chrome://flags/#global-media-controls-picture-in-picture
flip the flag to โenabledโ, click that blue restart button and the next time you pull up a video that supports PIP (YouTube is the obvious choice, but many services use it), you can now look in your notifications tray for a new PIP button
works with Mastodon embedded vids
@Gargron in HTML you can just reappend same media element where you want and it will preserve it's state. Not sure if this is possible in React. And this does not work with iframes.
I guess for React you can play media in a portal and when status is visible, position: absolute it to status frame, and when status is not visible, change it to fixed element.
Another approach could be to manually restore state when media gets pinned, but again, it's impossible for iframes, and is heavy operation.