I wanted an approach that:
- Let me share a Mac screen with anybody, on any platform
- Required the least possible amount of software at either end (no complex servers and no funky clients to install)
- Wasn't too sophisticated (the more features, the harder things are to use)
- Would work remotely, provided you have direct Internet access
And what comes with pretty much every OS on the planet? Well, a browser, of course.
What about VNC?
At first I considered setting up an HTML page on my Mac and have it serve the VNC Java applet, but the built-in Mac OS X VNC server is utterly brain-dead in terms of image encodings and crashed most of the applet versions I tried.
Then I realized that Java applets aren't the best thing to ensure cross-platform support (modern Windows and Linux require you to find and download a JVM, which severely raises the bar and kills the "instant sharing" approach).
KISS Is Best
As usual, taking down complexity a peg makes for a better solution.
Browsers can render images, and images are readily obtainable on the Mac using the screencapture CLI command. I didn't need interactivity at all, so a solution that let me see a Mac's screen in a browser as an image was fine with me.
All that remained was the refresh interval, and I settled on 10 seconds because it's a nice compromise between the pace of slideshow presentations and live demos (where you need to see some sort of mouse movement and interaction).
So I decided to write a small Python script to serve screenshots via HTTP, taking some care to ensure that the screenshots were evenly spaced in time and that a bunch of simultaneous requests wouldn't result in undue load on the serving Mac and several nearly-identical screenshots being served to clients.
What Your Audience Sees
The end result looks like this:
Obviously, you'll have to figure out and tell other people your IP address, open any firewalls, etc., etc.
If you're a complete networking newbie, please don't ask me how to find your own IP address. Learn the basics first...
And, of course, this can be enhanced in all sorts of ways:
- Taking CLI parameters such as the port number, refresh interval and screen size
- Auto-detecting the most useful interface (usually en0 or en1 in Macs) and outputting the IP address upon startup
- It can be re-packaged as an application bundle
- It can use PyObjC to perform the actual screenshot-taking and resizing
- It can be modified to advertise itself on the LAN via Bonjour
- HTTP handling can be improved a bit (dealing with HEAD and If-Modified-Since)
- etc., etc.
The choice of port 2000 is entirely arbitrary, and my guess is that a more sensible default would be 8000, 8080, 8090, etc., since those are typically open in corporate firewalls in the outbound direction (i.e., you can share your screen with somebody behind one).