Skip to content

Commit

Permalink
update android.
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-meta committed Aug 21, 2024
1 parent 64917ce commit e89d81f
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 38 deletions.
Binary file modified plugins/2020.3620/android/plugin.screenRecorder.aar
Binary file not shown.
18 changes: 9 additions & 9 deletions src/android/plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: 'com.android.library'

android {
namespace 'plugin.screenRecorder'
compileSdk 34

defaultConfig {
Expand Down Expand Up @@ -85,17 +86,16 @@ task deployPluginToDirectory() {
}
into "$buildDir/outputs/../../../../../plugins/2020.3620/android/"

File pluginManifestFile = file("src/main/AndroidManifest.xml")
if (pluginManifestFile.exists()) {
String manifestContents = pluginManifestFile.text
def pluginManifestXml = new XmlSlurper().parseText(manifestContents)
String packageName = pluginManifestXml.@package.toString()
rename "${project.name}-release.aar", "plugin.screenRecorder.aar"
// File pluginManifestFile = file("src/main/AndroidManifest.xml")
// if (pluginManifestFile.exists()) {
// String manifestContents = pluginManifestFile.text
// def pluginManifestXml = new XmlSlurper().parseText(manifestContents)
// String packageName = [email protected]()
// rename "classes.jar", "${packageName}.jar"
rename "${project.name}-release.aar", "${packageName}.aar"
} else {
// } else {
// rename "classes.jar", "plugin.jar"
rename "${project.name}-release.aar","plugin.jar"
}
// }
}
}
}
3 changes: 1 addition & 2 deletions src/android/plugin/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="plugin.screenRecorder">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -817,11 +817,11 @@ private void startAudioCapture() {
}
}

// mAudioRecord.stop();
// mAudioRecord.release();
// mAudioEncoder.stop();
// mAudioEncoder.release();
Log.d(TAG, "AudioEncoder stop");
mAudioRecord.stop();
mAudioRecord.release();
mAudioEncoder.stop();
mAudioEncoder.release();
// Log.d(TAG, "AudioEncoder stop");
});

mAudioThread.start();
Expand Down Expand Up @@ -860,9 +860,9 @@ private void startVideoEncoding() {
}
}

// mVideoEncoder.stop();
// mVideoEncoder.release();
Log.d(TAG, "VideoEncoder stop");
mVideoEncoder.stop();
mVideoEncoder.release();
// Log.d(TAG, "VideoEncoder stop");
});

mVideoThread.start();
Expand Down Expand Up @@ -964,21 +964,21 @@ private void resetAll() {
}
}

if (mVideoEncoder != null) {
mVideoEncoder.stop();
mVideoEncoder.release();
mVideoEncoder = null;
}
if (mAudioEncoder != null) {
mAudioEncoder.stop();
mAudioEncoder.release();
mAudioEncoder = null;
}
if (mAudioRecord != null) {
mAudioRecord.stop();
mAudioRecord.release();
mAudioRecord = null;
}
// if (mVideoEncoder != null) {
// mVideoEncoder.stop();
// mVideoEncoder.release();
// mVideoEncoder = null;
// }
// if (mAudioEncoder != null) {
// mAudioEncoder.stop();
// mAudioEncoder.release();
// mAudioEncoder = null;
// }
// if (mAudioRecord != null) {
// mAudioRecord.stop();
// mAudioRecord.release();
// mAudioRecord = null;
// }

if (mVirtualDisplay != null) {
mVirtualDisplay.release();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,17 @@ public void onHandleRequestPermissionsResult(CoronaActivity coronaActivity, int
showLongToast("No permission for " + Manifest.permission.RECORD_AUDIO);
}
} else if (fPERMISSION_REQ_ID_WRITE_EXTERNAL_STORAGE == requestCode) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
fHasPermissions = true;
startRecordingScreen();
} else {
fHasPermissions = false;
showLongToast("No permission for " + Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
fHasPermissions = true;
startRecordingScreen();
} else {
fHasPermissions = false;
showLongToast("No permission for " + Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
}
}
}
Expand Down Expand Up @@ -434,7 +439,6 @@ public int start(LuaState L) {
// fHasPermissions = true;
// }
// }
// else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (checkSelfPermission(Manifest.permission.RECORD_AUDIO, fPERMISSION_REQ_ID_RECORD_AUDIO)) {
fHasPermissions = true;
Expand Down

0 comments on commit e89d81f

Please sign in to comment.