Skip to content

Commit

Permalink
合并分支
Browse files Browse the repository at this point in the history
  • Loading branch information
w2016561536 committed Sep 7, 2021
1 parent 18eb9c1 commit 9bc55ed
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 60 deletions.
3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 22 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,39 @@ xposed安卓虚拟摄像头
## 感谢https://github.com/wangwei1237/CameraHook 提供的HOOK思路!!
## 求有无极的大佬,希望帮忙测试一下此模块虚拟框架下是否可用,测试后希望在issue中反馈一下,谢谢!!!

已加入Camera2支持,抖音测试通过,需要**不静音**的可以在no-silent的分支/app/release/app-release.apk下载(no-silent更新很不及时(也可能是不更新了))。(链接全部放下面了)
### github release里全是静音的。

## 具体的使用方法:
## 具体的使用方法(English version is below):
1、安装xposed框架(传统xposed,edxp,lsposed等均可,不确定虚拟框架能否使用,已经确定VMOS可用,应用转生不可用)
2、安装模块,启用模块,lsposed等包含定义域的框架需要选勾目标app,但无需选勾系统框架。
3、将需要替换的视频命名为virtual.mp4,放在/sdcard/DCIM/Camera1/目录下。(前置摄像头需要水平翻转后右旋90°保存,onPreviewFrame需要匹配分辨率)
4、若需要拦截拍照事件,请在/sdcard/DCIM/Camera1/目录下放置 1000.bmp 用于替换,(前置摄像头需要水平翻转后右旋90°保存,需要匹配分辨率)
3、将需要替换的视频命名为`virtual.mp4`,放在`/sdcard/DCIM/Camera1/`目录下。(前置摄像头需要水平翻转后右旋90°保存,onPreviewFrame需要匹配分辨率)
4、若需要拦截拍照事件,请在`/sdcard/DCIM/Camera1/`目录下放置 `1000.bmp` 用于替换,(前置摄像头需要水平翻转后右旋90°保存,需要匹配分辨率)
5、**授予目标应用读取本地文件的权限,至少是允许读取媒体文件。**
6、强制结束目标应用/重启手机。

## > 如何获得分辨率??(仅拦截onPreviewFrame和拍照需要,其它系统自动处理)
## 如何获得分辨率??(仅拦截onPreviewFrame和拍照需要,其它系统自动处理)
在目标应用中打开摄像头,可在弹出的toast消息里看见。

## Camera2接口有问题??
是的,目前Camera2接口的HOOK不是所有应用程序都能生效,部分app报错打开相机失败,如果想停用Camera2接口的HOOK,可在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK
是的,目前Camera2接口的HOOK不是所有应用程序都能生效,部分app报错打开相机失败,如果想停用Camera2接口的HOOK,可在`/sdcard/DCIM/Camera1/`下创建`disable.jpg`,以停用此项HOOK

## 我不需要静音??
`/sdcard/DCIM/Camera1/`下创建`no-silent.jpg`,就不会静音了。

## Detailed usage :
1. Install this moudle. enable it in Xposed. Framework which has a scope list need to choose target app, but needn't to choose system framework.
2. Create `virtual.mp4` and put it under `/sdcard/DCIM/Camera1/` ,(if use front camera ,image should be Flip horizontal and right rotation 90 degrees, if you want to hook onPreviewFrame ,the resolution should be matched)
3. If you wants to hook image capture event, you should create `1000.bmp` under `/sdcard/DCIM/Camera1/` for replace. (if use front camera ,image should be Flip horizontal and right rotation 90 degrees, the resolution should be matched)
4. authorize the target app to access local storage in system.
5. Reboot your phone or shutdown target app.
## bugs with camera2 api, need to disable it?
create `disable.jpg` under `/sdcard/DCIM/Camera1/` to disable this method hook.
## how to get resolution ??(only hook onPreviewFrame and image capture need it)?
open camera in target app, and you can find resolution in toast message.
## Needn't mute?
Create `no-silent.jpg` under `/sdcard/DCIM/Camera1/`, and it will play sounds.

