-1

I am trying to create an app to mirror my phone's screen in a e-book reader's browser.
The idea is to continuously make screenshots and make them available from http server running on the phone.
So far I have succeeded in having an http server running on the phone and sharing the latest screenshot.
Now I would like to update the image in the browser automatically - which mechanics should I use - should the website pull the image every x milliseconds or can I push the changes from the server? The image transition should happen smoothly. The e-book's browser is somehow limited, for example it doesn't support html5-video and probably many other things.
I am using the basic dart httpServer (because my app is in flutter) and would prefer to keep it basic.
For testing I had a png Screenshot, but I would also like to optimize for greyscale and maybe try to do something with canvas (don't have experience here) if the browser supports it.

Main questions:
-is there an easy way to push changes from server to browser?
-how do I achieve a smooth transition between images (and skip refresh if the image didn't change)?
-which alternatives are there to using images?
-can canvas help me somehow?

jeff
  • 1,169
  • 1
  • 19
  • 44
  • here is what html5 standards my e-reader browser supports http://html5test.com/s/af07c24c02743dd1.html – jeff May 06 '20 at 10:03

1 Answers1

0

I think the best thing to use here is WebRTC. The browser provides getDisplayMedia that allows you to either capture a tab or the whole display of a device.

You can then connect your two devices, and stream the capture live. The other nice thing is that it will be P2P and you should see sub-second latency (and you don't have the added complexity of running a HTTP server).

All you need is a signaling server to send the Offer/Answer/ICE Candidates between the two peers. These messages are just 'bootstrap' details to get the call started.


If getDisplayMedia doesn't work on the device you can add WebRTC via a native app. flutter-webrtc is one possible solution.

Sean DuBois
  • 3,972
  • 1
  • 11
  • 22
  • I am not sure if this will work, as want to make screenshots from any app/display the user is using and not from my app itself – jeff May 06 '20 at 08:54
  • my e-book browser doesn't support webrtc - see my results http://html5test.com/s/af07c24c02743dd1.html – jeff May 06 '20 at 10:05