react-native-theoplayer 11.7.0 → 11.9.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.
- package/CHANGELOG.md +34 -0
- package/android/build.gradle +4 -2
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/gradlew +176 -110
- package/android/gradlew.bat +23 -18
- package/android/src/main/java/com/theoplayer/ads/AdAdapter.kt +33 -7
- package/android/src/main/java/com/theoplayer/ads/AdEventAdapter.kt +8 -1
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionAdapter.kt +24 -5
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +61 -7
- package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegration.kt +12 -5
- package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegrationFactory.kt +3 -1
- package/android/src/main/java/com/theoplayer/source/SourceAdapter.kt +23 -0
- package/android/src/main/java/com/theoplayer/theolive/EndpointAdapter.kt +33 -0
- package/android/src/main/java/com/theoplayer/util/BridgeUtils.kt +4 -4
- package/android/src/test/java/com/theoplayer/ads/AdAdapterCustomDataTest.kt +144 -0
- package/ios/THEOplayerRCTBridge.m +7 -0
- package/ios/THEOplayerRCTMainEventHandler.swift +27 -1
- package/ios/THEOplayerRCTPlayerAPI.swift +20 -0
- package/ios/ads/THEOplayerRCTAdAdapter.swift +14 -3
- package/ios/ads/THEOplayerRCTAdsNative.swift +4 -0
- package/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift +39 -9
- package/ios/contentprotection/THEOplayerRCTContentProtectionAggregator.swift +15 -11
- package/ios/contentprotection/THEOplayerRCTProxyContentProtectionIntegration.swift +12 -7
- package/ios/theolive/THEOplayerRCTTHEOliveEventAdapter.swift +21 -0
- package/lib/commonjs/api/player/PlayerEventMap.js +1 -1
- package/lib/commonjs/api/source/abr/SourceAbrConfiguration.js +2 -0
- package/lib/commonjs/api/source/abr/SourceAbrConfiguration.js.map +1 -0
- package/lib/commonjs/api/source/abr/barrel.js +17 -0
- package/lib/commonjs/api/source/abr/barrel.js.map +1 -0
- package/lib/commonjs/api/source/barrel.js +18 -7
- package/lib/commonjs/api/source/barrel.js.map +1 -1
- package/lib/commonjs/internal/adapter/DefaultNativePlayerState.js +1 -0
- package/lib/commonjs/internal/adapter/DefaultNativePlayerState.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +9 -0
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js +13 -1
- package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/WebEventForwarder.js +61 -10
- package/lib/commonjs/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/native/NativeTheoLiveEvent.js +2 -2
- package/lib/commonjs/internal/adapter/event/native/NativeTheoLiveEvent.js.map +1 -1
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js +38 -12
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -1
- package/lib/commonjs/manifest.json +1 -1
- package/lib/commonjs/plugins/typedoc-platform-icons/package-lock.json +200 -58
- package/lib/commonjs/plugins/typedoc-platform-icons/package.json +1 -1
- package/lib/commonjs/plugins/typedoc-platform-icons/tsconfig.json +2 -1
- package/lib/module/api/player/PlayerEventMap.js +1 -1
- package/lib/module/api/source/abr/SourceAbrConfiguration.js +2 -0
- package/lib/module/api/source/abr/SourceAbrConfiguration.js.map +1 -0
- package/lib/module/api/source/abr/barrel.js +4 -0
- package/lib/module/api/source/abr/barrel.js.map +1 -0
- package/lib/module/api/source/barrel.js +1 -0
- package/lib/module/api/source/barrel.js.map +1 -1
- package/lib/module/internal/adapter/DefaultNativePlayerState.js +1 -0
- package/lib/module/internal/adapter/DefaultNativePlayerState.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerAdapter.js +9 -0
- package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerWebAdapter.js +13 -1
- package/lib/module/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
- package/lib/module/internal/adapter/WebEventForwarder.js +61 -10
- package/lib/module/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/module/internal/adapter/event/native/NativeTheoLiveEvent.js +2 -2
- package/lib/module/internal/adapter/event/native/NativeTheoLiveEvent.js.map +1 -1
- package/lib/module/internal/drm/ContentProtectionRegistry.js +38 -12
- package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -1
- package/lib/module/manifest.json +1 -1
- package/lib/module/plugins/typedoc-platform-icons/package-lock.json +200 -58
- package/lib/module/plugins/typedoc-platform-icons/package.json +1 -1
- package/lib/module/plugins/typedoc-platform-icons/tsconfig.json +2 -1
- package/lib/typescript/__tests__/ContentProtectionRegistry.test.d.ts +2 -0
- package/lib/typescript/__tests__/ContentProtectionRegistry.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/NativeTheoLiveEvent.test.d.ts +2 -0
- package/lib/typescript/__tests__/NativeTheoLiveEvent.test.d.ts.map +1 -0
- package/lib/typescript/api/ads/Ad.d.ts +9 -0
- package/lib/typescript/api/ads/Ad.d.ts.map +1 -1
- package/lib/typescript/api/ads/AdBreak.d.ts +9 -0
- package/lib/typescript/api/ads/AdBreak.d.ts.map +1 -1
- package/lib/typescript/api/error/ChromecastError.d.ts +2 -2
- package/lib/typescript/api/player/PlayerEventMap.d.ts +1 -1
- package/lib/typescript/api/player/THEOplayer.d.ts +11 -0
- package/lib/typescript/api/player/THEOplayer.d.ts.map +1 -1
- package/lib/typescript/api/source/SourceDescription.d.ts +7 -0
- package/lib/typescript/api/source/SourceDescription.d.ts.map +1 -1
- package/lib/typescript/api/source/abr/SourceAbrConfiguration.d.ts +27 -0
- package/lib/typescript/api/source/abr/SourceAbrConfiguration.d.ts.map +1 -0
- package/lib/typescript/api/source/abr/barrel.d.ts +2 -0
- package/lib/typescript/api/source/abr/barrel.d.ts.map +1 -0
- package/lib/typescript/api/source/barrel.d.ts +1 -0
- package/lib/typescript/api/source/barrel.d.ts.map +1 -1
- package/lib/typescript/api/theoads/interstitial/Interstitial.d.ts +1 -1
- package/lib/typescript/api/theolive/TheoLiveEndpoint.d.ts +23 -5
- package/lib/typescript/api/theolive/TheoLiveEndpoint.d.ts.map +1 -1
- package/lib/typescript/api/theolive/WebrtcOptions.d.ts +1 -1
- package/lib/typescript/internal/adapter/DefaultNativePlayerState.d.ts +1 -0
- package/lib/typescript/internal/adapter/DefaultNativePlayerState.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/NativePlayerState.d.ts +1 -0
- package/lib/typescript/internal/adapter/NativePlayerState.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts +2 -0
- package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts +2 -0
- package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/WebEventForwarder.d.ts +3 -0
- package/lib/typescript/internal/adapter/WebEventForwarder.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/web/PlayerFacadeAdsEvents.d.ts +2 -2
- package/lib/typescript/internal/adapter/web/PlayerFacadeAdsEvents.d.ts.map +1 -1
- package/lib/typescript/internal/drm/ContentProtectionRegistry.d.ts +3 -1
- package/lib/typescript/internal/drm/ContentProtectionRegistry.d.ts.map +1 -1
- package/lib/typescript/internal/drm/NativeContentProtectionEvent.d.ts +5 -0
- package/lib/typescript/internal/drm/NativeContentProtectionEvent.d.ts.map +1 -1
- package/package.json +5 -6
- package/react-native-theoplayer.podspec +6 -6
- package/src/__tests__/ContentProtectionRegistry.test.ts +239 -0
- package/src/__tests__/NativeTheoLiveEvent.test.ts +82 -0
- package/src/__tests__/PlayerFacadeWebAdapter.test.ts +13 -0
- package/src/api/ads/Ad.ts +10 -0
- package/src/api/ads/AdBreak.ts +10 -0
- package/src/api/error/ChromecastError.ts +2 -2
- package/src/api/player/PlayerEventMap.ts +1 -1
- package/src/api/player/THEOplayer.ts +12 -0
- package/src/api/source/SourceDescription.ts +8 -0
- package/src/api/source/abr/SourceAbrConfiguration.ts +27 -0
- package/src/api/source/abr/barrel.ts +1 -0
- package/src/api/source/barrel.ts +1 -0
- package/src/api/theoads/interstitial/Interstitial.ts +1 -1
- package/src/api/theolive/TheoLiveEndpoint.ts +24 -5
- package/src/api/theolive/WebrtcOptions.ts +1 -1
- package/src/internal/adapter/DefaultNativePlayerState.ts +1 -0
- package/src/internal/adapter/NativePlayerState.ts +1 -0
- package/src/internal/adapter/THEOplayerAdapter.ts +11 -0
- package/src/internal/adapter/THEOplayerWebAdapter.ts +15 -1
- package/src/internal/adapter/WebEventForwarder.ts +69 -10
- package/src/internal/adapter/event/native/NativeTheoLiveEvent.ts +2 -2
- package/src/internal/drm/ContentProtectionRegistry.ts +35 -17
- package/src/internal/drm/NativeContentProtectionEvent.ts +5 -0
- package/src/manifest.json +1 -1
- package/src/plugins/typedoc-platform-icons/package-lock.json +200 -58
- package/src/plugins/typedoc-platform-icons/package.json +1 -1
- package/src/plugins/typedoc-platform-icons/tsconfig.json +2 -1
- package/lib/typescript/plugins/expo/Common.d.ts +0 -13
- package/lib/typescript/plugins/expo/Common.d.ts.map +0 -1
- package/lib/typescript/plugins/expo/withCustomPod.d.ts +0 -2
- package/lib/typescript/plugins/expo/withCustomPod.d.ts.map +0 -1
- package/lib/typescript/plugins/expo/withTHEOplayer.d.ts +0 -4
- package/lib/typescript/plugins/expo/withTHEOplayer.d.ts.map +0 -1
- package/lib/typescript/plugins/expo/withTHEOplayerAndroid.d.ts +0 -4
- package/lib/typescript/plugins/expo/withTHEOplayerAndroid.d.ts.map +0 -1
- package/lib/typescript/plugins/expo/withTHEOplayerIOS.d.ts +0 -4
- package/lib/typescript/plugins/expo/withTHEOplayerIOS.d.ts.map +0 -1
- package/lib/typescript/plugins/typedoc-platform-icons/src/index.d.ts +0 -3
- package/lib/typescript/plugins/typedoc-platform-icons/src/index.d.ts.map +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { NativeSyntheticEvent } from 'react-native';
|
|
2
|
+
import type { NativeTheoLiveEvent } from '../internal/adapter/event/native/NativeTheoLiveEvent';
|
|
3
|
+
|
|
4
|
+
import assert from 'node:assert/strict';
|
|
5
|
+
import { test } from 'node:test';
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import ts from 'typescript';
|
|
9
|
+
|
|
10
|
+
const modules = new Map<string, object>();
|
|
11
|
+
|
|
12
|
+
function loadSource(file: string): object {
|
|
13
|
+
const cached = modules.get(file);
|
|
14
|
+
if (cached) return cached;
|
|
15
|
+
const compiled = ts.transpileModule(readFileSync(file, 'utf8'), {
|
|
16
|
+
compilerOptions: { target: ts.ScriptTarget.ES2020, module: ts.ModuleKind.CommonJS },
|
|
17
|
+
});
|
|
18
|
+
const exports = {};
|
|
19
|
+
modules.set(file, exports);
|
|
20
|
+
new Function('exports', 'require', compiled.outputText)(exports, (specifier: string) => {
|
|
21
|
+
if (specifier === 'react-native-theoplayer') {
|
|
22
|
+
return {
|
|
23
|
+
...loadSource(path.resolve('src/api/player/PlayerEventMap.ts')),
|
|
24
|
+
...loadSource(path.resolve('src/api/event/TheoLiveEvent.ts')),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
assert.ok(specifier.startsWith('.'), 'Event adapter runtime imports must remain local');
|
|
28
|
+
return loadSource(path.resolve(path.dirname(file), `${specifier}.ts`));
|
|
29
|
+
});
|
|
30
|
+
return exports;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { fromNativeTheoLiveEvent } = loadSource(
|
|
34
|
+
path.resolve('src/internal/adapter/event/native/NativeTheoLiveEvent.ts'),
|
|
35
|
+
) as typeof import('../internal/adapter/event/native/NativeTheoLiveEvent');
|
|
36
|
+
const { DefaultTheoLiveEndpointLoadedEvent, DefaultTheoLiveDistributionEvent, DefaultTheoLiveIntentToFallbackEvent, DefaultTheoLiveEvent } =
|
|
37
|
+
loadSource(path.resolve('src/internal/adapter/event/PlayerEvents.ts')) as typeof import('../internal/adapter/event/PlayerEvents');
|
|
38
|
+
const { TheoLiveEventType } = loadSource(path.resolve('src/api/event/TheoLiveEvent.ts')) as typeof import('../api/event/TheoLiveEvent');
|
|
39
|
+
|
|
40
|
+
function nativeEvent(payload: Partial<NativeTheoLiveEvent> & Pick<NativeTheoLiveEvent, 'type'>) {
|
|
41
|
+
return fromNativeTheoLiveEvent({
|
|
42
|
+
type: 'nativetheoliveevent',
|
|
43
|
+
nativeEvent: payload,
|
|
44
|
+
} as NativeSyntheticEvent<NativeTheoLiveEvent>);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
test('New Architecture endpointloaded preserves the endpoint', () => {
|
|
48
|
+
const endpoint = { provider: 'mediakind', hlsSrc: 'https://cdn.example.com/live.m3u8', weight: 1, priority: 1 };
|
|
49
|
+
const event = nativeEvent({ type: TheoLiveEventType.ENDPOINT_LOADED, endpoint });
|
|
50
|
+
assert.ok(event instanceof DefaultTheoLiveEndpointLoadedEvent);
|
|
51
|
+
assert.equal(event.type, 'theolive');
|
|
52
|
+
assert.equal(event.subType, TheoLiveEventType.ENDPOINT_LOADED);
|
|
53
|
+
assert.equal(event.endpoint, endpoint);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('New Architecture distributionloadstart preserves the distribution identifier', () => {
|
|
57
|
+
const event = nativeEvent({ type: TheoLiveEventType.DISTRIBUTION_LOAD_START, distributionId: 'distribution-1' });
|
|
58
|
+
assert.ok(event instanceof DefaultTheoLiveDistributionEvent);
|
|
59
|
+
assert.equal(event.subType, TheoLiveEventType.DISTRIBUTION_LOAD_START);
|
|
60
|
+
assert.equal(event.distributionId, 'distribution-1');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('New Architecture distributionloadstart defaults a missing distribution identifier', () => {
|
|
64
|
+
const event = nativeEvent({ type: TheoLiveEventType.DISTRIBUTION_LOAD_START });
|
|
65
|
+
assert.ok(event instanceof DefaultTheoLiveDistributionEvent);
|
|
66
|
+
assert.equal(event.subType, TheoLiveEventType.DISTRIBUTION_LOAD_START);
|
|
67
|
+
assert.equal(event.distributionId, '');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('New Architecture intenttofallback preserves the error reason', () => {
|
|
71
|
+
const reason = { errorCode: 'NETWORK_ERROR', errorMessage: 'Endpoint unavailable' };
|
|
72
|
+
const event = nativeEvent({ type: TheoLiveEventType.INTENT_TO_FALLBACK, reason });
|
|
73
|
+
assert.ok(event instanceof DefaultTheoLiveIntentToFallbackEvent);
|
|
74
|
+
assert.equal(event.subType, TheoLiveEventType.INTENT_TO_FALLBACK);
|
|
75
|
+
assert.equal(event.reason, reason);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('New Architecture generic events preserve the native subtype', () => {
|
|
79
|
+
const event = nativeEvent({ type: 'futureevent' as NativeTheoLiveEvent['type'] });
|
|
80
|
+
assert.ok(event instanceof DefaultTheoLiveEvent);
|
|
81
|
+
assert.equal(event.subType, 'futureevent');
|
|
82
|
+
});
|
|
@@ -109,6 +109,19 @@ function setup(enabled = true) {
|
|
|
109
109
|
return { adapter, facade, content, session, actions };
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
for (const enabled of [false, true]) {
|
|
113
|
+
test(`external playback assignments are ignored on Web (facade=${enabled})`, () => {
|
|
114
|
+
const { adapter, content } = setup(enabled);
|
|
115
|
+
assert.equal(adapter.allowsExternalPlayback, true);
|
|
116
|
+
adapter.allowsExternalPlayback = false;
|
|
117
|
+
assert.equal(adapter.allowsExternalPlayback, true);
|
|
118
|
+
adapter.allowsExternalPlayback = true;
|
|
119
|
+
assert.equal(adapter.allowsExternalPlayback, true);
|
|
120
|
+
assert.equal('allowsExternalPlayback' in content, false);
|
|
121
|
+
adapter.destroy();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
112
125
|
test('media session uses facade clocks, commands, synthetic updates, and advertising state', () => {
|
|
113
126
|
const { adapter, facade, content, session, actions } = setup();
|
|
114
127
|
const commands: Array<string | number> = [];
|
package/src/api/ads/Ad.ts
CHANGED
|
@@ -129,6 +129,16 @@ export interface Ad {
|
|
|
129
129
|
* <br/> - Only supported for `'theo'` and `'google-ima'`.
|
|
130
130
|
*/
|
|
131
131
|
universalAdIds: UniversalAdId[];
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Additional integration-specific data associated with this ad.
|
|
135
|
+
*
|
|
136
|
+
* @remarks
|
|
137
|
+
* <br/> - The value depends on the ad integration. It may be `undefined` if the integration does not provide any custom data.
|
|
138
|
+
* <br/> - On native platforms, values must be JSON-serializable. Custom data is preserved both in events forwarded to JavaScript
|
|
139
|
+
* and in events broadcast to native listeners.
|
|
140
|
+
*/
|
|
141
|
+
customData?: Record<string, unknown>;
|
|
132
142
|
}
|
|
133
143
|
|
|
134
144
|
/**
|
package/src/api/ads/AdBreak.ts
CHANGED
|
@@ -56,4 +56,14 @@ export interface AdBreak {
|
|
|
56
56
|
* <br/> - This feature is not available in the Google IMA integration and will default to -1.
|
|
57
57
|
*/
|
|
58
58
|
maxRemainingDuration: number | undefined;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Additional integration-specific data associated with this ad break.
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* <br/> - The value depends on the ad integration. It may be `undefined` if the integration does not provide any custom data.
|
|
65
|
+
* <br/> - On native platforms, values must be JSON-serializable. Custom data is preserved both in events forwarded to JavaScript
|
|
66
|
+
* and in events broadcast to native listeners.
|
|
67
|
+
*/
|
|
68
|
+
customData?: Record<string, unknown>;
|
|
59
69
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* <br/> - The error codes correspond to the error codes documented in the {@link https://developers.google.com/cast/docs/reference/chrome/chrome.cast.html#.ErrorCode | Chromecast API reference}.
|
|
16
16
|
*
|
|
17
17
|
* @category Errors
|
|
18
|
-
* @
|
|
18
|
+
* @category Casting
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
21
|
export type ChromecastErrorCode =
|
|
@@ -34,7 +34,7 @@ export type ChromecastErrorCode =
|
|
|
34
34
|
* An error that occurred while casting or attempting to cast to Chromecast.
|
|
35
35
|
*
|
|
36
36
|
* @category Errors
|
|
37
|
-
* @
|
|
37
|
+
* @category Casting
|
|
38
38
|
* @public
|
|
39
39
|
*/
|
|
40
40
|
export interface ChromecastError {
|
|
@@ -25,7 +25,7 @@ import type { TheoAdsEvent } from '../event/TheoAdsEvent';
|
|
|
25
25
|
import type { TheoLiveEvent } from '../event/TheoLiveEvent';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* The event types dispatched by the {@link
|
|
28
|
+
* The event types dispatched by the {@link react-native-theoplayer!THEOplayer}.
|
|
29
29
|
*
|
|
30
30
|
* @category Player
|
|
31
31
|
* @category Events
|
|
@@ -215,6 +215,18 @@ export interface THEOplayer extends EventDispatcher<PlayerEventMap> {
|
|
|
215
215
|
*/
|
|
216
216
|
manageContentMatching: boolean;
|
|
217
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Whether the player allows external playback through AirPlay.
|
|
220
|
+
*
|
|
221
|
+
* @defaultValue `true`
|
|
222
|
+
* @platform ios
|
|
223
|
+
*
|
|
224
|
+
* @remarks
|
|
225
|
+
* <br/> - Not supported for THEOlive sources.
|
|
226
|
+
* <br/> - On Android and Web, assignments are ignored and the getter returns `true`; this does not indicate AirPlay support.
|
|
227
|
+
*/
|
|
228
|
+
allowsExternalPlayback: boolean;
|
|
229
|
+
|
|
218
230
|
/**
|
|
219
231
|
* Specifies where the player is displaying the video.
|
|
220
232
|
*
|
|
@@ -16,6 +16,7 @@ import type { ServerSideAdInsertionConfiguration } from './ads/ssai/ServerSideAd
|
|
|
16
16
|
import type { AnalyticsDescription } from './analytics/AnalyticsDescription';
|
|
17
17
|
import { CmcdSourceConfiguration } from '../cmcd/CmcdConfiguration';
|
|
18
18
|
import { SourceLatencyConfiguration } from './latency/SourceLatencyConfiguration';
|
|
19
|
+
import type { SourceAbrConfiguration } from './abr/SourceAbrConfiguration';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* A type alias for a {@link TypedSource} media resource.
|
|
@@ -344,6 +345,13 @@ export interface BaseSource {
|
|
|
344
345
|
* <br/> - Ignored for non-HLS streams.
|
|
345
346
|
*/
|
|
346
347
|
hls?: HlsPlaybackConfiguration;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* The source's ABR configuration.
|
|
351
|
+
*
|
|
352
|
+
* @platform web,android
|
|
353
|
+
*/
|
|
354
|
+
abr?: SourceAbrConfiguration;
|
|
347
355
|
}
|
|
348
356
|
|
|
349
357
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes the ABR configuration for a specific source.
|
|
3
|
+
*
|
|
4
|
+
* @category Source
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface SourceAbrConfiguration {
|
|
8
|
+
/**
|
|
9
|
+
* A list of preferred audio codecs which will be used by the ABR algorithm for track selection, if the codec is supported.
|
|
10
|
+
*
|
|
11
|
+
* @platform web,android
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* <br/> - Codecs are specified by their RFC 6381 name, e.g. `"ec-3"` or `"mp4a.40.2"`.
|
|
15
|
+
*/
|
|
16
|
+
preferredAudioCodecs?: string[];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A list of preferred video codecs which will be used by the ABR algorithm for track selection, if the codec is supported.
|
|
20
|
+
*
|
|
21
|
+
* @platform web,android
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* <br/> - Codecs are specified by their RFC 6381 name, e.g. `"hvc1"`, `"dvh1"` or `"avc1"`.
|
|
25
|
+
*/
|
|
26
|
+
preferredVideoCodecs?: string[];
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SourceAbrConfiguration';
|
package/src/api/source/barrel.ts
CHANGED
|
@@ -39,7 +39,7 @@ export interface Interstitial {
|
|
|
39
39
|
/**
|
|
40
40
|
* The ad tag parameters that are used for this specific ad break.
|
|
41
41
|
* @remarks
|
|
42
|
-
* <br/> - The set values are combined and potentially override parameters set on the {@link TheoAdDescription.adTagParameters} or through {@link
|
|
42
|
+
* <br/> - The set values are combined and potentially override parameters set on the {@link TheoAdDescription.adTagParameters} or through {@link TheoAdsAPI.replaceAdTagParameters}.
|
|
43
43
|
*/
|
|
44
44
|
adTagParameters: Record<string, string>;
|
|
45
45
|
}
|
|
@@ -24,24 +24,43 @@ export interface TheoLiveEndpoint {
|
|
|
24
24
|
* For most endpoint types, this is the source URL string.
|
|
25
25
|
* For millicast endpoints, this is a {@link EndpointMillicastSource} object.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* Undefined if the endpoint has no source.
|
|
28
|
+
*
|
|
29
|
+
* @platform android,ios,web
|
|
28
30
|
*/
|
|
29
31
|
src?: string | EndpointMillicastSource;
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
|
-
* The type of source (e.g. 'hesp', 'hls', 'hlsMpegTs', 'millicast', 'dai').
|
|
34
|
+
* The type of source (e.g. 'hesp', 'hls', 'hlsMpegTs', 'dash', 'millicast', 'dai').
|
|
33
35
|
*
|
|
34
|
-
* @
|
|
36
|
+
* @remarks
|
|
37
|
+
* Undefined if the endpoint has no source.
|
|
38
|
+
* The 'dash' type is only reported on Web; Android and iOS do not support DASH endpoints.
|
|
39
|
+
*
|
|
40
|
+
* @platform android,ios,web
|
|
35
41
|
*/
|
|
36
42
|
srcType?: string;
|
|
37
43
|
|
|
38
44
|
/**
|
|
39
|
-
* The provider of this endpoint (e.g. 'optiview').
|
|
45
|
+
* The provider of this endpoint (e.g. 'optiview', 'mediakind').
|
|
40
46
|
*
|
|
41
|
-
* @
|
|
47
|
+
* @remarks
|
|
48
|
+
* Unknown providers are reported verbatim. Undefined if the discovery response does not specify one.
|
|
49
|
+
*
|
|
50
|
+
* @platform android,ios,web
|
|
42
51
|
*/
|
|
43
52
|
provider?: string;
|
|
44
53
|
|
|
54
|
+
/**
|
|
55
|
+
* The ad system associated with this endpoint (e.g. 'sgai', 'mediakind', 'dai').
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* Unknown ad systems are reported verbatim. Only populated for V3 distributions; undefined otherwise.
|
|
59
|
+
*
|
|
60
|
+
* @platform android,ios,web
|
|
61
|
+
*/
|
|
62
|
+
adSystem?: string;
|
|
63
|
+
|
|
45
64
|
millicastSrc?: EndpointMillicastSource;
|
|
46
65
|
hespSrc?: string;
|
|
47
66
|
hlsSrc?: string;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* to increase the jitter buffer size.
|
|
7
7
|
*
|
|
8
8
|
* @category THEOlive
|
|
9
|
-
* @
|
|
9
|
+
* @remarks This is a hint, and factors like network jitter and audio/video sync latency affect the actual delay applied.
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
export interface WebrtcPlayoutDelay {
|
|
@@ -31,6 +31,7 @@ export class DefaultNativePlayerState extends DefaultTextTrackState implements N
|
|
|
31
31
|
preload: PreloadType = 'none';
|
|
32
32
|
aspectRatio: AspectRatio = AspectRatio.FIT;
|
|
33
33
|
manageContentMatching = false;
|
|
34
|
+
allowsExternalPlayback = true;
|
|
34
35
|
renderingTarget: RenderingTarget = RenderingTarget.SURFACE_VIEW;
|
|
35
36
|
keepScreenOn = true;
|
|
36
37
|
audioTracks: MediaTrack[] = [];
|
|
@@ -503,6 +503,17 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
+
get allowsExternalPlayback(): boolean {
|
|
507
|
+
return this._state.allowsExternalPlayback;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
set allowsExternalPlayback(enable: boolean) {
|
|
511
|
+
if (Platform.OS === 'ios') {
|
|
512
|
+
this._state.allowsExternalPlayback = enable;
|
|
513
|
+
NativePlayerModule.setAllowsExternalPlayback(this._view.nativeHandle, enable);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
506
517
|
get renderingTarget(): RenderingTarget {
|
|
507
518
|
return this._state.renderingTarget;
|
|
508
519
|
}
|
|
@@ -374,6 +374,14 @@ export class THEOplayerWebAdapter extends DefaultEventDispatcher<PlayerEventMap>
|
|
|
374
374
|
// unused
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
+
get allowsExternalPlayback(): boolean {
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
set allowsExternalPlayback(_enable: boolean) {
|
|
382
|
+
// unused
|
|
383
|
+
}
|
|
384
|
+
|
|
377
385
|
get keepScreenOn(): boolean {
|
|
378
386
|
return false;
|
|
379
387
|
}
|
|
@@ -419,9 +427,15 @@ export class THEOplayerWebAdapter extends DefaultEventDispatcher<PlayerEventMap>
|
|
|
419
427
|
this._cmcdConnector = undefined;
|
|
420
428
|
this._player?.removeEventListener('dimensionchange', this.onPlayerDimensionChange);
|
|
421
429
|
try {
|
|
430
|
+
// The native player dispatches 'destroy' asynchronously, after destroy() returns, and the facade
|
|
431
|
+
// closes itself once it has forwarded that event (see PlayerFacade). Closing it here would detach
|
|
432
|
+
// every facade listener (e.g. the Bitmovin collector) before the event arrives.
|
|
422
433
|
this._player?.destroy();
|
|
423
|
-
}
|
|
434
|
+
} catch (error) {
|
|
435
|
+
// The native destroy failed, so no 'destroy' event will come to close the facade.
|
|
424
436
|
this._playerFacade?.close();
|
|
437
|
+
throw error;
|
|
438
|
+
} finally {
|
|
425
439
|
this._player = undefined;
|
|
426
440
|
}
|
|
427
441
|
}
|
|
@@ -87,6 +87,18 @@ import { fromNativeCue, fromNativeMediaTrack, fromNativeTextTrack } from './web/
|
|
|
87
87
|
export class WebEventForwarder {
|
|
88
88
|
private readonly _player: ChromelessPlayer;
|
|
89
89
|
private readonly _facade: THEOplayerWebAdapter;
|
|
90
|
+
private readonly _textTrackListeners = new Map<
|
|
91
|
+
number,
|
|
92
|
+
{
|
|
93
|
+
track: NativeTextTrack;
|
|
94
|
+
addcue: (event: NativeTextTrackAddCueEvent) => void;
|
|
95
|
+
removecue: (event: NativeTextTrackRemoveCueEvent) => void;
|
|
96
|
+
entercue: (event: NativeTextTrackEnterCueEvent) => void;
|
|
97
|
+
exitcue: (event: NativeTextTrackExitCueEvent) => void;
|
|
98
|
+
}
|
|
99
|
+
>();
|
|
100
|
+
private readonly _forwardedTextTrackCues = new Map<number, Set<number>>();
|
|
101
|
+
private readonly _mediaTrackListeners = new Map<number, { track: NativeMediaTrack; listener: () => void }>();
|
|
90
102
|
|
|
91
103
|
constructor(player: ChromelessPlayer, facade: THEOplayerWebAdapter) {
|
|
92
104
|
this._player = player;
|
|
@@ -194,6 +206,20 @@ export class WebEventForwarder {
|
|
|
194
206
|
this._player.ads?.removeEventListener(FORWARDED_ADBREAK_EVENTS, this.onAdBreakEvent);
|
|
195
207
|
this._player.theoads?.removeEventListener(FORWARDED_THEOADS_EVENTS, this.onTheoAdsEvent);
|
|
196
208
|
this._player.theoLive?.removeEventListener(FORWARDED_THEOLIVE_EVENTS, this.onTheoLiveEvent);
|
|
209
|
+
|
|
210
|
+
for (const listeners of this._textTrackListeners.values()) {
|
|
211
|
+
listeners.track.removeEventListener('addcue', listeners.addcue);
|
|
212
|
+
listeners.track.removeEventListener('removecue', listeners.removecue);
|
|
213
|
+
listeners.track.removeEventListener('entercue', listeners.entercue);
|
|
214
|
+
listeners.track.removeEventListener('exitcue', listeners.exitcue);
|
|
215
|
+
}
|
|
216
|
+
this._textTrackListeners.clear();
|
|
217
|
+
this._forwardedTextTrackCues.clear();
|
|
218
|
+
|
|
219
|
+
for (const listeners of this._mediaTrackListeners.values()) {
|
|
220
|
+
listeners.track.removeEventListener('activequalitychanged', listeners.listener);
|
|
221
|
+
}
|
|
222
|
+
this._mediaTrackListeners.clear();
|
|
197
223
|
}
|
|
198
224
|
|
|
199
225
|
private readonly onSourceChange = () => {
|
|
@@ -327,19 +353,38 @@ export class WebEventForwarder {
|
|
|
327
353
|
if (track.kind === TextTrackKind.metadata) {
|
|
328
354
|
track.mode = TextTrackMode.hidden;
|
|
329
355
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
356
|
+
const listeners = {
|
|
357
|
+
track,
|
|
358
|
+
addcue: this.onAddTextTrackCue(track),
|
|
359
|
+
removecue: this.onRemoveTextTrackCue(track),
|
|
360
|
+
entercue: this.onEnterTextTrackCue(track),
|
|
361
|
+
exitcue: this.onExitTextTrackCue(track),
|
|
362
|
+
};
|
|
363
|
+
this._textTrackListeners.set(track.uid, listeners);
|
|
364
|
+
const replayedCues = new Set<number>();
|
|
365
|
+
track.cues?.forEach((cue) => replayedCues.add(cue.uid));
|
|
366
|
+
this._forwardedTextTrackCues.set(track.uid, replayedCues);
|
|
367
|
+
track.addEventListener('addcue', listeners.addcue);
|
|
368
|
+
track.addEventListener('removecue', listeners.removecue);
|
|
369
|
+
track.addEventListener('entercue', listeners.entercue);
|
|
370
|
+
track.addEventListener('exitcue', listeners.exitcue);
|
|
334
371
|
this._facade.dispatchEvent(new DefaultTextTrackListEvent(TrackListEventType.ADD_TRACK, fromNativeTextTrack(track)));
|
|
372
|
+
track.cues?.forEach((cue) => {
|
|
373
|
+
this._facade.dispatchEvent(new DefaultTextTrackEvent(TextTrackEventType.ADD_CUE, track.uid, fromNativeCue(cue)));
|
|
374
|
+
});
|
|
335
375
|
};
|
|
336
376
|
|
|
337
377
|
private readonly onRemoveTextTrack = (event: RemoveTrackEvent) => {
|
|
338
378
|
const track = event.track as NativeTextTrack;
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
379
|
+
const listeners = this._textTrackListeners.get(track.uid);
|
|
380
|
+
if (listeners) {
|
|
381
|
+
track.removeEventListener('addcue', listeners.addcue);
|
|
382
|
+
track.removeEventListener('removecue', listeners.removecue);
|
|
383
|
+
track.removeEventListener('entercue', listeners.entercue);
|
|
384
|
+
track.removeEventListener('exitcue', listeners.exitcue);
|
|
385
|
+
this._textTrackListeners.delete(track.uid);
|
|
386
|
+
}
|
|
387
|
+
this._forwardedTextTrackCues.delete(track.uid);
|
|
343
388
|
this._facade.dispatchEvent(new DefaultTextTrackListEvent(TrackListEventType.REMOVE_TRACK, fromNativeTextTrack(track)));
|
|
344
389
|
};
|
|
345
390
|
|
|
@@ -357,7 +402,9 @@ export class WebEventForwarder {
|
|
|
357
402
|
|
|
358
403
|
private readonly onAddMediaTrack = (event: AddTrackEvent, trackType: MediaTrackType) => {
|
|
359
404
|
const track = event.track as NativeMediaTrack;
|
|
360
|
-
|
|
405
|
+
const listener = this.onActiveQualityChanged(trackType, track);
|
|
406
|
+
this._mediaTrackListeners.set(track.uid, { track, listener });
|
|
407
|
+
track.addEventListener('activequalitychanged', listener);
|
|
361
408
|
this._facade.dispatchEvent(new DefaultMediaTrackListEvent(TrackListEventType.ADD_TRACK, trackType, track as MediaTrack));
|
|
362
409
|
};
|
|
363
410
|
|
|
@@ -371,7 +418,11 @@ export class WebEventForwarder {
|
|
|
371
418
|
|
|
372
419
|
private readonly onRemoveMediaTrack = (event: RemoveTrackEvent, trackType: MediaTrackType) => {
|
|
373
420
|
const track = event.track as NativeMediaTrack;
|
|
374
|
-
|
|
421
|
+
const listeners = this._mediaTrackListeners.get(track.uid);
|
|
422
|
+
if (listeners) {
|
|
423
|
+
track.removeEventListener('activequalitychanged', listeners.listener);
|
|
424
|
+
this._mediaTrackListeners.delete(track.uid);
|
|
425
|
+
}
|
|
375
426
|
this._facade.dispatchEvent(new DefaultMediaTrackListEvent(TrackListEventType.REMOVE_TRACK, trackType, track as MediaTrack));
|
|
376
427
|
};
|
|
377
428
|
|
|
@@ -448,6 +499,10 @@ export class WebEventForwarder {
|
|
|
448
499
|
private readonly onAddTextTrackCue = (track: NativeTextTrack) => (event: NativeTextTrackAddCueEvent) => {
|
|
449
500
|
const { cue } = event;
|
|
450
501
|
if (cue) {
|
|
502
|
+
const replayedCues = this._forwardedTextTrackCues.get(track.uid);
|
|
503
|
+
if (replayedCues?.has(cue.uid)) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
451
506
|
this._facade.dispatchEvent(new DefaultTextTrackEvent(TextTrackEventType.ADD_CUE, track.uid, fromNativeCue(cue)));
|
|
452
507
|
}
|
|
453
508
|
};
|
|
@@ -455,6 +510,10 @@ export class WebEventForwarder {
|
|
|
455
510
|
private readonly onRemoveTextTrackCue = (track: NativeTextTrack) => (event: NativeTextTrackRemoveCueEvent) => {
|
|
456
511
|
const { cue } = event;
|
|
457
512
|
if (cue) {
|
|
513
|
+
const replayedCues = this._forwardedTextTrackCues.get(track.uid);
|
|
514
|
+
if (replayedCues) {
|
|
515
|
+
replayedCues.delete(cue.uid);
|
|
516
|
+
}
|
|
458
517
|
this._facade.dispatchEvent(new DefaultTextTrackEvent(TextTrackEventType.REMOVE_CUE, track.uid, fromNativeCue(cue)));
|
|
459
518
|
}
|
|
460
519
|
};
|
|
@@ -38,7 +38,7 @@ export interface NativeTheoLiveEvent {
|
|
|
38
38
|
|
|
39
39
|
export function fromNativeTheoLiveEvent(event: NativeSyntheticEvent<NativeTheoLiveEvent>): TheoLiveEvent {
|
|
40
40
|
const { nativeEvent } = event;
|
|
41
|
-
switch (
|
|
41
|
+
switch (nativeEvent.type) {
|
|
42
42
|
case TheoLiveEventType.DISTRIBUTION_LOAD_START:
|
|
43
43
|
return new DefaultTheoLiveDistributionEvent(TheoLiveEventType.DISTRIBUTION_LOAD_START, nativeEvent.distributionId ?? '');
|
|
44
44
|
case TheoLiveEventType.DISTRIBUTION_LOADED:
|
|
@@ -50,6 +50,6 @@ export function fromNativeTheoLiveEvent(event: NativeSyntheticEvent<NativeTheoLi
|
|
|
50
50
|
case TheoLiveEventType.INTENT_TO_FALLBACK:
|
|
51
51
|
return new DefaultTheoLiveIntentToFallbackEvent(TheoLiveEventType.INTENT_TO_FALLBACK, nativeEvent.reason);
|
|
52
52
|
default:
|
|
53
|
-
return new DefaultTheoLiveEvent(
|
|
53
|
+
return new DefaultTheoLiveEvent(nativeEvent.type);
|
|
54
54
|
}
|
|
55
55
|
}
|