bitmovin-player-react-native 1.0.0-alpha.1 → 1.0.0-alpha.3

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 (38) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/android/ktlint.gradle +1 -1
  3. package/android/src/main/java/com/bitmovin/player/reactnative/PlayerModule.kt +47 -52
  4. package/android/src/main/java/com/bitmovin/player/reactnative/PlayerRegistry.kt +78 -0
  5. package/app.plugin.js +6 -6
  6. package/build/components/PlayerView/index.d.ts +1 -1
  7. package/build/components/PlayerView/index.d.ts.map +1 -1
  8. package/build/components/PlayerView/index.js +6 -3
  9. package/build/components/PlayerView/index.js.map +1 -1
  10. package/build/nativeInstance.d.ts.map +1 -1
  11. package/build/nativeInstance.js +2 -3
  12. package/build/nativeInstance.js.map +1 -1
  13. package/build/ui/custommessagehandlerbridge.js +2 -2
  14. package/build/ui/custommessagehandlerbridge.js.map +1 -1
  15. package/build/ui/fullscreenhandlerbridge.js +2 -2
  16. package/build/ui/fullscreenhandlerbridge.js.map +1 -1
  17. package/expo-module.config.json +0 -2
  18. package/ios/AppLifecycleDelegate.swift +4 -1
  19. package/ios/PlayerModule.swift +99 -94
  20. package/ios/PlayerRegistry.swift +88 -0
  21. package/ios/RNBitmovinPlayer.podspec +2 -2
  22. package/package.json +4 -1
  23. package/plugin/build/withBitmovinIosConfig.js +25 -20
  24. package/plugin/src/withBitmovinIosConfig.ts +27 -21
  25. package/scripts/check-dependencies.js +26 -0
  26. package/scripts/setup-hooks.sh +1 -1
  27. package/src/components/PlayerView/index.tsx +86 -84
  28. package/src/nativeInstance.ts +2 -4
  29. package/src/ui/custommessagehandlerbridge.ts +2 -2
  30. package/src/ui/fullscreenhandlerbridge.ts +2 -2
  31. package/TODO.md +0 -0
  32. package/android/src/main/java/com/bitmovin/player/reactnative/UuidModule.kt +0 -18
  33. package/build/modules/UuidModule.d.ts +0 -8
  34. package/build/modules/UuidModule.d.ts.map +0 -1
  35. package/build/modules/UuidModule.js +0 -3
  36. package/build/modules/UuidModule.js.map +0 -1
  37. package/ios/UuidModule.swift +0 -15
  38. package/src/modules/UuidModule.ts +0 -9
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Check for required app-level dependencies and fail installation if they're missing.
5
+ * This elevates peer dependency warnings to hard errors.
6
+ */
7
+
8
+ // Fail install if required app-level deps are missing
9
+ const required = ['expo', 'expo-crypto'];
10
+ const has = (name) => {
11
+ try {
12
+ require.resolve(`${name}/package.json`, { paths: [process.cwd()] });
13
+ return true;
14
+ }
15
+ catch {
16
+ return false;
17
+ }
18
+ };
19
+ const missing = required.filter((r) => !has(r));
20
+ if (missing.length) {
21
+ console.error(
22
+ `\n[bitmovin-player-react-native] Missing required deps in your app: ${missing.join(', ')}\n` +
23
+ `Install: npx expo install ${missing.join(' ')}\n`
24
+ );
25
+ process.exit(1);
26
+ }
@@ -55,4 +55,4 @@ echo " - Auto-format Kotlin files with ktlint, then run ktlint"
55
55
  echo " - Auto-format files with Prettier"
56
56
  echo ""
57
57
  echo "To test all linting manually, run: yarn lint:all"
58
- echo "To bypass the hook temporarily, commit with: git commit --no-verify"
58
+ echo "To bypass the hook temporarily, commit with: git commit --no-verify"
@@ -93,93 +93,95 @@ export function PlayerView({
93
93
  }, [player, fullscreenBridge, customMessageHandlerBridge]);
94
94
 
95
95
  useEffect(() => {
96
- if (viewRef) {
96
+ if (isPlayerInitialized && viewRef) {
97
97
  viewRef.current = nativeView.current;
98
98
  }
99
- }, [viewRef, nativeView]);
99
+ }, [isPlayerInitialized, viewRef, nativeView]);
100
+
101
+ if (!isPlayerInitialized) {
102
+ return null;
103
+ }
100
104
 
