Please do not post a support request without first reading and following the advice in

Playing RetroPie games in a browser

  • Hi guys,

    maybe some of you are interested in playing RetroPie games (running on an headless Raspberry Pi) in a PC browser (with no plugin required). Here is a

    and the instructions to do this.

  • this is really fantastic from a technical point of view... :O

  • administrators

    I did this before it was cool. Just saying...

    That alsa loop stuff is helpful though, I was trying to figure that stuff out for a while

  • There are also other examples for screen+audio mirroring in the opposite direction (PC->Rpi) if you are interested. For example, you play a game on a PC and the screen is mirrored to the Rpi display with ~no latency probably (depending on the resolution).

  • I'm wondering if this only works between one network or if a friend across the country could play the retropie at my home.

  • @lproj You mean Steam Link probably. I never tried it out on RPi, but a quick test on my phone worked. But that works only if you are on same network.

  • @Quackwalks the software (UV4L) is based on standard web technology for realtime bidirectional streaming of audio/video/data between peers in any network including internet.

    I had no problems with playing games in a LAN in various resolutions. In the posted demo the Rpi was on a wired network to my old router, while the PC was on WiFi, and the USB controller was attached to the Rpi directly because I was too lazy to configure RetroPie to work with the keyboard so that it could be controlled through the browser. In any case, the web application can certainly be extended to capture any gamepad connected to the PC (thorugh the JS gamepad API) other than browser keystrokes.

    It's worth to try this over the internet p2p to see how well it works, e.g. by exposing your Rpi to the internet or by configuring NAT traversal by specifiying a public TURN server for relaying the media/data streams.

    More interestingly, apart from the above direct peer-to-peer way, UV4L supports Janus web videorooms "in the cloud". In other words, the scenario would be the following: the Rpi in the LAN streams RetroPie to a public videoroom where one ore more participants (e.g. observers or active players) with their browsers could watch or even play the game by sending their keyboard events back to the Rpi. What is missing from this scenario to work out-of-the-box at the moment is that the Janus videoroom web interface provided by default should have to be slightly patched to capture and send the keystrokes. If there is enough interest in this, we might put some efforts in developing or giving hints to develop the missing piece (but, again, it's Javascript, so potentially every JS dev. could do that).

  • @thelostsoul no, I was still talking about UV4L (the same software pointed out in the initial post). It also allows to mirror the whole PC desktop (video + audio) with imperceptible latency from the browser to the Rpi (as opposite to the Rpi->PC demo). Again, it's everything based on standard web technology so there is no need to install any special software on the PC (i.e. the browser is enough). However, I admit I do not exactly know if pure mirroring is the same as what SteamLink does, or if it does more things, e.g. where is the gamepad controller attached to when using SteamLink, is it attached to the Rpi or to the PC?

  • @lproj Oh okay then, I don't want hijack this thread. But to answer your question, in Steam Link app, you connect the gamepad to the smartphone. It works suprisingly good, have no apparent lag and have full support for all gamepads and mouse which Steam supports, but it is not over the internet.

    Although I am not super interested in streaming for now, this is still an interesting alternative project.

  • would anybody be interested in playing retropie games in the PC/Android browser (plugin-free) as shown above, by only using your voice and/or gestures to control the player instead of/together with the gamepad controller?

  • administrators

    @lproj would be an interesting proof of concept. Would be even more interesting with games like duck hunt

  • This is another demo. The game (Super Mario) is played from an Android Smartphone this time (in Chrome to be specific, no plug-in required) with a wireless GameSir controller attached to it. As usual the game runs on an headless Raspberry Pi 3B+ (with no display, no speakers, no gamepad connected). (To be honest, for demo purposes a display was also connected to the Raspberry Pi, but it was not necessary.) Easy-to-follow Instructions to try the same will be provided soon.

  • administrators

    @lproj neat, once the dust settles with my move I'll have to dig my pi out and give it a go

  • I followed the tutorial and it worked well for me.
    For those interested in trying, just know that you do need to configure your client keyboard/gamepad in emulationstation so you should be where you can do that on your first try. Maybe that's obvious, but I did my install remotely and then couldn't interact with the RPi.

    Is there a way to use a software keyboard/gamepad with it?

  • @b3k if you know a bit of javascript programming, it should be easy to implement it in the webapp. I originally thought of a virtual gamepad to be placed on the top of the page for those who do not have a real controller but have a touchscreen, however I ended up with supporting real controllers in the browser. In any case the principle in the webapp is the same: each event (button up,down,left,right..) is mapped to the corresponding code which is sent to the rpi (where there exists a virtual gamepad interpreting the received code and "actuating" the corresponding event). The webapp source code can be found here:

  • How would you go about restricting the server's virtual keyboard to only pass through certain keys regardless of what keys the browser sends?

  • I didn't want to be very picky but i feel i must... how is this different from using a teamviewer or other remote app? Is it optimised? This may be interesting to me if it works with no lag. but we are transmitting video, right?

    Yea we cant do it with a psx game but we could do it with these smaller roms.
    Personally, i'd rather to have a browser plugin (trusted :D)

  • @navyseai said in Playing RetroPie games in a browser:

    I didn't want to be very picky but i feel i must... how is this different from using a teamviewer or other remote app?

    It's highly platform independent this way.

    Personally, i'd rather to have a browser plugin (trusted :D)

    Why add (usually third-party) code to a browser if it can get the job done without one? More code means more complexity and thus, more risk of instability, incompatibility and vulnerability.

    The link „instructions“ in the opening post lists many advantages of this approach, like clientlessness, independence, security, standardisation etc.

Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.