@stefanmartin/expo-video-watermark 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -1,58 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
plugins {
|
|
2
|
+
id 'com.android.library'
|
|
3
|
+
id 'expo-module-gradle-plugin'
|
|
4
|
+
}
|
|
2
5
|
|
|
3
6
|
group = 'expo.modules.videowatermark'
|
|
4
|
-
version = '0.1
|
|
5
|
-
|
|
6
|
-
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
|
-
apply from: expoModulesCorePlugin
|
|
8
|
-
applyKotlinExpoModulesCorePlugin()
|
|
9
|
-
useCoreDependencies()
|
|
10
|
-
useExpoPublishing()
|
|
11
|
-
|
|
12
|
-
// If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
|
|
13
|
-
// The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
|
|
14
|
-
// Most of the time, you may like to manage the Android SDK versions yourself.
|
|
15
|
-
def useManagedAndroidSdkVersions = false
|
|
16
|
-
if (useManagedAndroidSdkVersions) {
|
|
17
|
-
useDefaultAndroidSdkVersions()
|
|
18
|
-
} else {
|
|
19
|
-
buildscript {
|
|
20
|
-
// Simple helper that allows the root project to override versions declared by this library.
|
|
21
|
-
ext.safeExtGet = { prop, fallback ->
|
|
22
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
project.android {
|
|
26
|
-
compileSdkVersion safeExtGet("compileSdkVersion", 36)
|
|
27
|
-
defaultConfig {
|
|
28
|
-
minSdkVersion safeExtGet("minSdkVersion", 33)
|
|
29
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 36)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
7
|
+
version = '0.2.1'
|
|
33
8
|
|
|
34
9
|
android {
|
|
35
10
|
namespace "expo.modules.videowatermark"
|
|
36
11
|
defaultConfig {
|
|
37
|
-
versionCode
|
|
38
|
-
versionName "0.1
|
|
12
|
+
versionCode 2
|
|
13
|
+
versionName "0.2.1"
|
|
39
14
|
}
|
|
40
15
|
lintOptions {
|
|
41
16
|
abortOnError false
|
|
42
17
|
}
|
|
43
|
-
|
|
44
|
-
// Media3 Transformer + effect dependencies for watermarking (replacing FFmpeg)
|
|
45
18
|
}
|
|
46
19
|
|
|
47
20
|
dependencies {
|
|
48
21
|
def media3_version = "1.9.1"
|
|
49
22
|
|
|
50
|
-
// Core Editing & Transformation
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
23
|
+
// Core Editing & Transformation
|
|
24
|
+
api "androidx.media3:media3-transformer:$media3_version"
|
|
25
|
+
api "androidx.media3:media3-effect:$media3_version"
|
|
26
|
+
api "androidx.media3:media3-common:$media3_version"
|
|
54
27
|
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
implementation "androidx.media3:media3-muxer:$media3_version" // High-performance MP4/fragmented MP4 output
|
|
28
|
+
// Required for MP4 output
|
|
29
|
+
api "androidx.media3:media3-muxer:$media3_version"
|
|
58
30
|
}
|
|
@@ -11,7 +11,8 @@ import androidx.media3.common.MediaItem
|
|
|
11
11
|
import androidx.media3.common.util.UnstableApi
|
|
12
12
|
import androidx.media3.effect.BitmapOverlay
|
|
13
13
|
import androidx.media3.effect.OverlayEffect
|
|
14
|
-
import androidx.media3.effect.
|
|
14
|
+
import androidx.media3.effect.OverlayConfiguration
|
|
15
|
+
import androidx.media3.effect.TextureOverlay
|
|
15
16
|
import androidx.media3.transformer.Composition
|
|
16
17
|
import androidx.media3.transformer.EditedMediaItem
|
|
17
18
|
import androidx.media3.transformer.Effects
|
|
@@ -102,23 +103,23 @@ class ExpoVideoWatermarkModule : Module() {
|
|
|
102
103
|
val watermarkWidth = watermarkBitmap.width.toFloat()
|
|
103
104
|
val scale = videoWidth / watermarkWidth
|
|
104
105
|
|
|
105
|
-
// Create overlay
|
|
106
|
+
// Create overlay configuration for full-width bottom positioning
|
|
106
107
|
// In Media3, coordinates are normalized: (0,0) is center
|
|
107
108
|
// x range [-1, 1] (left to right), y range [-1, 1] (bottom to top)
|
|
108
|
-
val
|
|
109
|
+
val overlayConfiguration = OverlayConfiguration.Builder()
|
|
109
110
|
.setScale(scale, scale) // Scale uniformly to match video width
|
|
110
|
-
.
|
|
111
|
-
.
|
|
111
|
+
.setOverlayAnchor(0f, -1f) // Anchor at bottom-center of watermark
|
|
112
|
+
.setBackgroundAnchor(0f, -1f) // Position at very bottom of video
|
|
112
113
|
.build()
|
|
113
114
|
|
|
114
|
-
// Create the bitmap overlay
|
|
115
|
+
// Create the bitmap overlay with configuration
|
|
115
116
|
val bitmapOverlay = BitmapOverlay.createStaticBitmapOverlay(
|
|
116
117
|
watermarkBitmap,
|
|
117
|
-
|
|
118
|
+
overlayConfiguration
|
|
118
119
|
)
|
|
119
120
|
|
|
120
|
-
// Create overlay effect
|
|
121
|
-
val overlayEffect = OverlayEffect(ImmutableList.of(bitmapOverlay))
|
|
121
|
+
// Create overlay effect with proper typing
|
|
122
|
+
val overlayEffect = OverlayEffect(ImmutableList.of<TextureOverlay>(bitmapOverlay))
|
|
122
123
|
|
|
123
124
|
// Create effects with video overlay
|
|
124
125
|
val effects = Effects(
|