@react-native-video/drm 7.0.0-beta.8 → 7.0.0-rc.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.
Files changed (28) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +16 -12
  3. package/android/build.gradle +10 -1
  4. package/android/src/main/java/com/twg/videodrm/PluginManager.kt +2 -0
  5. package/lib/typescript/src/PluginManager.nitro.d.ts.map +1 -1
  6. package/nitro.json +8 -2
  7. package/nitrogen/generated/android/ReactNativeVideoDrm+autolinking.cmake +2 -2
  8. package/nitrogen/generated/android/ReactNativeVideoDrm+autolinking.gradle +2 -2
  9. package/nitrogen/generated/android/ReactNativeVideoDrmOnLoad.cpp +28 -18
  10. package/nitrogen/generated/android/ReactNativeVideoDrmOnLoad.hpp +15 -6
  11. package/nitrogen/generated/android/c++/JHybridPluginManagerSpec.cpp +24 -23
  12. package/nitrogen/generated/android/c++/JHybridPluginManagerSpec.hpp +21 -23
  13. package/nitrogen/generated/android/kotlin/com/margelo/nitro/videodrm/HybridPluginManagerSpec.kt +19 -20
  14. package/nitrogen/generated/android/kotlin/com/margelo/nitro/videodrm/ReactNativeVideoDrmOnLoad.kt +2 -2
  15. package/nitrogen/generated/ios/ReactNativeVideoDrm+autolinking.rb +5 -3
  16. package/nitrogen/generated/ios/ReactNativeVideoDrm-Swift-Cxx-Bridge.cpp +2 -2
  17. package/nitrogen/generated/ios/ReactNativeVideoDrm-Swift-Cxx-Bridge.hpp +2 -2
  18. package/nitrogen/generated/ios/ReactNativeVideoDrm-Swift-Cxx-Umbrella.hpp +2 -2
  19. package/nitrogen/generated/ios/ReactNativeVideoDrmAutolinking.mm +2 -2
  20. package/nitrogen/generated/ios/ReactNativeVideoDrmAutolinking.swift +6 -9
  21. package/nitrogen/generated/ios/c++/HybridPluginManagerSpecSwift.cpp +2 -2
  22. package/nitrogen/generated/ios/c++/HybridPluginManagerSpecSwift.hpp +8 -2
  23. package/nitrogen/generated/ios/swift/HybridPluginManagerSpec.swift +4 -5
  24. package/nitrogen/generated/ios/swift/HybridPluginManagerSpec_cxx.swift +12 -5
  25. package/nitrogen/generated/shared/c++/HybridPluginManagerSpec.cpp +2 -2
  26. package/nitrogen/generated/shared/c++/HybridPluginManagerSpec.hpp +2 -2
  27. package/package.json +15 -12
  28. package/src/PluginManager.nitro.ts +4 -2
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024-2025 TheWidlarzGroup
3
+ Copyright (c) 2024-present TheWidlarzGroup
4
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  of this software and associated documentation files (the "Software"), to deal
6
6
  in the Software without restriction, including without limitation the rights
package/README.md CHANGED
@@ -1,20 +1,22 @@
1
1
  # @react-native-video/drm
2
2
 
3
- DRM plugin for react-native-video. It adds Widevine (Android) and FairPlay (iOS, visionOS) playback support via the react-native-video plugin system.
3
+ DRM plugin for react-native-video. It adds Widevine (Android) and FairPlay (iOS) playback support via the react-native-video plugin system.
4
4
 
5
5
  ## Requirements
6
6
 
7
7
  - react-native-video >= 7.0.0-alpha.3
8
- - react-native-nitro-modules >= 0.27.2
8
+ - react-native-nitro-modules >= 0.37.2
9
9
 
10
10
  ## Installation
11
11
 
12
12
  ```sh
13
- npm install @react-native-video/drm react-native-video react-native-nitro-modules
13
+ npm install @react-native-video/drm@beta react-native-video@beta react-native-nitro-modules
14
14
  # then for iOS
15
15
  npx pod-install
16
16
  ```
17
17
 
