fix name conflict
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
group = 'expo.modules.blueskyvideo'
|
group = 'expo.modules.blueskyvideocompress'
|
||||||
version = '1.0.0'
|
version = '1.0.0'
|
||||||
|
|
||||||
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
||||||
@@ -18,7 +18,7 @@ buildscript {
|
|||||||
android {
|
android {
|
||||||
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
||||||
|
|
||||||
namespace "expo.modules.blueskyvideo"
|
namespace "expo.modules.blueskyvideocompress"
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion safeExtGet("minSdkVersion", 21)
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
||||||
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
||||||
|
|||||||
+25
-1
@@ -1,4 +1,4 @@
|
|||||||
package expo.modules.blueskyvideo
|
package expo.modules.blueskyvideocompress
|
||||||
|
|
||||||
import android.media.MediaCodecInfo
|
import android.media.MediaCodecInfo
|
||||||
import android.media.MediaCodecList
|
import android.media.MediaCodecList
|
||||||
@@ -69,4 +69,28 @@ object CodecSelector {
|
|||||||
isHardware = isHardware
|
isHardware = isHardware
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun selectSoftwareEncoder(): EncoderInfo? {
|
||||||
|
val codecList = MediaCodecList(MediaCodecList.REGULAR_CODECS)
|
||||||
|
|
||||||
|
for (codecInfo in codecList.codecInfos) {
|
||||||
|
if (!codecInfo.isEncoder) continue
|
||||||
|
if (!codecInfo.supportedTypes.any { it.equals(VIDEO_AVC, ignoreCase = true) }) continue
|
||||||
|
if (DENYLIST.contains(codecInfo.name)) continue
|
||||||
|
|
||||||
|
val isSoftware = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
codecInfo.isSoftwareOnly
|
||||||
|
} else {
|
||||||
|
val name = codecInfo.name.lowercase()
|
||||||
|
name.contains("sw") || name.contains("google") || name.contains("c2.android")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSoftware) {
|
||||||
|
Log.d(TAG, "Selected software encoder: ${codecInfo.name}")
|
||||||
|
return EncoderInfo(name = codecInfo.name, isHardware = false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package expo.modules.blueskyvideo
|
package expo.modules.blueskyvideocompress
|
||||||
|
|
||||||
import expo.modules.kotlin.modules.Module
|
import expo.modules.kotlin.modules.Module
|
||||||
import expo.modules.kotlin.modules.ModuleDefinition
|
import expo.modules.kotlin.modules.ModuleDefinition
|
||||||
+5
-10
@@ -1,4 +1,4 @@
|
|||||||
package expo.modules.blueskyvideo
|
package expo.modules.blueskyvideocompress
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.media.MediaCodec
|
import android.media.MediaCodec
|
||||||
@@ -559,15 +559,10 @@ class VideoCompressor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun findSoftwareEncoder(): String? {
|
private fun findSoftwareEncoder(): String? {
|
||||||
val codecList = MediaCodecList(MediaCodecList.REGULAR_CODECS)
|
return try {
|
||||||
for (codecInfo in codecList.codecInfos) {
|
CodecSelector.selectSoftwareEncoder()?.name
|
||||||
if (!codecInfo.isEncoder) continue
|
} catch (_: Exception) {
|
||||||
if (!codecInfo.supportedTypes.any { it.equals("video/avc", ignoreCase = true) }) continue
|
null
|
||||||
val name = codecInfo.name.lowercase()
|
|
||||||
if (name.contains("sw") || name.contains("google") || name.contains("c2.android")) {
|
|
||||||
return codecInfo.name
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package expo.modules.blueskyvideo
|
package expo.modules.blueskyvideocompress
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.media.MediaExtractor
|
import android.media.MediaExtractor
|
||||||
@@ -4,6 +4,6 @@
|
|||||||
"modules": ["ExpoVideoCompressModule"]
|
"modules": ["ExpoVideoCompressModule"]
|
||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
"modules": ["expo.modules.blueskyvideo.ExpoVideoCompressModule"]
|
"modules": ["expo.modules.blueskyvideocompress.ExpoVideoCompressModule"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user