diff --git a/app/src/main/java/com/xypower/mpremote/DeviceActivity.java b/app/src/main/java/com/xypower/mpremote/DeviceActivity.java index afe8803..8e74309 100644 --- a/app/src/main/java/com/xypower/mpremote/DeviceActivity.java +++ b/app/src/main/java/com/xypower/mpremote/DeviceActivity.java @@ -567,6 +567,8 @@ public class DeviceActivity extends AppCompatActivity { leftTopOsd += simpleDateFormat2.format(dt) + " "; leftTopOsd += "CH:" + Integer.toString(channel) + " "; + byte[] leftTopOsdBytes = leftTopOsd.getBytes(StandardCharsets.UTF_8); + final String fileName = "IMG-" + Integer.toString(channel) + "-" + simpleDateFormat.format(dt) + (photoOrVideo ? ".jpg" : ".mp4"); final String remoteFilePath = REMOTE_PATH_TMP + fileName; @@ -594,11 +596,16 @@ public class DeviceActivity extends AppCompatActivity { height = channelJson.optInt("videoCY", height); } - final String cmd = "am start -n " + PACKAGE_NAME_MP + "/" + PACKAGE_NAME_MP + ".BridgeActivity --es action \"recording\" --es path \"" - + remoteFilePath + "\" --ez usb " + usb + " --ei cameraId " + Integer.toString(cameraId) + " --ei channel " - + Integer.toString(channel) + " --ei preset " + Integer.toString(preset) + " --ei duration " + Integer.toString(duration) - + " --el videoId " + Long.toString(dt.getTime() / 1000) + " --ei width " + Integer.toString(height) + " --ei height " - + Integer.toString(height) + " --es leftTopOsd \"" + leftTopOsd + "\""; + //final String cmd = "am start -n " + PACKAGE_NAME_MP + "/" + PACKAGE_NAME_MP + ".BridgeActivity --es action \"recording\" --es path \"" + // + remoteFilePath + "\" --ez usb " + usb + " --ei cameraId " + Integer.toString(cameraId) + " --ei channel " + // + Integer.toString(channel) + " --ei preset " + Integer.toString(preset) + " --ei duration " + Integer.toString(duration) + // + " --el videoId " + Long.toString(dt.getTime() / 1000) + " --ei width " + Integer.toString(height) + " --ei height " + // + Integer.toString(height) + " --es leftTopOsd \"" + leftTopOsd + "\""; + + final String cmd = "content update --uri content://" + PACKAGE_NAME_MP + ".provider/takeVideo --bind path:s:\"" + + remoteFilePath + "\" --bind usb:b:" + usb + " --bind cameraId:i:" + Integer.toString(cameraId) + " --bind channel:i:" + + Integer.toString(channel) + " --bind preset:i:" + Integer.toString(preset) + " --bind leftTopOsd:s:" + Base64.encodeToString(leftTopOsdBytes, Base64.DEFAULT | Base64.NO_WRAP) + ""; + // adbShellResponse = null; Log.d(TAG, cmd);