I am working on distributing a tablet screen with more than one table (all root) connected via WiFi, I use the following approach (all inside one stream):
1- take a screenshot.
Process sh = Runtime.getRuntime().exec("su", null,null); OutputStream os = sh.getOutputStream(); os.write(("/system/bin/screencap -P " + "/sdcard/test/img.png").getBytes("ASCII")); os.flush(); os.close(); sh.waitFor();
2- compress the screen image.
Bitmap mBitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getPath() + "/test/img.png"); OutputStream outputStream = null; File file = new File(Environment.getExternalStorageDirectory().getPath() + "/test/img2.png"); outputStream = new FileOutputStream(file); mBitmap.compress(Bitmap.CompressFormat.JPEG, 15, outputStream); outputStream.flush(); outputStream.close();
3- open socket and send the compressed image to another tablet.
this works, but my problem is delayed viewing on another tablet, it took 4-5 seconds to update the new display, is there a better approach to real-time display?
Mohammad abumazen
source share