18
+ Use the `@beta` tag for both packages while v7 is in beta: `latest` of `react-native-video` is still v6, and `latest` of this plugin still points to an old beta (7.0.0-beta.7), which does not build with the Nitro Modules version that `react-native-video` v7 needs.
19
+
18
20
  Notes
19
21
  - This library uses Nitro Modules; autolinking is supported. No manual native changes are needed besides running CocoaPods on iOS.
20
22
  - On Expo, use a prebuild workflow (npx expo prebuild) — pure managed apps aren’t supported.
@@ -38,7 +40,7 @@ export default function Player() {
38
40
  // Request headers used by the media request and (on iOS default flow) the license request
39
41
  headers: { Authorization: 'Bearer <token>' },
40
42
  drm: {
41
- // Optional: defaults to platform (fairplay on Apple, widevine on Android)
43
+ // Optional: defaults to platform (fairplay on iOS, widevine on Android)
42
44
  type: Platform.select({ ios: 'fairplay', default: 'widevine' }),
43
45
 
44
46
  // Android (Widevine)
@@ -51,6 +53,8 @@ export default function Player() {
51
53
  // When contentId is not provided, the plugin tries to infer it from the skd:// key URL.
52
54
  certificateUrl: Platform.OS === 'ios' ? 'https://license.example.com/fps.cer' : undefined,
53
55
  },
56
+ }, (_player) => {
57
+ _player.play();
54
58
  });
55
59
 
56
60
  return <VideoView player={player} style={{ flex: 1 }} />;
@@ -63,21 +67,21 @@ From `@react-native-video/drm`:
63
67
 
64
68
  - `enable(): void` — registers the plugin. Call once during app startup (Android requires it; iOS tries to auto-enable, but calling is safe).
65
69
  - `disable(): void` — unregisters the plugin.
66
- - `isEnabled: boolean` — plugin registration status.
70
+ - `isEnabled: boolean` — whether the plugin was registered when the package was imported: `true` on iOS, where it enables itself, and `false` on Android. It does not change after `enable()` or `disable()`.
67
71
 
68
72
  DRM params (provided via `useVideoPlayer({ drm: ... })` or equivalent config in react-native-video):
69
73
 
70
- - `type?: 'widevine' | 'fairplay' | string` — DRM system. Defaults: Android → widevine, Apple → fairplay.
71
- - `licenseUrl?: string` — license server URL. Required for both Widevine and FairPlay default flows.
74
+ - `type?: 'widevine' | 'fairplay' | string` — DRM system. Defaults: Android → widevine, iOS → fairplay.
75
+ - `licenseUrl?: string` — license server URL. iOS: required, also with `getLicense`. Android: required unless the stream carries the license address.
72
76
  - `licenseHeaders?: Record<string, string>` — headers for license requests (Android only).
73
77
  - `multiSession?: boolean` — allow multiple sessions (Android only).
74
- - `certificateUrl?: string` — FairPlay application certificate URL (iOS/visionOS).
75
- - `contentId?: string` — FairPlay content ID (iOS/visionOS). If omitted, inferred from `skd://` key URL when possible.
78
+ - `certificateUrl?: string` — FairPlay application certificate URL (iOS). Required for FairPlay.
79
+ - `contentId?: string` — FairPlay content ID (iOS). If omitted, inferred from `skd://` key URL when possible.
76
80
  - `getLicense?: (payload) => Promise<string>` — iOS custom license fetch. Receives `{ contentId, licenseUrl, keyUrl, spc }` and must resolve to a base64-encoded CKC.
77
81
 
78
82
  ## Platform notes
79
83
 
80
- - iOS/visionOS
84
+ - iOS
81
85
  - FairPlay is not supported on the simulator — test on a real device.
82
86
  - Default license flow posts SPC bytes to `licenseUrl` and uses `source.headers` (not `licenseHeaders`). Use `getLicense` for full control.
83
87
  - Provide `certificateUrl`; set `contentId` if your server needs it.
