vdocipher-rn-bridge 1.21.3 → 1.22.0

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.
@@ -1,4 +1,4 @@
1
- import org.json.JSONObject
1
+ import groovy.json.JsonSlurper
2
2
  import java.nio.file.Files
3
3
  import java.nio.file.Paths
4
4
 
@@ -7,9 +7,8 @@ buildscript {
7
7
  google()
8
8
  mavenCentral()
9
9
  }
10
-
11
10
  dependencies {
12
- classpath 'com.android.tools.build:gradle:4.2.2'
11
+ classpath 'com.android.tools.build:gradle:8.13.0'
13
12
  }
14
13
  }
15
14
 
@@ -18,73 +17,75 @@ apply plugin: 'com.android.library'
18
17
  // TODO read from package.json
19
18
  // "releaseVersionName" must be the same as "version" in package.json
20
19
  // "releaseVersionCode" must increment by 1 with every release
21
- def releaseVersionName = "1.21.3"
22
- def releaseVersionCode = 48
20
+ def releaseVersionName = "1.22.0"
21
+ def releaseVersionCode = 50
23
22
 
24
23
  android {
25
- compileSdkVersion 35
24
+ namespace = "com.vdocipher.rnbridge"
25
+ compileSdk = 35
26
26
 
27
27
  defaultConfig {
28
- minSdkVersion 21
29
- targetSdkVersion 35
28
+ minSdk = 24
29
+ targetSdk = 36
30
30
 
31
31
  // Generate BuildConfig fields for library version info
32
32
  buildConfigField "int", "VDO_VERSION_CODE", "${releaseVersionCode}"
33
33
  buildConfigField "String", "VDO_VERSION_NAME", "\"${releaseVersionName}\""
34
34
  }
35
- lintOptions {
36
- abortOnError false
35
+
36
+ lint {
37
+ abortOnError = false
37
38
  }
38
39
 
39
40
  compileOptions {
40
- sourceCompatibility JavaVersion.VERSION_1_8
41
- targetCompatibility JavaVersion.VERSION_1_8
41
+ sourceCompatibility = JavaVersion.VERSION_1_8
42
+ targetCompatibility = JavaVersion.VERSION_1_8
42
43
  }
43
44
  }
44
45
 
45
- task verifyVersionNameMatchesWithPackageJson {
46
+ tasks.register("verifyVersionNameMatchesWithPackageJson") {
46
47
  doLast {
47
48
  final String versionFromGradleConfig = releaseVersionName
48
49
 
49
50
  File f = project.file("../package.json")
50
51
  String packageJsonText = new String(
51
- Files.readAllBytes(Paths.get(f.toURI())),
52
- "UTF-8")
53
- JSONObject packageJsonData = new JSONObject(packageJsonText)
54
-
55
- final String versionFromPackageJson = packageJsonData.get("version")
52
+ Files.readAllBytes(Paths.get(f.toURI())),
53
+ "UTF-8"
54
+ )
55
+ def packageJsonData = new JsonSlurper().parseText(packageJsonText)
56
+ final String versionFromPackageJson = packageJsonData.version
56
57
 
57
- if (!versionFromGradleConfig.equals(versionFromPackageJson)) {
58
+ if (versionFromGradleConfig != versionFromPackageJson) {
58
59
  throw new IllegalStateException(
59
- "Version mismatch: version " + versionFromGradleConfig + " from build.gradle " +
60
- "does not match the version " + versionFromPackageJson + " in package.json." +
61
- "\nIn android/build.gradle, releaseVersionName must be " +
62
- "updated to reflect the version in package.json whenever the package.json " +
63
- "version is updated. Also, releaseVersionCode must be " +
64
- "incremented by 1 with every release." +
65
- "\nThis is to ensure the vdocipher " +
66
- "native android sdk has correct vdocipher react-native sdk version at runtime for " +
67
- "analytics and other purposes."
60
+ "Version mismatch: version " + versionFromGradleConfig + " from build.gradle " +
61
+ "does not match the version " + versionFromPackageJson + " in package.json." +
62
+ "\nIn android/build.gradle, releaseVersionName must be updated " +
63
+ "to match package.json whenever its version changes, and " +
64
+ "releaseVersionCode must be incremented by 1 each release."
68
65
  )
69
66
  }
70
67
  }
71
68
  }
72
69
 
73
- afterEvaluate {
74
- assembleDebug.finalizedBy(verifyVersionNameMatchesWithPackageJson)
75
- assembleRelease.finalizedBy(verifyVersionNameMatchesWithPackageJson)
70
+ androidComponents {
71
+ onVariants(selector().all()) { variant ->
72
+ def assembleTask = tasks.findByName("assemble${variant.name.capitalize()}")
73
+ if (assembleTask != null) {
74
+ assembleTask.finalizedBy(tasks.named("verifyVersionNameMatchesWithPackageJson"))
75
+ }
76
+ }
76
77
  }
77
78
 
78
79
  repositories {
79
80
  google()
80
81
  mavenCentral()
81
82
  maven {
82
- url "https://github.com/VdoCipher/maven-repo/raw/master/repo"
83
+ url = uri("https://github.com/VdoCipher/maven-repo/raw/master/repo")
83
84
  }
84
85
  }
85
86
 
86
87
  dependencies {
87
- compileOnly 'com.facebook.react:react-native:+'
88
- implementation 'androidx.appcompat:appcompat:1.3.1'
89
- implementation 'com.vdocipher.aegis:vdocipher-android:1.28.10'
88
+ compileOnly("com.facebook.react:react-native:+")
89
+ implementation("androidx.appcompat:appcompat:1.3.1")
90
+ implementation("com.vdocipher.aegis:vdocipher-android:1.29.2")
90
91
  }
@@ -9,6 +9,7 @@ import com.facebook.react.uimanager.ThemedReactContext;
9
9
  import com.facebook.react.uimanager.ViewGroupManager;
10
10
  import com.facebook.react.uimanager.annotations.ReactProp;
11
11
  import com.vdocipher.aegis.player.VdoInitParams;
12
+ import android.graphics.Color;
12
13
 
13
14
  import java.util.Map;
14
15
 
@@ -72,6 +73,14 @@ public class ReactVdoPlayerUIViewManager extends ViewGroupManager<ReactVdoPlayer
72
73
  embedInfo.getBoolean("allowAdbDebugging");
73
74
  int resumeTimeMs = embedInfo.hasKey("resumeTimeMs") ?
74
75
  embedInfo.getInt("resumeTimeMs") : 0;
76
+ int clipStartInMs = embedInfo.hasKey("clipStartInMs") ?
77
+ embedInfo.getInt("clipStartInMs") : 0;
78
+ int clipEndInMs = embedInfo.hasKey("clipEndInMs") ?
79
+ embedInfo.getInt("clipEndInMs") : Integer.MAX_VALUE;
80
+ boolean clipped = !embedInfo.hasKey("clipped") ||
81
+ embedInfo.getBoolean("clipped");
82
+ String clipMarkerColor = embedInfo.hasKey("clipMarkerColor") ?
83
+ embedInfo.getString("clipMarkerColor") : "#FFFFFF";
75
84
 
76
85
  VdoInitParams.Builder builder = new VdoInitParams.Builder();
77
86
 
@@ -86,6 +95,9 @@ public class ReactVdoPlayerUIViewManager extends ViewGroupManager<ReactVdoPlayer
86
95
  builder.setResumeTime(resumeTimeMs);
87
96
  }
88
97
 
98
+ int markerColorInt = Color.parseColor(clipMarkerColor);
99
+ builder.setClips(clipStartInMs, clipEndInMs, clipped, markerColorInt);
100
+
89
101
  if (offline) {
90
102
  String mediaId = embedInfo.hasKey("mediaId") ? embedInfo.getString("mediaId") : null;
91
103
 
@@ -9,6 +9,7 @@ import com.facebook.react.uimanager.ViewGroupManager;
9
9
  import com.facebook.react.uimanager.annotations.ReactProp;
10
10
  import com.vdocipher.aegis.player.VdoInitParams;
11
11
  import com.vdocipher.aegis.media.Track;
12
+ import android.graphics.Color;
12
13
 
13
14
  import java.util.Map;
14
15
 
@@ -73,6 +74,14 @@ public class ReactVdoPlayerViewManager extends ViewGroupManager<ReactVdoPlayerVi
73
74
  embedInfo.getBoolean("allowAdbDebugging");
74
75
  int resumeTimeMs = embedInfo.hasKey("resumeTimeMs") ?
75
76
  embedInfo.getInt("resumeTimeMs") : 0;
77
+ int clipStartInMs = embedInfo.hasKey("clipStartInMs") ?
78
+ embedInfo.getInt("clipStartInMs") : 0;
79
+ int clipEndInMs = embedInfo.hasKey("clipEndInMs") ?
80
+ embedInfo.getInt("clipEndInMs") : Integer.MAX_VALUE;
81
+ boolean clipped = !embedInfo.hasKey("clipped") ||
82
+ embedInfo.getBoolean("clipped");
83
+ String clipMarkerColor = embedInfo.hasKey("clipMarkerColor") ?
84
+ embedInfo.getString("clipMarkerColor") : "#FFFFFF";
76
85
 
77
86
  VdoInitParams.Builder builder = new VdoInitParams.Builder();
78
87
 
@@ -87,6 +96,9 @@ public class ReactVdoPlayerViewManager extends ViewGroupManager<ReactVdoPlayerVi
87
96
  builder.setResumeTime(resumeTimeMs);
88
97
  }
89
98
 
99
+ int markerColorInt = Color.parseColor(clipMarkerColor);
100
+ builder.setClips(clipStartInMs, clipEndInMs, clipped, markerColorInt);
101
+
90
102
  if (offline) {
91
103
  String mediaId = embedInfo.hasKey("mediaId") ? embedInfo.getString("mediaId") : null;
92
104
 
@@ -28,6 +28,9 @@ import java.util.HashMap;
28
28
  import javax.annotation.Nonnull;
29
29
  import javax.annotation.Nullable;
30
30
 
31
+ import android.os.Handler;
32
+ import android.os.Looper;
33
+
31
34
  import static com.vdocipher.rnbridge.Utils.*;
32
35
 
33
36
  /**
@@ -42,6 +45,8 @@ import static com.vdocipher.rnbridge.Utils.*;
42
45
  public class VdoDownloadModule extends ReactContextBaseJavaModule implements VdoDownloadManager.EventListener {
43
46
  private static final String TAG = "VdoDownloadModule";
44
47
 
48
+ private Handler mainHandler;
49
+
45
50
  private final HashMap<String, DownloadOptions> downloadOptionsStore;
46
51
  private static final String DEFAULT_DOWNLOAD_DIRECTORY_NAME = "offlineVdos";
47
52
 
@@ -49,6 +54,7 @@ public class VdoDownloadModule extends ReactContextBaseJavaModule implements Vdo
49
54
  super(reactContext);
50
55
  downloadOptionsStore = new HashMap<>();
51
56
  VdoDownloadManager.getInstance(reactContext).addEventListener(this);
57
+ mainHandler = new Handler(Looper.getMainLooper());
52
58
  }
53
59
 
54
60
  @Override
@@ -363,7 +369,9 @@ public class VdoDownloadModule extends ReactContextBaseJavaModule implements Vdo
363
369
 
364
370
  // Enqueue request to VdoDownloadManager for download
365
371
  try {
366
- vdoDownloadManager.enqueueV2(request);
372
+ mainHandler.post(() -> {
373
+ vdoDownloadManager.enqueueV2(request);
374
+ });
367
375
  successCallback.invoke();
368
376
  } catch (IllegalArgumentException | IllegalStateException e) {
369
377
  Log.e(TAG, "enqueue failed: " + Log.getStackTraceString(e));
@@ -9,6 +9,8 @@ import com.facebook.react.bridge.ReactMethod;
9
9
  import com.facebook.react.bridge.ReadableMap;
10
10
  import com.vdocipher.aegis.player.VdoInitParams;
11
11
 
12
+ import android.graphics.Color;
13
+
12
14
  import static com.vdocipher.rnbridge.Utils.getTechOverride;
13
15
  import java.util.HashMap;
14
16
 
@@ -48,6 +50,14 @@ public class VdocipherRnBridgeModule extends ReactContextBaseJavaModule {
48
50
  embedInfo.getBoolean("allowAdbDebugging");
49
51
  int resumeTimeMs = embedInfo.hasKey("resumeTimeMs") ?
50
52
  embedInfo.getInt("resumeTimeMs") : 0;
53
+ int clipStartInMs = embedInfo.hasKey("clipStartInMs") ?
54
+ embedInfo.getInt("clipStartInMs") : 0;
55
+ int clipEndInMs = embedInfo.hasKey("clipEndInMs") ?
56
+ embedInfo.getInt("clipEndInMs") : Integer.MAX_VALUE;
57
+ boolean clipped = !embedInfo.hasKey("clipped") ||
58
+ embedInfo.getBoolean("clipped");
59
+ String clipMarkerColor = embedInfo.hasKey("clipMarkerColor") ?
60
+ embedInfo.getString("clipMarkerColor") : "#FFFFFF";
51
61
 
52
62
  VdoInitParams.Builder builder = new VdoInitParams.Builder();
53
63
 
@@ -62,6 +72,9 @@ public class VdocipherRnBridgeModule extends ReactContextBaseJavaModule {
62
72
  builder.setResumeTime(resumeTimeMs);
63
73
  }
64
74
 
75
+ int markerColorInt = Color.parseColor(clipMarkerColor);
76
+ builder.setClips(clipStartInMs, clipEndInMs, clipped, markerColorInt);
77
+
65
78
  if (offline) {
66
79
  String mediaId = embedInfo.hasKey("mediaId") ? embedInfo.getString("mediaId") : null;
67
80
 
@@ -183,6 +183,9 @@ class VdoCipherRNView: UIView {
183
183
  let customPlayerId = embedInfo["customPlayerId"] as? String
184
184
  let preferredCaptionsLanguage = embedInfo["preferredCaptionsLanguage"] as? String
185
185
  let enableAutoResume = embedInfo["enableAutoResume"] as? Bool
186
+ let markerColor = embedInfo["clipMarkerColor"] as? String
187
+ let clipped = embedInfo["clipped"] as? Bool ?? false
188
+ var playerOptions: PlayerOptions? = nil
186
189
  if enableAutoResume == false {
187
190
  let userDefaults: UserDefaults? = UserDefaults.init(suiteName: "com.vdocipher.ios.VdoFramework")
188
191
  if var assetsLastPlaybackTimeSet = userDefaults?.value(forKey: "assetsLastPlaybackTimeSet") as? [String: Double] {
@@ -205,14 +208,30 @@ class VdoCipherRNView: UIView {
205
208
  self.setResumeTime(resumeTime)
206
209
  }
207
210
  self.preferredCaptionsLanguage = preferredCaptionsLanguage
211
+ if let startInt = embedInfo["clipStartInMs"] as? Int,
212
+ let endInt = embedInfo["clipEndInMs"] as? Int,
213
+ startInt >= 0, endInt >= 0 {
214
+
215
+ let clipStart = UInt(startInt/1000)
216
+ let clipEnd = UInt(endInt/1000)
217
+
218
+ let clipping = Clipping(
219
+ markerColor: markerColor,
220
+ clipStartInSeconds: clipStart,
221
+ clipEndInSeconds: clipEnd,
222
+ clipped: clipped
223
+ )
224
+
225
+ playerOptions = PlayerOptions(clippingModelConfig: clipping)
226
+ }
208
227
  if let onlineCredentials = onlineCredentials {
209
228
  if onlineCredentials.tokenType == .otp {
210
- asset.playOnline(otp: onlineCredentials.token, playbackInfo: onlineCredentials.playbackInfo!)
229
+ asset.playOnline(otp: onlineCredentials.token, playbackInfo: onlineCredentials.playbackInfo!, playerOptions: playerOptions)
211
230
  } else {
212
- asset.playOnline(token: onlineCredentials.token)
231
+ asset.playOnline(token: onlineCredentials.token, playerOptions: playerOptions)
213
232
  }
214
233
  } else {
215
- asset.playOffline()
234
+ asset.playOffline(playerOptions: playerOptions)
216
235
  }
217
236
  }
218
237
  })
@@ -5,7 +5,7 @@ import VdoFramework
5
5
  @objc(VdocipherRnBridge)
6
6
  class VdocipherRnBridge: RCTViewManager {
7
7
 
8
- static let vdocipherRnBridgeVersionString = "1.21.3"
8
+ static let vdocipherRnBridgeVersionString = "1.22.0"
9
9
 
10
10
  @objc override static func requiresMainQueueSetup() -> Bool {
11
11
  return true
@@ -73,13 +73,32 @@ class VdocipherRnBridge: RCTViewManager {
73
73
  }
74
74
  }
75
75
  VdoCipher.enableAutoPlay = true
76
+ let markerColor = embedInfo["clipMarkerColor"] as? String
77
+ let clipped = embedInfo["clipped"] as? Bool ?? false
78
+ var playerOptions: PlayerOptions? = nil
79
+ if let startInt = embedInfo["clipStartInMs"] as? Int,
80
+ let endInt = embedInfo["clipEndInMs"] as? Int,
81
+ startInt >= 0, endInt >= 0 {
82
+
83
+ let clipStart = UInt(startInt/1000)
84
+ let clipEnd = UInt(endInt/1000)
85
+
86
+ let clipping = Clipping(
87
+ markerColor: markerColor,
88
+ clipStartInSeconds: clipStart,
89
+ clipEndInSeconds: clipEnd,
90
+ clipped: clipped
91
+ )
92
+
93
+ playerOptions = PlayerOptions(clippingModelConfig: clipping)
94
+ }
76
95
  if asset.downloadState == .downloaded {
77
- asset.playOffline()
96
+ asset.playOffline(playerOptions: playerOptions)
78
97
  } else {
79
98
  if credentials?.tokenType == .otp {
80
- asset.playOnline(otp: credentials!.token, playbackInfo: credentials!.playbackInfo!)
99
+ asset.playOnline(otp: credentials!.token, playbackInfo: credentials!.playbackInfo!, playerOptions: playerOptions)
81
100
  } else {
82
- asset.playOnline(token: credentials!.token)
101
+ asset.playOnline(token: credentials!.token, playerOptions: playerOptions)
83
102
  }
84
103
  }
85
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vdocipher-rn-bridge",
3
- "version": "1.21.3",
3
+ "version": "1.22.0",
4
4
  "description": "React native bridge library that delegates to vdocipher native android SDK",
5
5
  "homepage": "https://www.vdocipher.com/docs/mobile/react-native/getting-started/",
6
6
  "scripts": {
@@ -12,11 +12,11 @@
12
12
  "author": "",
13
13
  "license": "",
14
14
  "peerDependencies": {
15
- "react-native": "0.68 - 0.79"
15
+ "react-native": "0.68 - 0.82"
16
16
  },
17
17
  "dependencies": {
18
- "deprecated-react-native-prop-types": "^2.3.0",
19
- "prop-types": "^15.6.2"
18
+ "deprecated-react-native-prop-types": "^5.0.0",
19
+ "prop-types": "^15.8.1"
20
20
  },
21
21
  "files": [
22
22
  "android/build.gradle",
@@ -34,13 +34,13 @@
34
34
  "navigationHelper.ts"
35
35
  ],
36
36
  "devDependencies": {
37
- "@tsconfig/react-native": "^2.0.3",
38
- "@types/jest": "^29.4.0",
37
+ "@tsconfig/react-native": "^3.0.7",
38
+ "@types/jest": "^30.0.0",
39
39
  "@types/node": "^18.11.18",
40
40
  "@types/prop-types": "^15.7.5",
41
- "@types/react": "18.0.0",
42
- "@types/react-native": "0.70",
43
- "@types/react-test-renderer": "^18.0.0",
44
- "typescript": "^4.9.4"
41
+ "@types/react": "19.2.2",
42
+ "@types/react-native": "0.73.0",
43
+ "@types/react-test-renderer": "^19.1.0",
44
+ "typescript": "^5.9.3"
45
45
  }
46
46
  }
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
19
  s.dependency "React-Core"
20
- s.dependency "VdoFramework", "2.8.0"
20
+ s.dependency "VdoFramework", "2.8.1"
21
21
 
22
22
  # Don't install the dependencies when we run `pod install` in the old architecture.
23
23
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
package/type.ts CHANGED
@@ -36,6 +36,10 @@ export interface OtpEmbedInfo {
36
36
  * Not supported in iOS
37
37
  */
38
38
  allowAdbDebugging?: boolean;
39
+ clipStartInMs?: number | null;
40
+ clipEndInMs?: number | null;
41
+ clipped?: boolean | null;
42
+ clipMarkerColor?: string | null;
39
43
  }
40
44
 
41
45
  export interface TokenEmbedInfo {
@@ -72,6 +76,10 @@ export interface TokenEmbedInfo {
72
76
  * Not supported in iOS
73
77
  */
74
78
  allowAdbDebugging?: boolean;
79
+ clipStartInMs?: number | null;
80
+ clipEndInMs?: number | null;
81
+ clipped?: boolean | null;
82
+ clipMarkerColor?: string | null;
75
83
  }
76
84
 
77
85
  /**
@@ -111,6 +119,10 @@ export type OfflineEmbedInfo = {
111
119
  * Not supported in iOS
112
120
  */
113
121
  allowAdbDebugging?: boolean;
122
+ clipStartInMs?: number | null;
123
+ clipEndInMs?: number | null;
124
+ clipped?: boolean | null;
125
+ clipMarkerColor?: string | null;
114
126
  }
115
127
 
116
128
  export type OfflineOptionParams = {
@@ -232,6 +244,10 @@ export const VdoPropTypes = {
232
244
  customPlayerId: PropTypes.string,
233
245
  resumeTimeMs: PropTypes.number,
234
246
  allowAdbDebugging: PropTypes.bool,
247
+ clipStartInMs: PropTypes.number,
248
+ clipEndInMs: PropTypes.number,
249
+ clipped: PropTypes.bool,
250
+ clipMarkerColor: PropTypes.string,
235
251
  }),
236
252
  PropTypes.shape({
237
253
  token: PropTypes.string.isRequired,
@@ -245,6 +261,11 @@ export const VdoPropTypes = {
245
261
  customPlayerId: PropTypes.string,
246
262
  resumeTimeMs: PropTypes.number,
247
263
  allowAdbDebugging: PropTypes.bool,
264
+ clipStartInMs: PropTypes.number,
265
+ clipEndInMs: PropTypes.number,
266
+ clipped: PropTypes.bool,
267
+ clipMarkerColor: PropTypes.string,
268
+
248
269
  }),
249
270
  PropTypes.shape({
250
271
  mediaUrl: PropTypes.string.isRequired,
@@ -267,6 +288,10 @@ export const VdoPropTypes = {
267
288
  playerConfig: PropTypes.string,
268
289
  resumeTimeMs: PropTypes.number,
269
290
  allowAdbDebugging: PropTypes.bool,
291
+ clipStartInMs: PropTypes.number,
292
+ clipEndInMs: PropTypes.number,
293
+ clipped: PropTypes.bool,
294
+ clipMarkerColor: PropTypes.string,
270
295
  })
271
296
  ]).isRequired,
272
297
  style: PropTypes.shape({