101
105
  return (
102
- isPlayerInitialized && (
103
- <NativePlayerView
104
- ref={nativeView}
105
- style={nativeViewStyle}
106
- config={nativePlayerViewConfig}
107
- isFullscreenRequested={isFullscreenRequested}
108
- isPictureInPictureRequested={isPictureInPictureRequested}
109
- scalingMode={scalingMode}
110
- fullscreenBridgeId={fullscreenBridge.current?.nativeId}
111
- onBmpAdBreakFinished={proxy(props.onAdBreakFinished)}
112
- onBmpAdBreakStarted={proxy(props.onAdBreakStarted)}
113
- onBmpAdClicked={proxy(props.onAdClicked)}
114
- onBmpAdError={proxy(props.onAdError)}
115
- onBmpAdFinished={proxy(props.onAdFinished)}
116
- onBmpAdManifestLoad={proxy(props.onAdManifestLoad)}
117
- onBmpAdManifestLoaded={proxy(props.onAdManifestLoaded)}
118
- onBmpAdQuartile={proxy(props.onAdQuartile)}
119
- onBmpAdScheduled={proxy(props.onAdScheduled)}
120
- onBmpAdSkipped={proxy(props.onAdSkipped)}
121
- onBmpAdStarted={proxy(props.onAdStarted)}
122
- onBmpCastAvailable={proxy(props.onCastAvailable)}
123
- onBmpCastPaused={proxy(props.onCastPaused)}
124
- onBmpCastPlaybackFinished={proxy(props.onCastPlaybackFinished)}
125
- onBmpCastPlaying={proxy(props.onCastPlaying)}
126
- onBmpCastStarted={proxy(props.onCastStarted)}
127
- onBmpCastStart={proxy(props.onCastStart)}
128
- onBmpCastStopped={proxy(props.onCastStopped)}
129
- onBmpCastTimeUpdated={proxy(props.onCastTimeUpdated)}
130
- onBmpCastWaitingForDevice={proxy(props.onCastWaitingForDevice)}
131
- onBmpCueEnter={proxy(props.onCueEnter)}
132
- onBmpCueExit={proxy(props.onCueExit)}
133
- onBmpDestroy={proxy(props.onDestroy)}
134
- onBmpEvent={proxy(props.onEvent)}
135
- onBmpFullscreenEnabled={proxy(props.onFullscreenEnabled)}
136
- onBmpFullscreenDisabled={proxy(props.onFullscreenDisabled)}
137
- onBmpFullscreenEnter={proxy(props.onFullscreenEnter)}
138
- onBmpFullscreenExit={proxy(props.onFullscreenExit)}
139
- onBmpMuted={proxy(props.onMuted)}
140
- onBmpPaused={proxy(props.onPaused)}
141
- onBmpPictureInPictureAvailabilityChanged={proxy(
142
- props.onPictureInPictureAvailabilityChanged
143
- )}
144
- onBmpPictureInPictureEnter={proxy(props.onPictureInPictureEnter)}
145
- onBmpPictureInPictureEntered={proxy(props.onPictureInPictureEntered)}
146
- onBmpPictureInPictureExit={proxy(props.onPictureInPictureExit)}
147
- onBmpPictureInPictureExited={proxy(props.onPictureInPictureExited)}
148
- onBmpPlay={proxy(props.onPlay)}
149
- onBmpPlaybackFinished={proxy(props.onPlaybackFinished)}
150
- onBmpPlaybackSpeedChanged={proxy(props.onPlaybackSpeedChanged)}
151
- onBmpPlayerActive={proxy(props.onPlayerActive)}
152
- onBmpPlayerError={proxy(props.onPlayerError)}
153
- onBmpPlayerWarning={proxy(props.onPlayerWarning)}
154
- onBmpPlaying={proxy(props.onPlaying)}
155
- onBmpReady={proxy(props.onReady)}
156
- onBmpSeek={proxy(props.onSeek)}
157
- onBmpSeeked={proxy(props.onSeeked)}
158
- onBmpTimeShift={proxy(props.onTimeShift)}
159
- onBmpTimeShifted={proxy(props.onTimeShifted)}
160
- onBmpStallStarted={proxy(props.onStallStarted)}
161
- onBmpStallEnded={proxy(props.onStallEnded)}
162
- onBmpSourceError={proxy(props.onSourceError)}
163
- onBmpSourceLoad={proxy(props.onSourceLoad)}
164
- onBmpSourceLoaded={proxy(props.onSourceLoaded)}
165
- onBmpSourceUnloaded={proxy(props.onSourceUnloaded)}
166
- onBmpSourceWarning={proxy(props.onSourceWarning)}
167
- onBmpAudioAdded={proxy(props.onAudioAdded)}
168
- onBmpAudioChanged={proxy(props.onAudioChanged)}
169
- onBmpAudioRemoved={proxy(props.onAudioRemoved)}
170
- onBmpSubtitleAdded={proxy(props.onSubtitleAdded)}
171
- onBmpSubtitleChanged={proxy(props.onSubtitleChanged)}
172
- onBmpSubtitleRemoved={proxy(props.onSubtitleRemoved)}
173
- onBmpTimeChanged={proxy(props.onTimeChanged)}
174
- onBmpUnmuted={proxy(props.onUnmuted)}
175
- onBmpVideoDownloadQualityChanged={proxy(
176
- props.onVideoDownloadQualityChanged
177
- )}
178
- onBmpVideoPlaybackQualityChanged={proxy(
179
- props.onVideoPlaybackQualityChanged
180
- )}
181
- onBmpDownloadFinished={proxy(props.onDownloadFinished)}
182
- />
183
- )
106
+ <NativePlayerView
107
+ ref={nativeView}
108
+ style={nativeViewStyle}
109
+ config={nativePlayerViewConfig}
110
+ isFullscreenRequested={isFullscreenRequested}
111
+ isPictureInPictureRequested={isPictureInPictureRequested}
112
+ scalingMode={scalingMode}
113
+ fullscreenBridgeId={fullscreenBridge.current?.nativeId}
114
+ onBmpAdBreakFinished={proxy(props.onAdBreakFinished)}
115
+ onBmpAdBreakStarted={proxy(props.onAdBreakStarted)}
116
+ onBmpAdClicked={proxy(props.onAdClicked)}
117
+ onBmpAdError={proxy(props.onAdError)}
118
+ onBmpAdFinished={proxy(props.onAdFinished)}
119
+ onBmpAdManifestLoad={proxy(props.onAdManifestLoad)}
120
+ onBmpAdManifestLoaded={proxy(props.onAdManifestLoaded)}
121
+ onBmpAdQuartile={proxy(props.onAdQuartile)}
122
+ onBmpAdScheduled={proxy(props.onAdScheduled)}
123
+ onBmpAdSkipped={proxy(props.onAdSkipped)}
124
+ onBmpAdStarted={proxy(props.onAdStarted)}
125
+ onBmpCastAvailable={proxy(props.onCastAvailable)}
126
+ onBmpCastPaused={proxy(props.onCastPaused)}
127
+ onBmpCastPlaybackFinished={proxy(props.onCastPlaybackFinished)}
128
+ onBmpCastPlaying={proxy(props.onCastPlaying)}
129
+ onBmpCastStarted={proxy(props.onCastStarted)}
130
+ onBmpCastStart={proxy(props.onCastStart)}
131
+ onBmpCastStopped={proxy(props.onCastStopped)}
132
+ onBmpCastTimeUpdated={proxy(props.onCastTimeUpdated)}
133
+ onBmpCastWaitingForDevice={proxy(props.onCastWaitingForDevice)}
134
+ onBmpCueEnter={proxy(props.onCueEnter)}
135
+ onBmpCueExit={proxy(props.onCueExit)}
136
+ onBmpDestroy={proxy(props.onDestroy)}
137
+ onBmpEvent={proxy(props.onEvent)}
138
+ onBmpFullscreenEnabled={proxy(props.onFullscreenEnabled)}
139
+ onBmpFullscreenDisabled={proxy(props.onFullscreenDisabled)}
140
+ onBmpFullscreenEnter={proxy(props.onFullscreenEnter)}
141
+ onBmpFullscreenExit={proxy(props.onFullscreenExit)}
142
+ onBmpMuted={proxy(props.onMuted)}
143
+ onBmpPaused={proxy(props.onPaused)}
144
+ onBmpPictureInPictureAvailabilityChanged={proxy(
145
+ props.onPictureInPictureAvailabilityChanged
146
+ )}
147
+ onBmpPictureInPictureEnter={proxy(props.onPictureInPictureEnter)}
148
+ onBmpPictureInPictureEntered={proxy(props.onPictureInPictureEntered)}
149
+ onBmpPictureInPictureExit={proxy(props.onPictureInPictureExit)}
150
+ onBmpPictureInPictureExited={proxy(props.onPictureInPictureExited)}
151
+ onBmpPlay={proxy(props.onPlay)}
152
+ onBmpPlaybackFinished={proxy(props.onPlaybackFinished)}
153
+ onBmpPlaybackSpeedChanged={proxy(props.onPlaybackSpeedChanged)}
154
+ onBmpPlayerActive={proxy(props.onPlayerActive)}
155
+ onBmpPlayerError={proxy(props.onPlayerError)}
156
+ onBmpPlayerWarning={proxy(props.onPlayerWarning)}
157
+ onBmpPlaying={proxy(props.onPlaying)}
158
+ onBmpReady={proxy(props.onReady)}
159
+ onBmpSeek={proxy(props.onSeek)}
160
+ onBmpSeeked={proxy(props.onSeeked)}
161
+ onBmpTimeShift={proxy(props.onTimeShift)}
162
+ onBmpTimeShifted={proxy(props.onTimeShifted)}
163
+ onBmpStallStarted={proxy(props.onStallStarted)}
164
+ onBmpStallEnded={proxy(props.onStallEnded)}
165
+ onBmpSourceError={proxy(props.onSourceError)}
166
+ onBmpSourceLoad={proxy(props.onSourceLoad)}
167
+ onBmpSourceLoaded={proxy(props.onSourceLoaded)}
168
+ onBmpSourceUnloaded={proxy(props.onSourceUnloaded)}
169
+ onBmpSourceWarning={proxy(props.onSourceWarning)}
170
+ onBmpAudioAdded={proxy(props.onAudioAdded)}
171
+ onBmpAudioChanged={proxy(props.onAudioChanged)}
172
+ onBmpAudioRemoved={proxy(props.onAudioRemoved)}
173
+ onBmpSubtitleAdded={proxy(props.onSubtitleAdded)}
174
+ onBmpSubtitleChanged={proxy(props.onSubtitleChanged)}
175
+ onBmpSubtitleRemoved={proxy(props.onSubtitleRemoved)}
176
+ onBmpTimeChanged={proxy(props.onTimeChanged)}
177
+ onBmpUnmuted={proxy(props.onUnmuted)}
178
+ onBmpVideoDownloadQualityChanged={proxy(
179
+ props.onVideoDownloadQualityChanged
180
+ )}
181
+ onBmpVideoPlaybackQualityChanged={proxy(
182
+ props.onVideoPlaybackQualityChanged
183
+ )}
184
+ onBmpDownloadFinished={proxy(props.onDownloadFinished)}
185
+ />
184
186
  );