@@ -86,8 +90,8 @@ DRM params (provided via `useVideoPlayer({ drm: ... })` or equivalent config in
86
90
 
87
91
  ## Troubleshooting
88
92
 
89
- - “Failed to fetch certificate/license” — verify URLs are reachable and correct, and that headers/tokens are included. On iOS default flow, set headers in `source.headers`.
90
- - “Unsupported DRM type” — set `drm.type` appropriately or omit it to use platform defaults.
93
+ - “Failed to fetch certificate” or “License request failed with status code …” (iOS) — verify URLs are reachable and correct, and that headers/tokens are included. On iOS default flow, set headers in `source.headers`.
94
+ - “Failed to create content key request for DRM” in the device log (iOS) or “DRM UUID is not set” (Android) — set `drm.type` appropriately or omit it to use platform defaults.
91
95
  - “DRM not working on simulator” — FairPlay does not work on the iOS simulator.
92
96
 
93
97
  ## License
@@ -21,7 +21,16 @@ def reactNativeArchitectures() {
21
21
  }
22
22
 
23
23
  apply plugin: "com.android.library"
24
- apply plugin: "kotlin-android"
24
+ // AGP 9 ships built-in Kotlin support and registers the `kotlin` extension
25
+ // itself. Applying the Kotlin plugin on top of it fails configuration with
26
+ // "Cannot add extension with name 'kotlin'". Asking for the extension covers
27
+ // every way built-in Kotlin can be turned on -- the global default, the
28
+ // android.builtInKotlin property, and the per-module com.android.built-in-kotlin
29
+ // plugin -- without reading an AGP version number.
30
+ if (project.extensions.findByName('kotlin') == null) {
31
+ apply plugin: "kotlin-android"
32
+ }
33
+
25
34
  apply from: '../nitrogen/generated/android/ReactNativeVideoDrm+autolinking.gradle'
26
35
 
27
36
  apply plugin: "com.facebook.react"
@@ -49,5 +49,7 @@ class PluginManager : HybridPluginManagerSpec() {
49
49
  destroyPlugin()
50
50
  } catch (_: Exception) { }
51
51
  }
52
+ // Nitro (>= 0.35.7) frees the C++ part here; required by @CallSuper.
53
+ super.dispose()
52
54
  }
53
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PluginManager.nitro.d.ts","sourceRoot":"","sources":["../../../src/PluginManager.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,aACf,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;IACzD,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B"}
1
+ {"version":3,"file":"PluginManager.nitro.d.ts","sourceRoot":"","sources":["../../../src/PluginManager.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,aAAc,SAAQ,YAAY,CAAC;IAClD,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;IACA,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B"}
package/nitro.json CHANGED
@@ -9,8 +9,14 @@
9
9
  },
10
10
  "autolinking": {
11
11
  "PluginManager": {
12
- "swift": "PluginManager",
13
- "kotlin": "PluginManager"
12
+ "ios": {
13
+ "language": "swift",
14
+ "implementationClassName": "PluginManager"
15
+ },
16
+ "android": {
17
+ "language": "kotlin",
18
+ "implementationClassName": "PluginManager"
19
+ }
14
20
  }
15
21
  },
16
22
  "ignorePaths": ["node_modules"]
@@ -1,8 +1,8 @@
1
1
  #
