如何流式传输对用户隐藏的 phone 屏幕?
How to stream phone screen hidden from user?
使用此库 https://github.com/pedroSG94/rtmp-rtsp-stream-client-java 我可以轻松流式传输对用户隐藏的 phone 相机,但我无法流式传输对用户隐藏的 phone 显示,因为它需要用户确认才能进行屏幕流式传输。
rtspDisplay.sendIntent() - use MediaProjectionManager.createScreenCaptureIntent() method which is requered for screen capture
https://developer.android.com/reference/android/media/projection/MediaProjectionManager.html#createScreenCaptureIntent()
...
startActivityForResult(rtspDisplay.sendIntent(), REQUEST_CODE_STREAM);
...
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_STREAM
|| requestCode == REQUEST_CODE_RECORD && resultCode == Activity.RESULT_OK) {
if (rtspDisplay.prepareAudio() && rtspDisplay.prepareVideo()) {
initNotification();
rtspDisplay.setIntentResult(resultCode, data);
if (requestCode == REQUEST_CODE_STREAM) {
rtspDisplay.startStream(etUrl.getText().toString());
} else {
try {
rtspDisplay.startRecord(folder.getAbsolutePath() + "/" + currentDateAndTime + ".mp4");
} catch (IOException e) {
rtspDisplay.stopRecord();
bRecord.setText(R.string.start_record);
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
} else {
Toast.makeText(this, "Error preparing stream, This device cant do it", Toast.LENGTH_SHORT)
.show();
}
} else {
Toast.makeText(this, "No permissions available", Toast.LENGTH_SHORT).show();
}
}
如何使用任何其他库或使用 Root 流式传输对用户隐藏的 phone 屏幕?
我是 android 开发新手...
欢迎任何建议!
我使用 root 和 screenrecord 系统命令解决了我的问题....这不是实时的,但聊胜于无!
使用此库 https://github.com/pedroSG94/rtmp-rtsp-stream-client-java 我可以轻松流式传输对用户隐藏的 phone 相机,但我无法流式传输对用户隐藏的 phone 显示,因为它需要用户确认才能进行屏幕流式传输。
rtspDisplay.sendIntent() - use MediaProjectionManager.createScreenCaptureIntent() method which is requered for screen capture https://developer.android.com/reference/android/media/projection/MediaProjectionManager.html#createScreenCaptureIntent()
...
startActivityForResult(rtspDisplay.sendIntent(), REQUEST_CODE_STREAM);
...
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_STREAM
|| requestCode == REQUEST_CODE_RECORD && resultCode == Activity.RESULT_OK) {
if (rtspDisplay.prepareAudio() && rtspDisplay.prepareVideo()) {
initNotification();
rtspDisplay.setIntentResult(resultCode, data);
if (requestCode == REQUEST_CODE_STREAM) {
rtspDisplay.startStream(etUrl.getText().toString());
} else {
try {
rtspDisplay.startRecord(folder.getAbsolutePath() + "/" + currentDateAndTime + ".mp4");
} catch (IOException e) {
rtspDisplay.stopRecord();
bRecord.setText(R.string.start_record);
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
} else {
Toast.makeText(this, "Error preparing stream, This device cant do it", Toast.LENGTH_SHORT)
.show();
}
} else {
Toast.makeText(this, "No permissions available", Toast.LENGTH_SHORT).show();
}
}
如何使用任何其他库或使用 Root 流式传输对用户隐藏的 phone 屏幕? 我是 android 开发新手...
欢迎任何建议!
我使用 root 和 screenrecord 系统命令解决了我的问题....这不是实时的,但聊胜于无!