## release无法下载/gitee下载(gitee与github作者同id,同仓库名)??
在/app/release/app-release.apk,下载前请注意分支。
静音(主分支):GitHub: https://github.com/w2016561536/android_virtual_cam/blob/master/app/release/app-release.apk
GitHub: https://github.com/w2016561536/android_virtual_cam/blob/master/app/release/app-release.apk
gitee(中国大陆建议此点): https://gitee.com/w2016561536/android_virtual_cam/blob/master/app/release/app-release.apk
——————————
不静音(no-silent分支):GitHub: https://github.com/w2016561536/android_virtual_cam/blob/no-silent/app/release/app-release.apk
gitee(中国大陆建议此点): https://gitee.com/w2016561536/android_virtual_cam/blob/no-silent/app/release/app-release.apk

## 如果此应用被针对了,解决措施??
1、使用"mt管理器/np管理器"进行"修改包名/制作共存",并记住修改好的包名。
2、编辑安装包内assets中的xposed_init内容,改为“修改后包名+.HookMain”

# 请勿用于非法用途,任何法律问题与作者无关。
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.example.vcam"
minSdk 21
targetSdk 28
versionCode 7
versionName "2.4"
versionCode 8
versionName "2.5"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 7,
"versionName": "2.4",
"versionCode": 8,
"versionName": "2.5",
"outputFile": "app-release.apk"
}
],
Expand Down
15 changes: 12 additions & 3 deletions app/src/main/java/com/example/vcam/HookMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ protected void beforeHookedMethod(MethodHookParam param) {

HookMain.mMedia.setSurface(HookMain.msurf);

HookMain.mMedia.setVolume(0, 0);
File sfile = new File(Environment.getExternalStorageDirectory().getPath() + "/DCIM/Camera1/no-silent.jpg");
if (!sfile.exists()){
HookMain.mMedia.setVolume(0, 0);
}
HookMain.mMedia.setLooping(true);

HookMain.mMedia.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
Expand Down Expand Up @@ -261,7 +264,10 @@ public void onDecodeFrame(int index) {
}*/

HookMain.c2_player.setSurface(HookMain.c2_ori_Surf);
HookMain.c2_player.setVolume(0, 0);
File sfile = new File(Environment.getExternalStorageDirectory().getPath() + "/DCIM/Camera1/no-silent.jpg");
if (!sfile.exists()){
HookMain.c2_player.setVolume(0, 0);
}
HookMain.c2_player.setLooping(true);


Expand Down Expand Up @@ -400,7 +406,10 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {

HookMain.mplayer1.setSurface(HookMain.ori_holder.getSurface());
mcamera1.setPreviewTexture(c1_fake_texture);
HookMain.mplayer1.setVolume(0, 0);
File sfile = new File(Environment.getExternalStorageDirectory().getPath() + "/DCIM/Camera1/no-silent.jpg");
if (!sfile.exists()){
HookMain.mplayer1.setVolume(0, 0);
}
HookMain.mplayer1.setLooping(true);

HookMain.mplayer1.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
Expand Down
26 changes: 14 additions & 12 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:text="@string/_1_xposed_xposed_edxp_lsp_vmos_2_lsp_app_3_virtual_mp4_sdcard_dcim_camera_4_premiere_bmp_premiere_1000_1_bmp_sdcard_dcim_camera_bmp_5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/_1_xposed_xposed_edxp_lsp_vmos_2_lsp_app_3_virtual_mp4_sdcard_dcim_camera_4_premiere_bmp_premiere_1000_1_bmp_sdcard_dcim_camera_bmp_5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
create disable.jpg under /sdcard/DCIM/Camera1/ to disable this method hook.\n
##how to get resolution ??(only hook onPreviewFrame and image capture need it)?
open camera in target app, and you can find resolution in toast message.\n
##Needn't mute?
Create no-silent.jpg under /sdcard/DCIM/Camera1/, and it will play sounds.\n
open source repo link : https://github.com/w2016561536/android_virtual_cam \n
DO NOT USE FOR ANY ILLEAGLE INTENTION!!YOU NEED TO TAKE ALL RESPONSIBILITY AND CONSEQUENCE!!"
</string>
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
3、将需要替换的视频命名为virtual.mp4,放在/sdcard/DCIM/Camera1/目录下。(前置摄像头需要水平翻转后右旋90°保存,拦截onPreviewFrame需要匹配分辨率) \n\n
4、若需要拦截拍照事件,请在/sdcard/DCIM/Camera1/目录下放置 1000.bmp 用于替换,(前置摄像头需要水平翻转后右旋90°保存,需要匹配分辨率) \n\n
5、在系统设置中授予目标应用访问存储的权限。\n\n
6、强制结束目标应用/重启手机。\n
\n
##需要停用Camera2接口HOOK?\n
在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK
6、强制结束目标应用/重启手机。
\n\n
## 如何获得分辨率??(仅拦截onPreviewFrame和拍照需要,其它系统自动处理) \n
在目标应用中打开摄像头,可在弹出的toast消息里看见。 \n\n
## Camera2接口有问题?? \n
是的,目前Camera2接口的HOOK不是所有应用程序都能生效,部分app报错打开相机失败,如果想停用Camera2接口的HOOK,可在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK \n\n
## 我不需要静音??\n
在/sdcard/DCIM/Camera1/下创建no-silent.jpg,就不会静音了。\n\n
开源地址:https://github.com/w2016561536/android_virtual_cam \n\n
请勿用于任何违法用途,所有后果自负!!!
</string>
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/values-zh-rHK/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
3、将需要替换的视频命名为virtual.mp4,放在/sdcard/DCIM/Camera1/目录下。(前置摄像头需要水平翻转后右旋90°保存,拦截onPreviewFrame需要匹配分辨率) \n\n
4、若需要拦截拍照事件,请在/sdcard/DCIM/Camera1/目录下放置 1000.bmp 用于替换,(前置摄像头需要水平翻转后右旋90°保存,需要匹配分辨率) \n\n
5、在系统设置中授予目标应用访问存储的权限。\n\n
6、强制结束目标应用/重启手机。\n
\n
##需要停用Camera2接口HOOK?\n
在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK
6、强制结束目标应用/重启手机。
\n\n
## 如何获得分辨率??(仅拦截onPreviewFrame和拍照需要,其它系统自动处理) \n
在目标应用中打开摄像头,可在弹出的toast消息里看见。 \n\n
## Camera2接口有问题?? \n
是的,目前Camera2接口的HOOK不是所有应用程序都能生效,部分app报错打开相机失败,如果想停用Camera2接口的HOOK,可在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK \n\n
## 我不需要静音??\n
在/sdcard/DCIM/Camera1/下创建no-silent.jpg,就不会静音了。\n\n
开源地址:https://github.com/w2016561536/android_virtual_cam \n\n
请勿用于任何违法用途,所有后果自负!!!
</string>
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/values-zh-rMO/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
3、将需要替换的视频命名为virtual.mp4,放在/sdcard/DCIM/Camera1/目录下。(前置摄像头需要水平翻转后右旋90°保存,拦截onPreviewFrame需要匹配分辨率) \n\n
4、若需要拦截拍照事件,请在/sdcard/DCIM/Camera1/目录下放置 1000.bmp 用于替换,(前置摄像头需要水平翻转后右旋90°保存,需要匹配分辨率) \n\n
5、在系统设置中授予目标应用访问存储的权限。\n\n
6、强制结束目标应用/重启手机。\n
\n
##需要停用Camera2接口HOOK?\n
在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK
6、强制结束目标应用/重启手机。
\n\n
## 如何获得分辨率??(仅拦截onPreviewFrame和拍照需要,其它系统自动处理) \n
在目标应用中打开摄像头,可在弹出的toast消息里看见。 \n\n
## Camera2接口有问题?? \n
是的,目前Camera2接口的HOOK不是所有应用程序都能生效,部分app报错打开相机失败,如果想停用Camera2接口的HOOK,可在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK \n\n
## 我不需要静音??\n
在/sdcard/DCIM/Camera1/下创建no-silent.jpg,就不会静音了。\n\n
开源地址:https://github.com/w2016561536/android_virtual_cam \n\n
请勿用于任何违法用途,所有后果自负!!!
</string>
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/values-zh-rSG/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
3、将需要替换的视频命名为virtual.mp4,放在/sdcard/DCIM/Camera1/目录下。(前置摄像头需要水平翻转后右旋90°保存,拦截onPreviewFrame需要匹配分辨率) \n\n
4、若需要拦截拍照事件,请在/sdcard/DCIM/Camera1/目录下放置 1000.bmp 用于替换,(前置摄像头需要水平翻转后右旋90°保存,需要匹配分辨率) \n\n
5、在系统设置中授予目标应用访问存储的权限。\n\n
6、强制结束目标应用/重启手机。\n
\n
##需要停用Camera2接口HOOK?\n
在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK
6、强制结束目标应用/重启手机。
\n\n
## 如何获得分辨率??(仅拦截onPreviewFrame和拍照需要,其它系统自动处理) \n
在目标应用中打开摄像头,可在弹出的toast消息里看见。 \n\n
## Camera2接口有问题?? \n
是的,目前Camera2接口的HOOK不是所有应用程序都能生效,部分app报错打开相机失败,如果想停用Camera2接口的HOOK,可在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK \n\n
## 我不需要静音??\n
在/sdcard/DCIM/Camera1/下创建no-silent.jpg,就不会静音了。\n\n
开源地址:https://github.com/w2016561536/android_virtual_cam \n\n
请勿用于任何违法用途,所有后果自负!!!
</string>
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
3、将需要替换的视频命名为virtual.mp4,放在/sdcard/DCIM/Camera1/目录下。(前置摄像头需要水平翻转后右旋90°保存,拦截onPreviewFrame需要匹配分辨率) \n\n
4、若需要拦截拍照事件,请在/sdcard/DCIM/Camera1/目录下放置 1000.bmp 用于替换,(前置摄像头需要水平翻转后右旋90°保存,需要匹配分辨率) \n\n
5、在系统设置中授予目标应用访问存储的权限。\n\n
6、强制结束目标应用/重启手机。\n
\n
##需要停用Camera2接口HOOK?\n
在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK
6、强制结束目标应用/重启手机。
\n\n
## 如何获得分辨率??(仅拦截onPreviewFrame和拍照需要,其它系统自动处理) \n
在目标应用中打开摄像头,可在弹出的toast消息里看见。 \n\n
## Camera2接口有问题?? \n
是的,目前Camera2接口的HOOK不是所有应用程序都能生效,部分app报错打开相机失败,如果想停用Camera2接口的HOOK,可在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK \n\n
## 我不需要静音??\n
在/sdcard/DCIM/Camera1/下创建no-silent.jpg,就不会静音了。\n\n
开源地址:https://github.com/w2016561536/android_virtual_cam \n\n
请勿用于任何违法用途,所有后果自负!!!
</string>
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
3、将需要替换的视频命名为virtual.mp4,放在/sdcard/DCIM/Camera1/目录下。(前置摄像头需要水平翻转后右旋90°保存,拦截onPreviewFrame需要匹配分辨率) \n\n
4、若需要拦截拍照事件,请在/sdcard/DCIM/Camera1/目录下放置 1000.bmp 用于替换,(前置摄像头需要水平翻转后右旋90°保存,需要匹配分辨率) \n\n
5、在系统设置中授予目标应用访问存储的权限。\n\n
6、强制结束目标应用/重启手机。\n
\n
##需要停用Camera2接口HOOK?\n
在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK
6、强制结束目标应用/重启手机。
\n\n
## 如何获得分辨率??(仅拦截onPreviewFrame和拍照需要,其它系统自动处理) \n
在目标应用中打开摄像头,可在弹出的toast消息里看见。 \n\n
## Camera2接口有问题?? \n
是的,目前Camera2接口的HOOK不是所有应用程序都能生效,部分app报错打开相机失败,如果想停用Camera2接口的HOOK,可在/sdcard/DCIM/Camera1/下创建disable.jpg,以停用此项HOOK \n\n
## 我不需要静音??\n
在/sdcard/DCIM/Camera1/下创建no-silent.jpg,就不会静音了。\n\n
开源地址:https://github.com/w2016561536/android_virtual_cam \n\n
请勿用于任何违法用途,所有后果自负!!!
</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
create disable.jpg under /sdcard/DCIM/Camera1/ to disable this method hook.\n
##how to get resolution ??(only hook onPreviewFrame and image capture need it)?
open camera in target app, and you can find resolution in toast message.\n
##Needn't mute?
Create no-silent.jpg under /sdcard/DCIM/Camera1/, and it will play sounds.\n
open source repo link : https://github.com/w2016561536/android_virtual_cam \n
DO NOT USE FOR ANY ILLEAGLE INTENTION!!YOU NEED TO TAKE ALL RESPONSIBILITY AND CONSEQUENCE!!"
</string>
Expand Down

0 comments on commit 9bc55ed

Please sign in to comment.