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.
- package/CONTRIBUTING.md +1 -1
- package/android/ktlint.gradle +1 -1
- package/android/src/main/java/com/bitmovin/player/reactnative/PlayerModule.kt +47 -52
- package/android/src/main/java/com/bitmovin/player/reactnative/PlayerRegistry.kt +78 -0
- package/app.plugin.js +6 -6
- package/build/components/PlayerView/index.d.ts +1 -1
- package/build/components/PlayerView/index.d.ts.map +1 -1
- package/build/components/PlayerView/index.js +6 -3
- package/build/components/PlayerView/index.js.map +1 -1
- package/build/nativeInstance.d.ts.map +1 -1
- package/build/nativeInstance.js +2 -3
- package/build/nativeInstance.js.map +1 -1
- package/build/ui/custommessagehandlerbridge.js +2 -2
- package/build/ui/custommessagehandlerbridge.js.map +1 -1
- package/build/ui/fullscreenhandlerbridge.js +2 -2
- package/build/ui/fullscreenhandlerbridge.js.map +1 -1
- package/expo-module.config.json +0 -2
- package/ios/AppLifecycleDelegate.swift +4 -1
- package/ios/PlayerModule.swift +99 -94
- package/ios/PlayerRegistry.swift +88 -0
- package/ios/RNBitmovinPlayer.podspec +2 -2
- package/package.json +4 -1
- package/plugin/build/withBitmovinIosConfig.js +25 -20
- package/plugin/src/withBitmovinIosConfig.ts +27 -21
- package/scripts/check-dependencies.js +26 -0
- package/scripts/setup-hooks.sh +1 -1
- package/src/components/PlayerView/index.tsx +86 -84
- package/src/nativeInstance.ts +2 -4
- package/src/ui/custommessagehandlerbridge.ts +2 -2
- package/src/ui/fullscreenhandlerbridge.ts +2 -2
- package/TODO.md +0 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/UuidModule.kt +0 -18
- package/build/modules/UuidModule.d.ts +0 -8
- package/build/modules/UuidModule.d.ts.map +0 -1
- package/build/modules/UuidModule.js +0 -3
- package/build/modules/UuidModule.js.map +0 -1
- package/ios/UuidModule.swift +0 -15
- 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
|
+
}
|
package/scripts/setup-hooks.sh
CHANGED
|
@@ -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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
}
|
package/src/nativeInstance.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
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 ??
|
|
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
|
|
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 ??
|
|
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
|
|
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 ??
|
|
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 +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"]}
|
package/ios/UuidModule.swift
DELETED
|
@@ -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');
|