2
2
  # ReactNativeVideoDrm+autolinking.cmake
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- # https://github.com/mrousavy/nitro
5
- # Copyright © 2025 Marc Rousavy @ Margelo
4
+ # https://github.com/margelo/nitro
5
+ # Copyright © Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a CMake file that adds all files generated by Nitrogen
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// ReactNativeVideoDrm+autolinking.gradle
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  /// This is a Gradle file that adds all files generated by Nitrogen
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// ReactNativeVideoDrmOnLoad.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #ifndef BUILDING_REACTNATIVEVIDEODRM_WITH_GENERATED_CMAKE_PROJECT
@@ -21,24 +21,34 @@
21
21
  namespace margelo::nitro::videodrm {
22
22
 
23
23
  int initialize(JavaVM* vm) {
24
+ return facebook::jni::initialize(vm, []() {
25
+ ::margelo::nitro::videodrm::registerAllNatives();
26
+ });
27
+ }
28
+
29
+ struct JHybridPluginManagerSpecImpl: public jni::JavaClass<JHybridPluginManagerSpecImpl, JHybridPluginManagerSpec::JavaPart> {
30
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/videodrm/PluginManager;";
31
+ static std::shared_ptr<JHybridPluginManagerSpec> create() {
32
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridPluginManagerSpecImpl::javaobject()>();
33
+ jni::local_ref<JHybridPluginManagerSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
34
+ return javaPart->getJHybridPluginManagerSpec();
35
+ }
36
+ };
37
+
38
+ void registerAllNatives() {
24
39
  using namespace margelo::nitro;
25
40
  using namespace margelo::nitro::videodrm;
26
- using namespace facebook;
27
-
28
- return facebook::jni::initialize(vm, [] {
29
- // Register native JNI methods
30
- margelo::nitro::videodrm::JHybridPluginManagerSpec::registerNatives();
31
-
32
- // Register Nitro Hybrid Objects
33
- HybridObjectRegistry::registerHybridObjectConstructor(
34
- "PluginManager",
35
- []() -> std::shared_ptr<HybridObject> {
36
- static DefaultConstructableObject<JHybridPluginManagerSpec::javaobject> object("com/margelo/nitro/videodrm/PluginManager");
37
- auto instance = object.create();
38
- return instance->cthis()->shared();
39
- }
40
- );
41
- });
41
+
42
+ // Register native JNI methods
43
+ margelo::nitro::videodrm::JHybridPluginManagerSpec::CxxPart::registerNatives();
44
+
45
+ // Register Nitro Hybrid Objects
46
+ HybridObjectRegistry::registerHybridObjectConstructor(
47
+ "PluginManager",
48
+ []() -> std::shared_ptr<HybridObject> {
49
+ return JHybridPluginManagerSpecImpl::create();
50
+ }
51
+ );
42
52
  }
43
53
 
44
54
  } // namespace margelo::nitro::videodrm
@@ -1,25 +1,34 @@
1
1
  ///
2
2
  /// ReactNativeVideoDrmOnLoad.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include <jni.h>
9
+ #include <functional>
9
10
  #include <NitroModules/NitroDefines.hpp>
10
11
 
11
12
  namespace margelo::nitro::videodrm {
12
13
 
14
+ [[deprecated("Use registerNatives() instead.")]]
15
+ int initialize(JavaVM* vm);
16
+
13
17
  /**
14
- * Initializes the native (C++) part of ReactNativeVideoDrm, and autolinks all Hybrid Objects.
15
- * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
18
+ * Register the native (C++) part of ReactNativeVideoDrm, and autolinks all Hybrid Objects.
19
+ * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
20
+ * inside a `facebook::jni::initialize(vm, ...)` call.
16
21
  * Example:
17
22
  * ```cpp (cpp-adapter.cpp)
18
23
  * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
- * return margelo::nitro::videodrm::initialize(vm);
24
+ * return facebook::jni::initialize(vm, []() {
25
+ * // register all ReactNativeVideoDrm HybridObjects
26
+ * margelo::nitro::videodrm::registerNatives();
27
+ * // any other custom registrations go here.
28
+ * });
20
29
  * }
21
30
  * ```
22
31
  */
23
- int initialize(JavaVM* vm);
32
+ void registerAllNatives();
24
33
 
25
34
  } // namespace margelo::nitro::videodrm
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// JHybridPluginManagerSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "JHybridPluginManagerSpec.hpp"
@@ -13,46 +13,47 @@
13
13
 
