User _vincent proposed a “Picture in Picture” (PIP) feature for Discourse oneboxes, allowing media (YouTube, SoundCloud) to continue playing in a floating window while browsing other parts of the forum. While zogstrip noted potential complexity due to DOM unloading, sam suggested it could be implemented as a distinct element via a plugin. sam clarified that the Discourse team has no plans to build this natively, leaving it to the community. In response, david developed a plugin that adds a button to compatible iframes and videos to open a docked popup, which can be minimized or closed. david shared a demo video of the functionality. Feedback followed regarding the button’s placement; sam suggested overlaying it on the video, but david explained the difficulty of doing so without obscuring the content or excluding touch devices, as iframe states are not easily detectable. The discussion on this plugin continues in a separate thread linked by erlend_sh.
I’m not familiar at all with Discourse’s codebase, and I didn’t actually write any code for a long time, so I thought I might as well post my idea in here.
I wonder if some sort of PIP feature (I guess that is how it’s called) could be implemented in Discourse.
Basically, I would like to be able to keep browsing the forums after I started playing content in a onebox (youtube, soundcloud, etc.). Even if I clicked the top logo and went back to the homepage of my forums, the video would still be playing in a hovering little box.
While I’m not able to reproduce that behaviour at the moment, I’m pretty sure Facebook sometimes did that with videos on the homepage when you kept browsing to the bottom.
It also happens on the android youtube app, when you go back to search results while a video was playing.
I don’t think the unloading it too much of a problem, this would be a distinct element outside of topic-view, always docked to bottom right or something.
I think it is pretty straight forward to do in a plugin.
I decided to have a go at making a plugin for this - is this the kind of thing you had in mind?
It works with any <iframe> or <video> (with some special treatment for lazyYT). It adds a button to every compatible thing, which then opens a little popup in the bottom right.
You can then “minimise” it, which keeps the audio going in the background, or completely close it.
The button is a bit oddly placed, I would overlay it somewhere on the video if possible, I wonder if youtube allows you to add a custom button to the embed.
I agree it’s a bit odd, I struggled to find anywhere sensible to put it. I tried doing some :hover based stuff but then realised that would exclude any touch-based devices.
The button could be positioned on top of the video, but that would obscure the video if the user decides to play inline (there’s no way to check whether a video is paused/playing when it’s inside an iframe).