react-native-theoplayer 3.7.0 → 3.8.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 +18 -0
- package/android/build.gradle +1 -1
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/6.10.0/ads-wrapper-6.10.0.aar +0 -0
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/{4.8.0/ads-wrapper-4.8.0.pom → 6.10.0/ads-wrapper-6.10.0.pom} +1 -1
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/maven-metadata-local.xml +4 -4
- package/android/src/main/java/com/theoplayer/PlayerConfigAdapter.kt +4 -0
- package/android/src/main/java/com/theoplayer/ads/AdEventAdapter.kt +9 -4
- package/android/src/main/java/com/theoplayer/ads/AdsModule.kt +1 -1
- package/android/src/main/java/com/theoplayer/broadcast/EventBroadcastModule.kt +1 -1
- package/android/src/main/java/com/theoplayer/cache/CacheModule.kt +1 -1
- package/android/src/main/java/com/theoplayer/cast/CastModule.kt +1 -1
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +1 -1
- package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +1 -1
- package/ios/THEOplayerRCTBridge.m +6 -6
- package/ios/THEOplayerRCTPlayerAPI.swift +25 -25
- package/ios/ads/THEOplayerRCTAdsAPI.swift +17 -17
- package/ios/cache/THEOplayerRCTCacheAPI.swift +29 -29
- package/ios/casting/THEOplayerRCTCastAPI.swift +9 -9
- package/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift +22 -22
- package/ios/eventBroadcasting/THEOplayerRCTEventBroadcastAPI.swift +5 -5
- package/lib/commonjs/api/config/PlayerConfiguration.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +18 -17
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/abr/AbrAdapter.js +2 -1
- package/lib/commonjs/internal/adapter/abr/AbrAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/ads/THEOplayerNativeAdsAdapter.js +7 -6
- package/lib/commonjs/internal/adapter/ads/THEOplayerNativeAdsAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/ads/THEOplayerNativeGoogleDAI.js +5 -4
- package/lib/commonjs/internal/adapter/ads/THEOplayerNativeGoogleDAI.js.map +1 -1
- package/lib/commonjs/internal/adapter/broadcast/EventBroadcastAdapter.js +2 -1
- package/lib/commonjs/internal/adapter/broadcast/EventBroadcastAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/cast/THEOplayerNativeAirplay.js +5 -4
- package/lib/commonjs/internal/adapter/cast/THEOplayerNativeAirplay.js.map +1 -1
- package/lib/commonjs/internal/adapter/cast/THEOplayerNativeChromecast.js +7 -6
- package/lib/commonjs/internal/adapter/cast/THEOplayerNativeChromecast.js.map +1 -1
- package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js +11 -10
- package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
- package/lib/commonjs/internal/cache/MediaCache.js +4 -3
- package/lib/commonjs/internal/cache/MediaCache.js.map +1 -1
- package/lib/commonjs/internal/cache/NativeCachingTaskAdapter.js +5 -4
- package/lib/commonjs/internal/cache/NativeCachingTaskAdapter.js.map +1 -1
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js +23 -22
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -1
- package/lib/module/api/config/PlayerConfiguration.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerAdapter.js +18 -17
- package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/module/internal/adapter/abr/AbrAdapter.js +2 -1
- package/lib/module/internal/adapter/abr/AbrAdapter.js.map +1 -1
- package/lib/module/internal/adapter/ads/THEOplayerNativeAdsAdapter.js +7 -6
- package/lib/module/internal/adapter/ads/THEOplayerNativeAdsAdapter.js.map +1 -1
- package/lib/module/internal/adapter/ads/THEOplayerNativeGoogleDAI.js +5 -4
- package/lib/module/internal/adapter/ads/THEOplayerNativeGoogleDAI.js.map +1 -1
- package/lib/module/internal/adapter/broadcast/EventBroadcastAdapter.js +2 -1
- package/lib/module/internal/adapter/broadcast/EventBroadcastAdapter.js.map +1 -1
- package/lib/module/internal/adapter/cast/THEOplayerNativeAirplay.js +5 -4
- package/lib/module/internal/adapter/cast/THEOplayerNativeAirplay.js.map +1 -1
- package/lib/module/internal/adapter/cast/THEOplayerNativeChromecast.js +7 -6
- package/lib/module/internal/adapter/cast/THEOplayerNativeChromecast.js.map +1 -1
- package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js +11 -10
- package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
- package/lib/module/internal/cache/MediaCache.js +4 -3
- package/lib/module/internal/cache/MediaCache.js.map +1 -1
- package/lib/module/internal/cache/NativeCachingTaskAdapter.js +5 -4
- package/lib/module/internal/cache/NativeCachingTaskAdapter.js.map +1 -1
- package/lib/module/internal/drm/ContentProtectionRegistry.js +23 -22
- package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -1
- package/lib/typescript/api/config/PlayerConfiguration.d.ts +10 -0
- package/package.json +1 -1
- package/react-native-theoplayer.podspec +15 -8
- package/src/api/config/PlayerConfiguration.ts +11 -0
- package/src/internal/adapter/THEOplayerAdapter.ts +19 -17
- package/src/internal/adapter/abr/AbrAdapter.ts +3 -1
- package/src/internal/adapter/ads/THEOplayerNativeAdsAdapter.ts +8 -6
- package/src/internal/adapter/ads/THEOplayerNativeGoogleDAI.ts +6 -4
- package/src/internal/adapter/broadcast/EventBroadcastAdapter.ts +3 -1
- package/src/internal/adapter/cast/THEOplayerNativeAirplay.ts +6 -4
- package/src/internal/adapter/cast/THEOplayerNativeChromecast.ts +8 -6
- package/src/internal/adapter/track/TextTrackStyleAdapter.ts +11 -10
- package/src/internal/cache/MediaCache.ts +5 -3
- package/src/internal/cache/NativeCachingTaskAdapter.ts +6 -4
- package/src/internal/drm/ContentProtectionRegistry.ts +24 -22
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/4.8.0/ads-wrapper-4.8.0.aar +0 -0
|
@@ -51,6 +51,8 @@ import { TextTrackStyleAdapter } from './track/TextTrackStyleAdapter';
|
|
|
51
51
|
import type { NativePlayerState } from './NativePlayerState';
|
|
52
52
|
import { EventBroadcastAdapter } from './broadcast/EventBroadcastAdapter';
|
|
53
53
|
|
|
54
|
+
const NativePlayerModule = NativeModules.THEORCTPlayerModule;
|
|
55
|
+
|
|
54
56
|
const defaultPlayerState: NativePlayerState = {
|
|
55
57
|
source: undefined,
|
|
56
58
|
autoplay: false,
|
|
@@ -281,7 +283,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
281
283
|
|
|
282
284
|
set preload(type: PreloadType) {
|
|
283
285
|
this._state.preload = type;
|
|
284
|
-
|
|
286
|
+
NativePlayerModule.setPreload(this._view.nativeHandle, type);
|
|
285
287
|
}
|
|
286
288
|
|
|
287
289
|
get preload(): PreloadType {
|
|
@@ -325,7 +327,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
325
327
|
}
|
|
326
328
|
|
|
327
329
|
this._state.currentTime = seekTime;
|
|
328
|
-
|
|
330
|
+
NativePlayerModule.setCurrentTime(this._view.nativeHandle, seekTime);
|
|
329
331
|
}
|
|
330
332
|
|
|
331
333
|
get duration(): number {
|
|
@@ -338,7 +340,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
338
340
|
|
|
339
341
|
set pipConfiguration(pipConfiguration: PiPConfiguration) {
|
|
340
342
|
this._state.pipConfig = pipConfiguration;
|
|
341
|
-
|
|
343
|
+
NativePlayerModule.setPipConfig(this._view.nativeHandle, pipConfiguration);
|
|
342
344
|
}
|
|
343
345
|
|
|
344
346
|
get backgroundAudioConfiguration(): BackgroundAudioConfiguration {
|
|
@@ -347,7 +349,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
347
349
|
|
|
348
350
|
set backgroundAudioConfiguration(backgroundAudioConfiguration: BackgroundAudioConfiguration) {
|
|
349
351
|
this._state.backgroundAudioConfig = backgroundAudioConfiguration;
|
|
350
|
-
|
|
352
|
+
NativePlayerModule.setBackgroundAudioConfig(this._view.nativeHandle, backgroundAudioConfiguration);
|
|
351
353
|
}
|
|
352
354
|
|
|
353
355
|
get presentationMode(): PresentationMode {
|
|
@@ -356,7 +358,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
356
358
|
|
|
357
359
|
set presentationMode(presentationMode: PresentationMode) {
|
|
358
360
|
this._state.presentationMode = presentationMode;
|
|
359
|
-
|
|
361
|
+
NativePlayerModule.setPresentationMode(this._view.nativeHandle, presentationMode);
|
|
360
362
|
}
|
|
361
363
|
|
|
362
364
|
get muted(): boolean {
|
|
@@ -365,7 +367,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
365
367
|
|
|
366
368
|
set muted(muted: boolean) {
|
|
367
369
|
this._state.muted = muted;
|
|
368
|
-
|
|
370
|
+
NativePlayerModule.setMuted(this._view.nativeHandle, muted);
|
|
369
371
|
}
|
|
370
372
|
|
|
371
373
|
get seeking(): boolean {
|
|
@@ -382,7 +384,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
382
384
|
|
|
383
385
|
set playbackRate(playbackRate: number) {
|
|
384
386
|
this._state.playbackRate = playbackRate;
|
|
385
|
-
|
|
387
|
+
NativePlayerModule.setPlaybackRate(this._view.nativeHandle, playbackRate);
|
|
386
388
|
}
|
|
387
389
|
|
|
388
390
|
get audioTracks(): MediaTrack[] {
|
|
@@ -398,7 +400,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
398
400
|
return;
|
|
399
401
|
}
|
|
400
402
|
this._state.selectedAudioTrack = trackUid;
|
|
401
|
-
|
|
403
|
+
NativePlayerModule.setSelectedAudioTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1);
|
|
402
404
|
}
|
|
403
405
|
|
|
404
406
|
get videoTracks(): MediaTrack[] {
|
|
@@ -415,7 +417,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
415
417
|
}
|
|
416
418
|
this._state.selectedVideoTrack = trackUid;
|
|
417
419
|
this._state.targetVideoQuality = undefined;
|
|
418
|
-
|
|
420
|
+
NativePlayerModule.setSelectedVideoTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1);
|
|
419
421
|
}
|
|
420
422
|
|
|
421
423
|
get textTracks(): TextTrack[] {
|
|
@@ -438,7 +440,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
438
440
|
track.mode = TextTrackMode.disabled;
|
|
439
441
|
}
|
|
440
442
|
});
|
|
441
|
-
|
|
443
|
+
NativePlayerModule.setSelectedTextTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1);
|
|
442
444
|
}
|
|
443
445
|
|
|
444
446
|
get textTrackStyle(): TextTrackStyle {
|
|
@@ -453,7 +455,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
453
455
|
// This is to correctly reset autoplay during a source change.
|
|
454
456
|
this.pause();
|
|
455
457
|
this._state.source = source;
|
|
456
|
-
|
|
458
|
+
NativePlayerModule.setSource(this._view.nativeHandle, source);
|
|
457
459
|
// Reset state for play-out of new source
|
|
458
460
|
Object.assign(this._state, {
|
|
459
461
|
playbackRate: 1,
|
|
@@ -486,7 +488,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
486
488
|
if (track) {
|
|
487
489
|
Object.assign(track, { ...track, targetQuality: this._state.targetVideoQuality });
|
|
488
490
|
}
|
|
489
|
-
|
|
491
|
+
NativePlayerModule.setTargetVideoQuality(this._view.nativeHandle, this._state.targetVideoQuality);
|
|
490
492
|
}
|
|
491
493
|
|
|
492
494
|
get volume(): number {
|
|
@@ -495,7 +497,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
495
497
|
|
|
496
498
|
set volume(volume: number) {
|
|
497
499
|
this._state.volume = volume;
|
|
498
|
-
|
|
500
|
+
NativePlayerModule.setVolume(this._view.nativeHandle, volume);
|
|
499
501
|
}
|
|
500
502
|
|
|
501
503
|
get aspectRatio(): AspectRatio {
|
|
@@ -504,7 +506,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
504
506
|
|
|
505
507
|
set aspectRatio(ratio: AspectRatio) {
|
|
506
508
|
this._state.aspectRatio = ratio;
|
|
507
|
-
|
|
509
|
+
NativePlayerModule.setAspectRatio(this._view.nativeHandle, ratio);
|
|
508
510
|
}
|
|
509
511
|
|
|
510
512
|
get keepScreenOn(): boolean {
|
|
@@ -514,21 +516,21 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
|
|
|
514
516
|
set keepScreenOn(value: boolean) {
|
|
515
517
|
this._state.keepScreenOn = value;
|
|
516
518
|
if (Platform.OS === 'android') {
|
|
517
|
-
|
|
519
|
+
NativePlayerModule.setKeepScreenOn(this._view.nativeHandle, value);
|
|
518
520
|
}
|
|
519
521
|
}
|
|
520
522
|
|
|
521
523
|
pause(): void {
|
|
522
524
|
if (this.hasValidSource()) {
|
|
523
525
|
this._state.paused = true;
|
|
524
|
-
|
|
526
|
+
NativePlayerModule.setPaused(this._view.nativeHandle, true);
|
|
525
527
|
}
|
|
526
528
|
}
|
|
527
529
|
|
|
528
530
|
play(): void {
|
|
529
531
|
if (this.hasValidSource()) {
|
|
530
532
|
this._state.paused = false;
|
|
531
|
-
|
|
533
|
+
NativePlayerModule.setPaused(this._view.nativeHandle, false);
|
|
532
534
|
}
|
|
533
535
|
}
|
|
534
536
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ABRConfiguration, ABRStrategy, THEOplayerView } from 'react-native-theoplayer';
|
|
2
2
|
import { NativeModules } from 'react-native';
|
|
3
3
|
|
|
4
|
+
const NativePlayerModule = NativeModules.THEORCTPlayerModule;
|
|
5
|
+
|
|
4
6
|
export class AbrAdapter implements ABRConfiguration {
|
|
5
7
|
private readonly _view: THEOplayerView;
|
|
6
8
|
private _strategy: ABRStrategy | undefined;
|
|
@@ -29,7 +31,7 @@ export class AbrAdapter implements ABRConfiguration {
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
private updateConfig() {
|
|
32
|
-
|
|
34
|
+
NativePlayerModule.setABRConfig(this._view.nativeHandle, {
|
|
33
35
|
targetBuffer: this._targetBuffer,
|
|
34
36
|
strategy: this._strategy,
|
|
35
37
|
});
|
|
@@ -2,6 +2,8 @@ import type { Ad, AdBreak, AdDescription, AdsAPI, GoogleDAI, THEOplayerView } fr
|
|
|
2
2
|
import { NativeModules } from 'react-native';
|
|
3
3
|
import { THEOplayerNativeGoogleDAI } from './THEOplayerNativeGoogleDAI';
|
|
4
4
|
|
|
5
|
+
const NativeAdsModule = NativeModules.THEORCTAdsModule;
|
|
6
|
+
|
|
5
7
|
export class THEOplayerNativeAdsAdapter implements AdsAPI {
|
|
6
8
|
private readonly _dai: GoogleDAI;
|
|
7
9
|
|
|
@@ -10,27 +12,27 @@ export class THEOplayerNativeAdsAdapter implements AdsAPI {
|
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
playing(): Promise<boolean> {
|
|
13
|
-
return
|
|
15
|
+
return NativeAdsModule.playing(this._player.nativeHandle);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
skip(): void {
|
|
17
|
-
|
|
19
|
+
NativeAdsModule.skip(this._player.nativeHandle);
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
currentAdBreak(): Promise<AdBreak> {
|
|
21
|
-
return
|
|
23
|
+
return NativeAdsModule.currentAdBreak(this._player.nativeHandle);
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
currentAds(): Promise<Ad[]> {
|
|
25
|
-
return
|
|
27
|
+
return NativeAdsModule.currentAds(this._player.nativeHandle);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
scheduledAdBreaks(): Promise<AdBreak[]> {
|
|
29
|
-
return
|
|
31
|
+
return NativeAdsModule.scheduledAdBreaks(this._player.nativeHandle);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
schedule(ad: AdDescription): void {
|
|
33
|
-
|
|
35
|
+
NativeAdsModule.schedule(this._player.nativeHandle, ad);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
get dai(): GoogleDAI | undefined {
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import type { GoogleDAI, THEOplayerView } from 'react-native-theoplayer';
|
|
2
2
|
import { NativeModules } from 'react-native';
|
|
3
3
|
|
|
4
|
+
const NativeAdsModule = NativeModules.THEORCTAdsModule;
|
|
5
|
+
|
|
4
6
|
export class THEOplayerNativeGoogleDAI implements GoogleDAI {
|
|
5
7
|
public constructor(private readonly _player: THEOplayerView) {}
|
|
6
8
|
|
|
7
9
|
get snapback(): Promise<boolean> {
|
|
8
|
-
return
|
|
10
|
+
return NativeAdsModule.daiSnapback(this._player.nativeHandle);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
setSnapback(enabled: boolean): void {
|
|
12
|
-
|
|
14
|
+
NativeAdsModule.daiSetSnapback(this._player.nativeHandle, enabled);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
contentTimeForStreamTime(time: number): Promise<number> {
|
|
16
|
-
return
|
|
18
|
+
return NativeAdsModule.daiContentTimeForStreamTime(this._player.nativeHandle, time);
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
streamTimeForContentTime(time: number): Promise<number> {
|
|
20
|
-
return
|
|
22
|
+
return NativeAdsModule.daiStreamTimeForContentTime(this._player.nativeHandle, time);
|
|
21
23
|
}
|
|
22
24
|
}
|
|
@@ -3,6 +3,8 @@ import { NativeModules } from 'react-native';
|
|
|
3
3
|
import type { THEOplayerAdapter } from '../THEOplayerAdapter';
|
|
4
4
|
import type { StringKeyOf } from '../../../api/event/EventDispatcher';
|
|
5
5
|
|
|
6
|
+
const NativeEventBroadcastModule = NativeModules.THEORCTEventBroadcastModule;
|
|
7
|
+
|
|
6
8
|
export class EventBroadcastAdapter implements EventBroadcastAPI {
|
|
7
9
|
constructor(private _player: THEOplayer) {}
|
|
8
10
|
|
|
@@ -12,7 +14,7 @@ export class EventBroadcastAdapter implements EventBroadcastAPI {
|
|
|
12
14
|
|
|
13
15
|
try {
|
|
14
16
|
// Broadcast native event.
|
|
15
|
-
|
|
17
|
+
NativeEventBroadcastModule.broadcastEvent(this._player.nativeHandle, Object.freeze(event));
|
|
16
18
|
} catch (e) {
|
|
17
19
|
console.warn(`EventBroadcastModule not available: ${e}`);
|
|
18
20
|
}
|
|
@@ -2,6 +2,8 @@ import type { Airplay } from 'react-native-theoplayer';
|
|
|
2
2
|
import { CastEvent, CastEventType, CastState, PlayerEventType, THEOplayer } from 'react-native-theoplayer';
|
|
3
3
|
import { NativeModules } from 'react-native';
|
|
4
4
|
|
|
5
|
+
const NativeCastModule = NativeModules.THEORCTCastModule;
|
|
6
|
+
|
|
5
7
|
export class THEOplayerNativeAirplay implements Airplay {
|
|
6
8
|
private readonly _player: THEOplayer;
|
|
7
9
|
|
|
@@ -14,8 +16,8 @@ export class THEOplayerNativeAirplay implements Airplay {
|
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
async init_(): Promise<void> {
|
|
17
|
-
this._casting = await
|
|
18
|
-
this._state = await
|
|
19
|
+
this._casting = await NativeCastModule.airplayCasting(this._player.nativeHandle);
|
|
20
|
+
this._state = await NativeCastModule.airplayState(this._player.nativeHandle);
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
private readonly _onCastStateChange = (event: CastEvent) => {
|
|
@@ -34,11 +36,11 @@ export class THEOplayerNativeAirplay implements Airplay {
|
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
start(): void {
|
|
37
|
-
|
|
39
|
+
NativeCastModule.airplayStart(this._player.nativeHandle);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
stop(): void {
|
|
41
|
-
|
|
43
|
+
NativeCastModule.airplayStop(this._player.nativeHandle);
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
unload_(): void {
|
|
@@ -2,6 +2,8 @@ import type { CastEvent, Chromecast, THEOplayerView } from 'react-native-theopla
|
|
|
2
2
|
import { CastEventType, CastState, PlayerEventType, THEOplayer } from 'react-native-theoplayer';
|
|
3
3
|
import { NativeModules } from 'react-native';
|
|
4
4
|
|
|
5
|
+
const NativeCastModule = NativeModules.THEORCTCastModule;
|
|
6
|
+
|
|
5
7
|
export class THEOplayerNativeChromecast implements Chromecast {
|
|
6
8
|
private readonly _player: THEOplayer;
|
|
7
9
|
private readonly _view: THEOplayerView;
|
|
@@ -16,8 +18,8 @@ export class THEOplayerNativeChromecast implements Chromecast {
|
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
async init_(): Promise<void> {
|
|
19
|
-
this._casting = await
|
|
20
|
-
this._state = await
|
|
21
|
+
this._casting = await NativeCastModule.chromecastCasting(this._view.nativeHandle);
|
|
22
|
+
this._state = await NativeCastModule.chromecastState(this._view.nativeHandle);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
private readonly _onCastStateChange = (event: CastEvent) => {
|
|
@@ -36,19 +38,19 @@ export class THEOplayerNativeChromecast implements Chromecast {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
start(): void {
|
|
39
|
-
|
|
41
|
+
NativeCastModule.chromecastStart(this._view.nativeHandle);
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
stop(): void {
|
|
43
|
-
|
|
45
|
+
NativeCastModule.chromecastStop(this._view.nativeHandle);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
join(): void {
|
|
47
|
-
|
|
49
|
+
NativeCastModule.chromecastJoin(this._view.nativeHandle);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
leave(): void {
|
|
51
|
-
|
|
53
|
+
NativeCastModule.chromecastLeave(this._view.nativeHandle);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
unload_(): void {
|
|
@@ -3,6 +3,7 @@ import { NativeModules } from 'react-native';
|
|
|
3
3
|
import NamedColors from './NamedColors.json';
|
|
4
4
|
|
|
5
5
|
const namedColorsMap = NamedColors as { [name: string]: string };
|
|
6
|
+
const NativePlayerModule = NativeModules.THEORCTPlayerModule;
|
|
6
7
|
|
|
7
8
|
export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
8
9
|
private _backgroundColor: string | undefined = undefined;
|
|
@@ -24,7 +25,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
|
24
25
|
|
|
25
26
|
set backgroundColor(color: string | undefined) {
|
|
26
27
|
this._backgroundColor = color;
|
|
27
|
-
|
|
28
|
+
NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {
|
|
28
29
|
backgroundColor: convertColorToRGBA(color),
|
|
29
30
|
});
|
|
30
31
|
}
|
|
@@ -35,7 +36,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
|
35
36
|
|
|
36
37
|
set edgeStyle(style: EdgeStyle | undefined) {
|
|
37
38
|
this._edgeStyle = style;
|
|
38
|
-
|
|
39
|
+
NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {
|
|
39
40
|
edgeStyle: style,
|
|
40
41
|
});
|
|
41
42
|
}
|
|
@@ -46,7 +47,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
|
46
47
|
|
|
47
48
|
set fontColor(color: string | undefined) {
|
|
48
49
|
this._fontColor = color;
|
|
49
|
-
|
|
50
|
+
NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {
|
|
50
51
|
fontColor: convertColorToRGBA(color),
|
|
51
52
|
});
|
|
52
53
|
}
|
|
@@ -57,7 +58,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
|
57
58
|
|
|
58
59
|
set fontFamily(family: string | undefined) {
|
|
59
60
|
this._fontFamily = family;
|
|
60
|
-
|
|
61
|
+
NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {
|
|
61
62
|
fontFamily: family,
|
|
62
63
|
});
|
|
63
64
|
}
|
|
@@ -68,7 +69,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
|
68
69
|
|
|
69
70
|
set fontSize(size: string | undefined) {
|
|
70
71
|
this._fontSize = size;
|
|
71
|
-
|
|
72
|
+
NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {
|
|
72
73
|
fontSize: fromPercentage(size),
|
|
73
74
|
});
|
|
74
75
|
}
|
|
@@ -79,7 +80,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
|
79
80
|
|
|
80
81
|
set windowColor(color: string | undefined) {
|
|
81
82
|
this._windowColor = color;
|
|
82
|
-
|
|
83
|
+
NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {
|
|
83
84
|
windowColor: convertColorToRGBA(color),
|
|
84
85
|
});
|
|
85
86
|
}
|
|
@@ -90,7 +91,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
|
90
91
|
|
|
91
92
|
set marginBottom(margin: number | undefined) {
|
|
92
93
|
this._marginBottom = margin;
|
|
93
|
-
|
|
94
|
+
NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {
|
|
94
95
|
marginBottom: margin,
|
|
95
96
|
});
|
|
96
97
|
}
|
|
@@ -101,7 +102,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
|
101
102
|
|
|
102
103
|
set marginLeft(margin: number | undefined) {
|
|
103
104
|
this._marginLeft = margin;
|
|
104
|
-
|
|
105
|
+
NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {
|
|
105
106
|
marginLeft: margin,
|
|
106
107
|
});
|
|
107
108
|
}
|
|
@@ -112,7 +113,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
|
112
113
|
|
|
113
114
|
set marginRight(margin: number | undefined) {
|
|
114
115
|
this._marginRight = margin;
|
|
115
|
-
|
|
116
|
+
NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {
|
|
116
117
|
marginRight: margin,
|
|
117
118
|
});
|
|
118
119
|
}
|
|
@@ -123,7 +124,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle {
|
|
|
123
124
|
|
|
124
125
|
set marginTop(margin: number | undefined) {
|
|
125
126
|
this._marginTop = margin;
|
|
126
|
-
|
|
127
|
+
NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {
|
|
127
128
|
marginTop: margin,
|
|
128
129
|
});
|
|
129
130
|
}
|
|
@@ -13,6 +13,8 @@ import { toNativeCachingTaskParameters } from "./NativeCachingTaskParametersAdap
|
|
|
13
13
|
|
|
14
14
|
const TAG = "NativeMediaCache";
|
|
15
15
|
|
|
16
|
+
const NativeCacheModule = NativeModules.THEORCTCacheModule;
|
|
17
|
+
|
|
16
18
|
interface NativeCachingStatusChangeEvent {
|
|
17
19
|
readonly id: string;
|
|
18
20
|
readonly status: CacheTaskStatus;
|
|
@@ -43,7 +45,7 @@ interface NativeCachingTaskProgressEvent {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export class NativeMediaCache extends DefaultEventDispatcher<CacheEventMap> implements MediaCacheAPI {
|
|
46
|
-
private _emitter: NativeEventEmitter = new NativeEventEmitter(
|
|
48
|
+
private _emitter: NativeEventEmitter = new NativeEventEmitter(NativeCacheModule);
|
|
47
49
|
private _status: CacheStatus = CacheStatus.uninitialised;
|
|
48
50
|
private _tasks: NativeCachingTaskAdapter[] = [];
|
|
49
51
|
|
|
@@ -58,7 +60,7 @@ export class NativeMediaCache extends DefaultEventDispatcher<CacheEventMap> impl
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
async createTask(source: SourceDescription, parameters: CachingTaskParameters): Promise<CachingTask> {
|
|
61
|
-
return
|
|
63
|
+
return NativeCacheModule.createTask(source, toNativeCachingTaskParameters(parameters));
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
get status(): CacheStatus {
|
|
@@ -81,7 +83,7 @@ export class NativeMediaCache extends DefaultEventDispatcher<CacheEventMap> impl
|
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
private async getInitialState(): Promise<void> {
|
|
84
|
-
const initialState = await
|
|
86
|
+
const initialState = await NativeCacheModule.getInitialState();
|
|
85
87
|
this._status = initialState.status;
|
|
86
88
|
this._tasks = initialState.tasks.map((task: NativeCachingTask) => new NativeCachingTaskAdapter(task));
|
|
87
89
|
}
|
|
@@ -12,6 +12,8 @@ import { NativeModules } from 'react-native';
|
|
|
12
12
|
import type { DRMConfiguration } from 'react-native-theoplayer';
|
|
13
13
|
import { fromNativeCachingTaskParameters, NativeCachingTaskParameters } from "./NativeCachingTaskParametersAdapter";
|
|
14
14
|
|
|
15
|
+
const NativeCacheModule = NativeModules.THEORCTCacheModule;
|
|
16
|
+
|
|
15
17
|
export interface NativeCachingTask {
|
|
16
18
|
readonly id: string;
|
|
17
19
|
|
|
@@ -56,7 +58,7 @@ export class NativeCachingTaskAdapter extends DefaultEventDispatcher<CachingTask
|
|
|
56
58
|
this.bytesCached = task.bytesCached;
|
|
57
59
|
this.license = {
|
|
58
60
|
renew(drmConfiguration?: DRMConfiguration) {
|
|
59
|
-
|
|
61
|
+
NativeCacheModule.renewLicense(task.id, drmConfiguration);
|
|
60
62
|
},
|
|
61
63
|
};
|
|
62
64
|
this.parameters = fromNativeCachingTaskParameters(task.parameters);
|
|
@@ -68,14 +70,14 @@ export class NativeCachingTaskAdapter extends DefaultEventDispatcher<CachingTask
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
pause(): void {
|
|
71
|
-
|
|
73
|
+
NativeCacheModule.pauseCachingTask(this.id);
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
remove(): void {
|
|
75
|
-
|
|
77
|
+
NativeCacheModule.removeCachingTask(this.id);
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
start(): void {
|
|
79
|
-
|
|
81
|
+
NativeCacheModule.startCachingTask(this.id);
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -10,6 +10,8 @@ import { fromNativeCertificateRequest, NativeCertificateRequest, toNativeCertifi
|
|
|
10
10
|
import { fromNativeCertificateResponse, NativeCertificateResponse, toNativeCertificateResponseResult } from './NativeCertificateResponse';
|
|
11
11
|
import { isBufferSource } from '../utils/TypeUtils';
|
|
12
12
|
|
|
13
|
+
const NativeContentProtectionModule = NativeModules.THEORCTContentProtectionModule;
|
|
14
|
+
|
|
13
15
|
interface WrappedContentProtectionIntegrationFactory {
|
|
14
16
|
integrationId: string;
|
|
15
17
|
keySystemId: string;
|
|
@@ -36,7 +38,7 @@ export class NativeContentProtectionRegistry implements ContentProtectionAPI {
|
|
|
36
38
|
private currentIntegration: WrappedContentProtectionIntegration | undefined = undefined;
|
|
37
39
|
|
|
38
40
|
constructor() {
|
|
39
|
-
this.emitter = new NativeEventEmitter(
|
|
41
|
+
this.emitter = new NativeEventEmitter(NativeContentProtectionModule);
|
|
40
42
|
this.emitter.addListener('onBuildIntegration', this.onBuildIntegrationRequest);
|
|
41
43
|
this.emitter.addListener('onCertificateRequest', this.onCertificateRequest);
|
|
42
44
|
this.emitter.addListener('onCertificateResponse', this.onCertificateResponse);
|
|
@@ -51,7 +53,7 @@ export class NativeContentProtectionRegistry implements ContentProtectionAPI {
|
|
|
51
53
|
keySystemId,
|
|
52
54
|
integrationFactory,
|
|
53
55
|
});
|
|
54
|
-
|
|
56
|
+
NativeContentProtectionModule.registerContentProtectionIntegration(integrationId, keySystemId);
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
private getFactory(integrationId: string, keySystemId: string): ContentProtectionIntegrationFactory | undefined {
|
|
@@ -66,7 +68,7 @@ export class NativeContentProtectionRegistry implements ContentProtectionAPI {
|
|
|
66
68
|
|
|
67
69
|
private onBuildIntegrationRequest = (event: BuildEvent) => {
|
|
68
70
|
const { requestId, integrationId, keySystemId, drmConfig } = event;
|
|
69
|
-
console.log('
|
|
71
|
+
console.log('NativeContentProtectionModule', `onBuildIntegrationRequest ${integrationId} ${keySystemId}`);
|
|
70
72
|
const factory = this.getFactory(integrationId, keySystemId);
|
|
71
73
|
if (factory) {
|
|
72
74
|
this.currentIntegration = {
|
|
@@ -74,9 +76,9 @@ export class NativeContentProtectionRegistry implements ContentProtectionAPI {
|
|
|
74
76
|
keySystemId,
|
|
75
77
|
integration: factory.build(drmConfig),
|
|
76
78
|
};
|
|
77
|
-
|
|
79
|
+
NativeContentProtectionModule.onBuildProcessed({ requestId, resultString: 'success' });
|
|
78
80
|
} else {
|
|
79
|
-
|
|
81
|
+
NativeContentProtectionModule.onBuildProcessed({
|
|
80
82
|
requestId,
|
|
81
83
|
resultString: 'failed',
|
|
82
84
|
});
|
|
@@ -85,40 +87,40 @@ export class NativeContentProtectionRegistry implements ContentProtectionAPI {
|
|
|
85
87
|
|
|
86
88
|
private onCertificateRequest = async (request: NativeCertificateRequest) => {
|
|
87
89
|
const { requestId, integrationId, keySystemId } = request;
|
|
88
|
-
console.log('
|
|
90
|
+
console.log('NativeContentProtectionModule', `onCertificateRequest ${integrationId} ${keySystemId}`);
|
|
89
91
|
const integration = this.getIntegration(integrationId, keySystemId);
|
|
90
92
|
if (integration?.onCertificateRequest) {
|
|
91
93
|
const result = await integration.onCertificateRequest(fromNativeCertificateRequest(request));
|
|
92
94
|
// TODO: we also want to support ArrayBufferView results
|
|
93
95
|
if (isBufferSource(result)) {
|
|
94
96
|
const nativeResponse = toNativeCertificateResponseResult(requestId, integrationId, keySystemId, result as ArrayBuffer);
|
|
95
|
-
|
|
97
|
+
NativeContentProtectionModule.onCertificateRequestProcessedAsCertificate(nativeResponse);
|
|
96
98
|
} else if (result as CertificateRequest) {
|
|
97
99
|
const modifiedNativeRequest = toNativeCertificateRequest(requestId, integrationId, keySystemId, result as CertificateRequest);
|
|
98
|
-
|
|
100
|
+
NativeContentProtectionModule.onCertificateRequestProcessedAsRequest(modifiedNativeRequest);
|
|
99
101
|
}
|
|
100
102
|
} else {
|
|
101
|
-
|
|
103
|
+
NativeContentProtectionModule.onCertificateRequestProcessedAsRequest(request);
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
private onCertificateResponse = async (response: NativeCertificateResponse) => {
|
|
106
108
|
const { requestId, integrationId, keySystemId } = response;
|
|
107
|
-
console.log('
|
|
109
|
+
console.log('NativeContentProtectionModule', `onCertificateResponse ${integrationId} ${keySystemId}`);
|
|
108
110
|
const integration = this.getIntegration(integrationId, keySystemId);
|
|
109
111
|
if (integration?.onCertificateResponse) {
|
|
110
112
|
const responseResult = await integration.onCertificateResponse(fromNativeCertificateResponse(response));
|
|
111
113
|
// TODO: we also want to support ArrayBufferView results
|
|
112
114
|
const modifiedNativeResponse = toNativeCertificateResponseResult(requestId, integrationId, keySystemId, responseResult as ArrayBuffer);
|
|
113
|
-
|
|
115
|
+
NativeContentProtectionModule.onCertificateResponseProcessed(modifiedNativeResponse);
|
|
114
116
|
} else {
|
|
115
|
-
|
|
117
|
+
NativeContentProtectionModule.onCertificateResponseProcessed(response);
|
|
116
118
|
}
|
|
117
119
|
};
|
|
118
120
|
|
|
119
121
|
private onLicenseRequest = async (request: NativeLicenseRequest) => {
|
|
120
122
|
const { requestId, integrationId, keySystemId } = request;
|
|
121
|
-
console.log('
|
|
123
|
+
console.log('NativeContentProtectionModule', `onLicenseRequest ${integrationId} ${keySystemId}`);
|
|
122
124
|
const integration = this.getIntegration(integrationId, keySystemId);
|
|
123
125
|
// Optionally let the custom integration modify the request.
|
|
124
126
|
if (integration?.onLicenseRequest) {
|
|
@@ -126,43 +128,43 @@ export class NativeContentProtectionRegistry implements ContentProtectionAPI {
|
|
|
126
128
|
// TODO: we also want to support ArrayBufferView results
|
|
127
129
|
if (isBufferSource(result)) {
|
|
128
130
|
const nativeResponse = toNativeLicenseResponseResult(requestId, integrationId, keySystemId, result as ArrayBuffer);
|
|
129
|
-
|
|
131
|
+
NativeContentProtectionModule.onLicenseRequestProcessedAsLicense(nativeResponse);
|
|
130
132
|
} else if (result as LicenseRequest) {
|
|
131
133
|
const modifiedNativeRequest = toNativeLicenseRequest(requestId, integrationId, keySystemId, result as LicenseRequest);
|
|
132
|
-
|
|
134
|
+
NativeContentProtectionModule.onLicenseRequestProcessedAsRequest(modifiedNativeRequest);
|
|
133
135
|
}
|
|
134
136
|
} else {
|
|
135
|
-
|
|
137
|
+
NativeContentProtectionModule.onLicenseRequestProcessedAsRequest(request);
|
|
136
138
|
}
|
|
137
139
|
};
|
|
138
140
|
|
|
139
141
|
private onLicenseResponse = async (response: NativeLicenseResponse) => {
|
|
140
142
|
const { requestId, integrationId, keySystemId } = response;
|
|
141
|
-
console.log('
|
|
143
|
+
console.log('NativeContentProtectionModule', `onLicenseResponse ${integrationId} ${keySystemId}`);
|
|
142
144
|
const integration = this.getIntegration(integrationId, keySystemId);
|
|
143
145
|
if (integration?.onLicenseResponse) {
|
|
144
146
|
const responseResult = await integration.onLicenseResponse(fromNativeLicenseResponse(response));
|
|
145
147
|
// TODO: we also want to support ArrayBufferView results
|
|
146
148
|
const modifiedNativeResponse = toNativeLicenseResponseResult(requestId, integrationId, keySystemId, responseResult as ArrayBuffer);
|
|
147
|
-
|
|
149
|
+
NativeContentProtectionModule.onLicenseResponseProcessed(modifiedNativeResponse);
|
|
148
150
|
} else {
|
|
149
|
-
|
|
151
|
+
NativeContentProtectionModule.onLicenseResponseProcessed(response);
|
|
150
152
|
}
|
|
151
153
|
};
|
|
152
154
|
|
|
153
155
|
private onExtractFairplayContentId = async (event: ExtractFaiplayContentIdEvent) => {
|
|
154
156
|
const { integrationId, keySystemId, fairplaySkdUrl, requestId } = event;
|
|
155
|
-
console.log('
|
|
157
|
+
console.log('NativeContentProtectionModule', `onExtractFairplayContentId ${integrationId} ${keySystemId}`);
|
|
156
158
|
const integration = this.getIntegration(integrationId, keySystemId);
|
|
157
159
|
if (integration?.extractFairplayContentId) {
|
|
158
160
|
const contentId = await integration.extractFairplayContentId(fairplaySkdUrl);
|
|
159
|
-
|
|
161
|
+
NativeContentProtectionModule.onExtractFairplayContentIdProcessed({
|
|
160
162
|
requestId,
|
|
161
163
|
contentId,
|
|
162
164
|
});
|
|
163
165
|
} else {
|
|
164
166
|
const contentId = fairplaySkdUrl;
|
|
165
|
-
|
|
167
|
+
NativeContentProtectionModule.onExtractFairplayContentIdProcessed({
|
|
166
168
|
requestId,
|
|
167
169
|
contentId,
|
|
168
170
|
});
|