14
14
  namespace margelo::nitro::videodrm {
15
15
 
16
- jni::local_ref<JHybridPluginManagerSpec::jhybriddata> JHybridPluginManagerSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
17
- return makeCxxInstance(jThis);
18
- }
19
-
20
- void JHybridPluginManagerSpec::registerNatives() {
21
- registerHybrid({
22
- makeNativeMethod("initHybrid", JHybridPluginManagerSpec::initHybrid),
23
- });
16
+ std::shared_ptr<JHybridPluginManagerSpec> JHybridPluginManagerSpec::JavaPart::getJHybridPluginManagerSpec() {
17
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
18
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridPluginManagerSpec>(hybridObject);
19
+ if (castHybridObject == nullptr) [[unlikely]] {
20
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridPluginManagerSpec!");
21
+ }
22
+ return castHybridObject;
24
23
  }
25
24
 
26
- size_t JHybridPluginManagerSpec::getExternalMemorySize() noexcept {
27
- static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
28
- return method(_javaPart);
25
+ jni::local_ref<JHybridPluginManagerSpec::CxxPart::jhybriddata> JHybridPluginManagerSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
26
+ return makeCxxInstance(jThis);
29
27
  }
30
28
 
31
- void JHybridPluginManagerSpec::dispose() noexcept {
32
- static const auto method = javaClassStatic()->getMethod<void()>("dispose");
33
- method(_javaPart);
29
+ std::shared_ptr<JHybridObject> JHybridPluginManagerSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
30
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridPluginManagerSpec::JavaPart>(javaPart);
31
+ if (castJavaPart == nullptr) [[unlikely]] {
32
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridPluginManagerSpec::JavaPart!");
33
+ }
34
+ return std::make_shared<JHybridPluginManagerSpec>(castJavaPart);
34
35
  }
35
36
 
36
- std::string JHybridPluginManagerSpec::toString() {
37
- static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
38
- auto javaString = method(_javaPart);
39
- return javaString->toStdString();
37
+ void JHybridPluginManagerSpec::CxxPart::registerNatives() {
38
+ registerHybrid({
39
+ makeNativeMethod("initHybrid", JHybridPluginManagerSpec::CxxPart::initHybrid),
40
+ });
40
41
  }
41
42
 
42
43
  // Properties
43
44
  bool JHybridPluginManagerSpec::getIsEnabled() {
44
- static const auto method = javaClassStatic()->getMethod<jboolean()>("isEnabled");
45
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("isEnabled");
45
46
  auto __result = method(_javaPart);
46
47
  return static_cast<bool>(__result);
47
48
  }
48
49
 
49
50
  // Methods
50
51
  void JHybridPluginManagerSpec::enable() {
51
- static const auto method = javaClassStatic()->getMethod<void()>("enable");
52
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("enable");
52
53
  method(_javaPart);
53
54
  }
54
55
  void JHybridPluginManagerSpec::disable() {
55
- static const auto method = javaClassStatic()->getMethod<void()>("disable");
56
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("disable");
56
57
  method(_javaPart);
57
58
  }
58
59
 
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// HybridPluginManagerSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -18,33 +18,33 @@ namespace margelo::nitro::videodrm {
18
18
 
19
19
  using namespace facebook;
20
20
 
21
- class JHybridPluginManagerSpec: public jni::HybridClass<JHybridPluginManagerSpec, JHybridObject>,
22
- public virtual HybridPluginManagerSpec {
21
+ class JHybridPluginManagerSpec: public virtual HybridPluginManagerSpec, public virtual JHybridObject {
23
22
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/videodrm/HybridPluginManagerSpec;";
25
- static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
26
- static void registerNatives();
27
-
28
- protected:
29
- // C++ constructor (called from Java via `initHybrid()`)
30
- explicit JHybridPluginManagerSpec(jni::alias_ref<jhybridobject> jThis) :
31
- HybridObject(HybridPluginManagerSpec::TAG),
32
- HybridBase(jThis),
33
- _javaPart(jni::make_global(jThis)) {}
23
+ struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/videodrm/HybridPluginManagerSpec;";
25
+ std::shared_ptr<JHybridPluginManagerSpec> getJHybridPluginManagerSpec();
26
+ };
27
+ struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
28
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/videodrm/HybridPluginManagerSpec$CxxPart;";
29
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
30
+ static void registerNatives();
31
+ using HybridBase::HybridBase;
32
+ protected:
33
+ std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
34
+ };
34
35
 
35
36
  public:
37
+ explicit JHybridPluginManagerSpec(const jni::local_ref<JHybridPluginManagerSpec::JavaPart>& javaPart):
38
+ HybridObject(HybridPluginManagerSpec::TAG),
39
+ JHybridObject(javaPart),
40
+ _javaPart(jni::make_global(javaPart)) {}
36
41
  ~JHybridPluginManagerSpec() override {
37
42
  // Hermes GC can destroy JS objects on a non-JNI Thread.
38
43
  jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
39
44
  }
40
45
 
41
46
  public:
42
- size_t getExternalMemorySize() noexcept override;
43
- void dispose() noexcept override;
44
- std::string toString() override;
45
-
46
- public:
47
- inline const jni::global_ref<JHybridPluginManagerSpec::javaobject>& getJavaPart() const noexcept {
47
+ inline const jni::global_ref<JHybridPluginManagerSpec::JavaPart>& getJavaPart() const noexcept {
48
48
  return _javaPart;
49
49
  }
50
50
 
@@ -58,9 +58,7 @@ namespace margelo::nitro::videodrm {
58
58
  void disable() override;
59
59
 
60
60
  private:
61
- friend HybridBase;
62
- using HybridBase::HybridBase;
63
- jni::global_ref<JHybridPluginManagerSpec::javaobject> _javaPart;
61
+ jni::global_ref<JHybridPluginManagerSpec::JavaPart> _javaPart;
64
62
  };
65
63
 
66
64
  } // namespace margelo::nitro::videodrm
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// HybridPluginManagerSpec.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.videodrm
@@ -10,6 +10,7 @@ package com.margelo.nitro.videodrm
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
13
14
  import com.margelo.nitro.core.HybridObject
14
15
 
15
16
  /**
@@ -24,23 +25,6 @@ import com.margelo.nitro.core.HybridObject
24
25
  "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
26
  )
26
27
  abstract class HybridPluginManagerSpec: HybridObject() {
27
- @DoNotStrip
28
- private var mHybridData: HybridData = initHybrid()
29
-
30
- init {
31
- super.updateNative(mHybridData)
32
- }
33
-
34
- override fun updateNative(hybridData: HybridData) {
35
- mHybridData = hybridData
36
- super.updateNative(hybridData)
37
- }
38
-
39
- // Default implementation of `HybridObject.toString()`
40
- override fun toString(): String {
41
- return "[HybridObject PluginManager]"
42
- }
43
-
44
28
  // Properties
45
29
  @get:DoNotStrip
46
30
  @get:Keep
@@ -55,7 +39,22 @@ abstract class HybridPluginManagerSpec: HybridObject() {
55
39
  @Keep
56
40
  abstract fun disable(): Unit
57
41
 
58
- private external fun initHybrid(): HybridData
42
+ // Default implementation of `HybridObject.toString()`
43
+ override fun toString(): String {
44
+ return "[HybridObject PluginManager]"
45
+ }
46
+
47
+ // C++ backing class
48
+ @DoNotStrip
49
+ @Keep
50
+ protected open class CxxPart(javaPart: HybridPluginManagerSpec): HybridObject.CxxPart(javaPart) {
51
+ // C++ JHybridPluginManagerSpec::CxxPart::initHybrid(...)
52
+ @FastNative
53
+ external override fun initHybrid(): HybridData
54
+ }
55
+ override fun createCxxPart(): CxxPart {
56
+ return CxxPart(this)
57
+ }
59
58
 
60
59
  companion object {
61
60
  protected const val TAG = "HybridPluginManagerSpec"
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// ReactNativeVideoDrmOnLoad.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.videodrm
@@ -1,8 +1,8 @@
1
1
  #
2
2
  # ReactNativeVideoDrm+autolinking.rb
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- # https://github.com/mrousavy/nitro
5
- # Copyright © 2025 Marc Rousavy @ Margelo
4
+ # https://github.com/margelo/nitro
5
+ # Copyright © Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a Ruby script that adds all files generated by Nitrogen
@@ -52,9 +52,11 @@ def add_nitrogen_files(spec)
52
52
  spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
53
  # Use C++ 20
54
54
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
- # Enables C++ <-> Swift interop (by default it's only C)
55
+ # Enables C++ <-> Swift interop (by default it's only ObjC)
56
56
  "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
57
  # Enables stricter modular headers
58
58
  "DEFINES_MODULE" => "YES",
59
+ # Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
60
+ "SWIFT_INSTALL_OBJC_HEADER" => "NO",
59
61
  })
60
62
  end
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// ReactNativeVideoDrm-Swift-Cxx-Bridge.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "ReactNativeVideoDrm-Swift-Cxx-Bridge.hpp"
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// ReactNativeVideoDrm-Swift-Cxx-Bridge.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// ReactNativeVideoDrm-Swift-Cxx-Umbrella.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// ReactNativeVideoDrmAutolinking.mm
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #import <Foundation/Foundation.h>
@@ -1,20 +1,17 @@
1
1
  ///
2
2
  /// ReactNativeVideoDrmAutolinking.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
+ import NitroModules
9
+
10
+ // TODO: Use empty enums once Swift supports exporting them as namespaces
11
+ // See: https://github.com/swiftlang/swift/pull/83616
8
12
  public final class ReactNativeVideoDrmAutolinking {
9
13
  public typealias bridge = margelo.nitro.videodrm.bridge.swift
10
14
 
11
- /**
12
- * Creates an instance of a Swift class that implements `HybridPluginManagerSpec`,
13
- * and wraps it in a Swift class that can directly interop with C++ (`HybridPluginManagerSpec_cxx`)
14
- *
15
- * This is generated by Nitrogen and will initialize the class specified
16
- * in the `"autolinking"` property of `nitro.json` (in this case, `PluginManager`).
17
- */
18
15
  public static func createPluginManager() -> bridge.std__shared_ptr_HybridPluginManagerSpec_ {
19
16
  let hybridObject = PluginManager()
20
17
  return { () -> bridge.std__shared_ptr_HybridPluginManagerSpec_ in
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// HybridPluginManagerSpecSwift.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridPluginManagerSpecSwift.hpp"
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// HybridPluginManagerSpecSwift.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -47,6 +47,12 @@ namespace margelo::nitro::videodrm {
47
47
  inline size_t getExternalMemorySize() noexcept override {
48
48
  return _swiftPart.getMemorySize();
49
49
  }
50
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
51
+ if (auto otherCast = std::dynamic_pointer_cast<HybridPluginManagerSpecSwift>(other)) {
52
+ return _swiftPart.equals(otherCast->_swiftPart);
53
+ }
54
+ return false;
55
+ }
50
56
  void dispose() noexcept override {
51
57
  _swiftPart.dispose();
52
58
  }
@@ -1,11 +1,10 @@
1
1
  ///
2
2
  /// HybridPluginManagerSpec.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- import Foundation
9
8
  import NitroModules
10
9
 
11
10
  /// See ``HybridPluginManagerSpec``
@@ -31,14 +30,14 @@ open class HybridPluginManagerSpec_base {
31
30
  public init() { }
32
31
  public func getCxxWrapper() -> HybridPluginManagerSpec_cxx {
33
32
  #if DEBUG
34
- guard self is HybridPluginManagerSpec else {
33
+ guard self is any HybridPluginManagerSpec else {
35
34
  fatalError("`self` is not a `HybridPluginManagerSpec`! Did you accidentally inherit from `HybridPluginManagerSpec_base` instead of `HybridPluginManagerSpec`?")
36
35
  }
37
36
  #endif
38
37
  if let cxxWrapper = self.cxxWrapper {
39
38
  return cxxWrapper
40
39
  } else {
41
- let cxxWrapper = HybridPluginManagerSpec_cxx(self as! HybridPluginManagerSpec)
40
+ let cxxWrapper = HybridPluginManagerSpec_cxx(self as! any HybridPluginManagerSpec)
42
41
  self.cxxWrapper = cxxWrapper
43
42
  return cxxWrapper
44
43
  }
@@ -1,11 +1,10 @@
1
1
  ///
2
2
  /// HybridPluginManagerSpec_cxx.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- import Foundation
9
8
  import NitroModules
10
9
 
11
10
  /**
@@ -28,7 +27,7 @@ open class HybridPluginManagerSpec_cxx {
28
27
  /**
29
28
  * Holds an instance of the `HybridPluginManagerSpec` Swift protocol.
30
29
  */
31
- private var __implementation: any HybridPluginManagerSpec
30
+ private let __implementation: any HybridPluginManagerSpec
32
31
 
33
32
  /**
34
33
  * Holds a weak pointer to the C++ class that wraps the Swift class.
@@ -76,7 +75,7 @@ open class HybridPluginManagerSpec_cxx {
76
75
  */
77
76
  public func getCxxPart() -> bridge.std__shared_ptr_HybridPluginManagerSpec_ {
78
77
  let cachedCxxPart = self.__cxxPart.lock()
79
- if Bool(fromCxx: cachedCxxPart) {
78
+ if cachedCxxPart.use_count() > 0 {
80
79
  return cachedCxxPart
81
80
  } else {
82
81
  let newCxxPart = bridge.create_std__shared_ptr_HybridPluginManagerSpec_(self.toUnsafe())
@@ -96,6 +95,14 @@ open class HybridPluginManagerSpec_cxx {
96
95
  return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
97
96
  }
98
97
 
98
+ /**
99
+ * Compares this object with the given [other] object for reference equality.
100
+ */
101
+ @inline(__always)
102
+ public func equals(other: HybridPluginManagerSpec_cxx) -> Bool {
103
+ return self.__implementation === other.__implementation
104
+ }
105
+
99
106
  /**
100
107
  * Call dispose() on the Swift class.
101
108
  * This _may_ be called manually from JS.
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// HybridPluginManagerSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridPluginManagerSpec.hpp"
@@ -1,8 +1,8 @@
1
1
  ///
2
2
  /// HybridPluginManagerSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-video/drm",
3
- "version": "7.0.0-beta.8",
3
+ "version": "7.0.0-rc.0",
4
4
  "description": "DRM plugin for react-native-video",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "prepare": "bun run build",
42
42
  "build": "bob build",
43
43
  "specs": "nitrogen",
44
- "release": "release-it --preRelease beta --npm.tag=beta"
44
+ "release": "release-it --preRelease rc --npm.tag=next"
45
45
  },
46
46
  "keywords": [
47
47
  "react-native",
@@ -66,27 +66,25 @@
66
66
  },
67
67
  "devDependencies": {
68
68
  "@react-native/babel-preset": "0.79.2",
69
- "@release-it/conventional-changelog": "^9.0.2",
70
- "@types/react": "^18.3.0",
69
+ "@types/react": "^19.2.0",
71
70
  "del-cli": "^5.1.0",
72
71
  "eslint": "^8.51.0",
73
72
  "eslint-config-prettier": "9.0.0",
74
73
  "eslint-plugin-prettier": "^5.0.1",
75
- "nitrogen": "^0.31.0",
74
+ "nitrogen": "0.37.2",
76
75
  "prettier": "^3.0.3",
77
- "react": "18.3.1",
78
- "react-native": "^0.77.0",
76
+ "react": "19.2.3",
77
+ "react-native": "^0.84.0",
79
78
  "react-native-builder-bob": "^0.40.13",
80
- "react-native-nitro-modules": "^0.31.0",
81
- "release-it": "^17.10.0",
79
+ "react-native-nitro-modules": "0.37.2",
82
80
  "typescript": "^5.8.3",
83
81
  "react-native-video": "*"
84
82
  },
85
83
  "peerDependencies": {
86
84
  "react": "*",
87
- "react-native": "*",
85
+ "react-native": ">=0.84.0",
88
86
  "react-native-video": ">=7.0.0-alpha.3",
89
- "react-native-nitro-modules": ">=0.27.2"
87
+ "react-native-nitro-modules": ">=0.37.2"
90
88
  },
91
89
  "jest": {
92
90
  "preset": "react-native",
@@ -96,7 +94,12 @@
96
94
  ]
97
95
  },
98
96
  "release-it": {
99
- "git": false,
97
+ "git": {
98
+ "commit": false,
99
+ "tag": false,
100
+ "push": false,
101
+ "requireUpstream": false
102
+ },
100
103
  "npm": {
101
104
  "publish": true,
102
105
  "publishArgs": "--access public"
@@ -1,7 +1,9 @@
1
1
  import type { HybridObject } from 'react-native-nitro-modules';
2
2
 
3
- export interface PluginManager
4
- extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
3
+ export interface PluginManager extends HybridObject<{
4
+ ios: 'swift';
5
+ android: 'kotlin';
6
+ }> {
5
7
  enable(): void;
6
8
  disable(): void;
7
9
  readonly isEnabled: boolean;