Share iPad Screen with UxPlay or rpiplay (gstreamer)

I am trying to mirror my iPad to a NixOs machine using UxPlay.

So far, I downloaded UxPlay and entered a shell

nix-shell -p cmake openssl pkgconfig gst_all_1.gstreamer gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good gst_all_1.gst-plugins-ugly gst_all_1.gst-plugins-bad pcre.dev avahi-compat gst_all_1.gst-libav libplist libunwind gst_all_1.gst-plugins-bad gst_all_1.gst-vaapi

mkdir build
cd build
cmake ..
make

After enabling avahi in configuration.nix via

  # Publish this server and its address on the network
  services.avahi = {
    enable = true;
    nssmdns = true;  # printing
    publish = {
      enable = true;
      addresses = true;
      workstation = true;
      userServices = true;
    };
  };

I started UxPlay

GST_DEBUG=3 ./uxplay
0:00:00.036785296  5672       0xf9be40 FIXME                default gstutils.c:4025:gst_pad_create_stream_id_internal:<video_source:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:00.041039828  5672       0xf9c060 FIXME                default gstutils.c:4025:gst_pad_create_stream_id_internal:<audio_source:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
Initialized server socket(s)
*** WARNING *** The program 'uxplay' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>

On the iPad, I can select UxPlay as a mirror, but nothing happens. On NixOs, a window should appear, but does not. I see no more log entries in the terminal.

Any ideas how to fix this? Are the dependencies I installed runtime dependencies that should go into configuration.nix? Does the firewall block something?

Edit: I tried the same using rpiplay following the aur package, but without success.

1 Like

It works if the firewall is disabled.

I found that adding whitelist of ports not works:

    networking.firewall.allowedTCPPorts = [ 7000 7100 ];
    networking.firewall.allowedUDPPorts = [ 6000 6001 7011 ];

But, disable the firewall works:

    networking.firewall.enable = lib.mkForce false;

Not sure why… umm

You can use rpiplay from nixpgs: https://github.com/NixOS/nixpkgs/blob/7084250df3d7f9735087d3234407f3c1fc2400e3/pkgs/servers/rpiplay/default.nix#L45

something like this should make it work, it uses random high ports

networking.firewall = {
enable = true;

allowedTCPPortRanges = [
{ from = 30000; to = 60000; }
];
allowedUDPPortRanges = [
{ from = 30000; to = 60000; }
];
};

1 Like