185
187
  }
@@ -1,6 +1,4 @@
1
- import UuidModule from './modules/UuidModule';
2
-
3
- const Uuid = UuidModule;
1
+ import * as Crypto from 'expo-crypto';
4
2
 
5
3
  export interface NativeInstanceConfig {
6
4
  /**
@@ -37,7 +35,7 @@ export default abstract class NativeInstance<
37
35
  */
38
36
  constructor(config?: Config) {
39
37
  this.config = config;
40
- this.nativeId = config?.nativeId ?? Uuid.generate();
38
+ this.nativeId = config?.nativeId ?? Crypto.randomUUID();
41
39
  }
42
40
 
43
41
  /**
@@ -1,7 +1,7 @@
1
1
  import { EventSubscription } from 'expo-modules-core';
2
2
  import { CustomMessageHandler } from './custommessagehandler';
3
3
  import { CustomMessageSender } from './custommessagesender';
4
- import UuidModule from '../modules/UuidModule';
4
+ import * as Crypto from 'expo-crypto';
5
5
  import CustomMessageHandlerModule from './customMessageHandlerModule';
6
6
 
7
7
  /**
@@ -16,7 +16,7 @@ export class CustomMessageHandlerBridge implements CustomMessageSender {
16
16
  private onReceivedAsynchronousMessageSubscription?: EventSubscription;
17
17
 
18
18
  constructor(nativeId?: string) {
19
- this.nativeId = nativeId ?? UuidModule.generate();
19
+ this.nativeId = nativeId ?? Crypto.randomUUID();
20
20
  this.isDestroyed = false;
21
21
 
22
22
  // Set up event listeners for synchronous and asynchronous messages
@@ -1,6 +1,6 @@
1
1
  import { EventSubscription } from 'expo-modules-core';
2
2
  import { FullscreenHandler } from './fullscreenhandler';
3
- import UuidModule from '../modules/UuidModule';
3
+ import * as Crypto from 'expo-crypto';
4
4
  import FullscreenHandlerModule from './fullscreenHandlerModule';
5
5
 
6
6
  /**
@@ -15,7 +15,7 @@ export class FullscreenHandlerBridge {
15
15
  private onExitFullScreenSubscription?: EventSubscription;
16
16
 
17
17
  constructor(nativeId?: string) {
18
- this.nativeId = nativeId ?? UuidModule.generate();
18
+ this.nativeId = nativeId ?? Crypto.randomUUID();
19
19
  this.isDestroyed = false;
20
20
 
21
21
  this.onEnterFullScreenSubscription = FullscreenHandlerModule.addListener(
package/TODO.md DELETED
File without changes
@@ -1,18 +0,0 @@
1
- package com.bitmovin.player.reactnative
2
-
3
- import expo.modules.kotlin.modules.Module
4
- import expo.modules.kotlin.modules.ModuleDefinition
5
- import java.util.UUID
6
-
7
- /**
8
- * Native module for easy and fast unique ID generation on JS side. Used to generate native instance IDs.
9
- */
10
- class UuidModule : Module() {
11
- override fun definition() = ModuleDefinition {
12
- Name("UuidModule")
13
-
14
- Function("generate") {
15
- UUID.randomUUID().toString()
16
- }
17
- }
18
- }
@@ -1,8 +0,0 @@
1
- import { NativeModule } from 'expo-modules-core';
2
- export type UuidModuleEvents = Record<string, any>;
3
- declare class UuidModule extends NativeModule<UuidModuleEvents> {
4
- generate(): string;
5
- }
6
- declare const _default: UuidModule;
7
- export default _default;
8
- //# sourceMappingURL=UuidModule.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UuidModule.d.ts","sourceRoot":"","sources":["../../src/modules/UuidModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEnD,OAAO,OAAO,UAAW,SAAQ,YAAY,CAAC,gBAAgB,CAAC;IAC7D,QAAQ,IAAI,MAAM;CACnB;;AAED,wBAA6D"}
@@ -1,3 +0,0 @@
1
- import { requireNativeModule } from 'expo-modules-core';
2
- export default requireNativeModule('UuidModule');
3
- //# sourceMappingURL=UuidModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UuidModule.js","sourceRoot":"","sources":["../../src/modules/UuidModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQtE,eAAe,mBAAmB,CAAa,YAAY,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo-modules-core';\n\nexport type UuidModuleEvents = Record<string, any>;\n\ndeclare class UuidModule extends NativeModule<UuidModuleEvents> {\n generate(): string;\n}\n\nexport default requireNativeModule<UuidModule>('UuidModule');\n"]}
@@ -1,15 +0,0 @@
1
- import ExpoModulesCore
2
- import Foundation
3
-
4
- /**
5
- Native module for easy and fast unique ID generation on JS side. Used to generate native instance IDs.
6
- */
7
- public class UuidModule: Module {
8
- public func definition() -> ModuleDefinition {
9
- Name("UuidModule")
10
-
11
- Function("generate") { () -> String in
12
- UUID().uuidString
13
- }
14
- }
15
- }
@@ -1,9 +0,0 @@
1
- import { NativeModule, requireNativeModule } from 'expo-modules-core';
2
-
3
- export type UuidModuleEvents = Record<string, any>;
4
-
5
- declare class UuidModule extends NativeModule<UuidModuleEvents> {
6
- generate(): string;
7
- }
8
-
9
- export default requireNativeModule<UuidModule>('UuidModule');