Live preview in XD app is so fast, how does it work out?

I tried the Live Preview with XD app, and was shocked by the speed of image synchronization
It shows nearly no delay between the phone and the laptop, just like a mirror…
As what I know about live preview function is mostly export images on the host(XD/PS/Sketch) and transport the image to phone device through wifi/usb (socket or http)
That can not be so fast…

does any one knows how XD app do it? amazing!!!

Only the engineers will know but I worked with image data for a while and computers have become extremely fast at screen capture. You could do a screen capture on a decade old computer in 10-20ms. I haven’t tested on newer computers.

Add to that hardware compression and faster networks and you get almost real time speed (30ms is 30fps). Look at Zoom or Nintendo Switch or Wii U.

Adobe also pioneered and developed many of the technology used in streaming media and networking today including FMS, AMF, RTMP, peer to peer protocols, etc.

If your phone and your computer are on the same network it might be using that short distance connection. It’s not hard to do and code examples are plenty.

My guess is it’s most likely that it’s streaming screen captures to their servers and sending it back to your device or using a local peer to peer connection.

2 Likes

I would assume (although I, of course, don’t know either) that it might also be that they (I believe I read they’re doing something like this somewhere, but that could just as well be my mind playing tricks on me) have a “renderer” for the scenegraph data structure integrated into the app.

This would, of course, mean that it’s “only” necessary to serve the scenegraph data (and, possibly, images used in the scenegraph as data uri), which should be a lot smaller than a screenshot (especially when you strip down the unnecessary parts for rendering it).

Also, to make this even faster, it would than be possible to just send diffs after the first “full sync”, meaning the only thing that would have to get submitted would be “SceneNode with GUID XXX was moved to x=360, y=250”. That’s just pure speculation on my part, though…

2 Likes

I thought I read about that too somewhere.

FYI I believe they call that atomic updating or atomic / delta changes. And yes, they are much smaller than sending an entire bitmap every frame. Online multiplayer games do this often.

1 Like