Closed TigerWalts closed 5 months ago
Well I gave it a go and it's a partial success.
Only the tracks are rendered to the canvas. The other elements are SVGs drawn over the top.
It's a good idea, but I think one that Remote Dispatch doesn't need to integrate. PiP mode is great on mobile devices where this is the only way to achieve the effect, but desktop has more flexibility from combining different tools. Here's what I was able to do with a Firefox extension to hide the browser chrome, and the Always On Top tool of Windows PowerToys.
Given that this is possible with full interactivity already, I'd prefer to document this approach rather than add code complexity and dependencies on bleeding edge browser features (https://wicg.github.io/document-picture-in-picture/).
Also note that Document Picture-in-Picture requires a SecureContext, so RemoteDispatch would have to switch to an HTTPS server, with an embedded certificate. That certificate would be inherently insecure, since anyone can download the mod, extract the private key, and use it for any purpose whatsoever. So I would not be willing to ship a cert signed by an actual CA. Instead it would have to be a self-signed certificate that would (rightfully!) trigger scary warnings to the user.
Oh yes, that's much easier. Thanks.
It would be desirable to be able to pop out the map into PIP window that draws over the game. This would be a handy minimap for single-screen users. It'll allow tracking remote vehicles in a yard or the end of a long train when performing a shove with a loco that doesn't have remote control support.
While there is an experimental feature in Chrome for making any element PIP-able, while this does keep the PIP interactive, this detaches to a different DOM/scope and would require a rewrite of the web client - Interactivity would be amazing, but it would be too early to start using this feature.
What would be easier to implement is to add a
<video>
tag to the DOM and source its video from the map's canvas. The canvas is still interactive and doesn't disappear with this method. The PIP is just a video and is not interactive.I found this discussion on how some others got it to work: