react-native-theoplayer 1.7.2 → 1.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/README.md +2 -0
- package/android/src/main/java/com/theoplayer/PlayerConfigAdapter.kt +115 -0
- package/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +648 -0
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerPackage.kt +23 -0
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerView.kt +446 -0
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerViewManager.kt +117 -0
- package/android/src/main/java/com/theoplayer/{TimeUpdateRate.java → TimeUpdateRate.kt} +2 -2
- package/android/src/main/java/com/theoplayer/ads/AdAdapter.kt +161 -0
- package/android/src/main/java/com/theoplayer/ads/AdEventAdapter.kt +90 -0
- package/android/src/main/java/com/theoplayer/ads/AdsModule.kt +140 -0
- package/android/src/main/java/com/theoplayer/cast/CastEventAdapter.kt +81 -0
- package/android/src/main/java/com/theoplayer/cast/CastModule.kt +75 -0
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionAdapter.kt +2 -2
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +1 -2
- package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegration.kt +1 -2
- package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegrationFactory.kt +3 -5
- package/android/src/main/java/com/theoplayer/source/SourceAdapter.kt +402 -0
- package/android/src/main/java/com/theoplayer/track/MediaTrackEventType.kt +6 -0
- package/android/src/main/java/com/theoplayer/track/MediaTrackType.kt +6 -0
- package/android/src/main/java/com/theoplayer/track/QualityListAdapter.kt +43 -0
- package/android/src/main/java/com/theoplayer/track/QualityListFilter.kt +28 -0
- package/android/src/main/java/com/theoplayer/track/TextTrackCueEventType.kt +10 -0
- package/android/src/main/java/com/theoplayer/track/TrackEventType.kt +7 -0
- package/android/src/main/java/com/theoplayer/track/TrackListAdapter.kt +219 -0
- package/android/src/main/java/com/theoplayer/util/ViewResolver.kt +19 -0
- package/ios/THEOplayerRCTAdAggregator.swift +12 -6
- package/ios/THEOplayerRCTAdsAPI.swift +39 -40
- package/ios/THEOplayerRCTBridge.m +52 -1
- package/ios/THEOplayerRCTCastAPI.swift +275 -0
- package/ios/THEOplayerRCTDebug.swift +3 -0
- package/ios/THEOplayerRCTSourceDescriptionBuilder.swift +91 -19
- package/ios/{THEOplayerRCTMetadataAggregator.swift → THEOplayerRCTTrackMetadataAggregator.swift} +12 -12
- package/ios/THEOplayerRCTView.swift +104 -24
- package/ios/THEOplayerRCTViewAdEventHandler.swift +2 -2
- package/ios/THEOplayerRCTViewCastEventHandler.swift +124 -0
- package/ios/THEOplayerRCTViewMainEventHandler.swift +1 -1
- package/ios/THEOplayerRCTViewMediaTrackEventHandler.swift +6 -6
- package/ios/THEOplayerRCTViewTextTrackEventHandler.swift +5 -5
- package/ios/custom/Frameworks/ios/put_custom_ios_xcframework_here.txt +1 -1
- package/ios/custom/Frameworks/tvos/put_custom_tvos_xcframework_here.txt +2 -0
- package/ios/custom/react-native-theoplayer_custom.podspec +46 -0
- package/lib/commonjs/api/THEOplayerView.js.map +1 -1
- package/lib/commonjs/api/barrel.js +21 -8
- package/lib/commonjs/api/barrel.js.map +1 -1
- package/lib/commonjs/api/cast/Airplay.js +6 -0
- package/lib/commonjs/api/cast/Airplay.js.map +1 -0
- package/lib/commonjs/api/cast/CastAPI.js +6 -0
- package/lib/commonjs/api/cast/CastAPI.js.map +1 -0
- package/lib/commonjs/api/cast/CastConfiguration.js +2 -0
- package/lib/commonjs/api/cast/CastConfiguration.js.map +1 -0
- package/lib/commonjs/api/cast/CastState.js +2 -0
- package/lib/commonjs/api/cast/CastState.js.map +1 -0
- package/lib/commonjs/api/cast/Chromecast.js +6 -0
- package/lib/commonjs/api/cast/Chromecast.js.map +1 -0
- package/lib/commonjs/api/cast/barrel.js +71 -0
- package/lib/commonjs/api/cast/barrel.js.map +1 -0
- package/lib/commonjs/api/config/PlayerConfiguration.js.map +1 -1
- package/lib/commonjs/api/error/ChromecastError.js +2 -0
- package/lib/commonjs/api/error/ChromecastError.js.map +1 -0
- package/lib/commonjs/api/error/barrel.js +13 -0
- package/lib/commonjs/api/error/barrel.js.map +1 -1
- package/lib/commonjs/api/event/CastEvent.js +21 -0
- package/lib/commonjs/api/event/CastEvent.js.map +1 -0
- package/lib/commonjs/api/event/barrel.js +25 -12
- package/lib/commonjs/api/event/barrel.js.map +1 -1
- package/lib/commonjs/api/source/SourceDescription.js.map +1 -1
- package/lib/commonjs/api/source/barrel.js +13 -0
- package/lib/commonjs/api/source/barrel.js.map +1 -1
- package/lib/commonjs/api/source/metadata/MetadataDescription.js +2 -0
- package/lib/commonjs/api/source/metadata/MetadataDescription.js.map +1 -0
- package/lib/commonjs/api/source/metadata/barrel.js +19 -0
- package/lib/commonjs/api/source/metadata/barrel.js.map +1 -0
- package/lib/commonjs/internal/THEOplayerView.js +16 -0
- package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.web.js +9 -0
- package/lib/commonjs/internal/THEOplayerView.web.js.map +1 -1
- package/lib/commonjs/internal/cast/THEOplayerNativeAirplay.js +34 -0
- package/lib/commonjs/internal/cast/THEOplayerNativeAirplay.js.map +1 -0
- package/lib/commonjs/internal/cast/THEOplayerNativeCastApi.js +46 -0
- package/lib/commonjs/internal/cast/THEOplayerNativeCastApi.js.map +1 -0
- package/lib/commonjs/internal/cast/THEOplayerNativeChromecast.js +42 -0
- package/lib/commonjs/internal/cast/THEOplayerNativeChromecast.js.map +1 -0
- package/lib/commonjs/internal/cast/THEOplayerWebCastApi.js +31 -0
- package/lib/commonjs/internal/cast/THEOplayerWebCastApi.js.map +1 -0
- package/lib/commonjs/internal/web/stub/CastButtonStub.js +16 -0
- package/lib/commonjs/internal/web/stub/CastButtonStub.js.map +1 -0
- package/lib/module/api/THEOplayerView.js.map +1 -1
- package/lib/module/api/barrel.js +1 -0
- package/lib/module/api/barrel.js.map +1 -1
- package/lib/module/api/cast/Airplay.js +2 -0
- package/lib/module/api/cast/Airplay.js.map +1 -0
- package/lib/module/api/cast/CastAPI.js +2 -0
- package/lib/module/api/cast/CastAPI.js.map +1 -0
- package/lib/module/api/cast/CastConfiguration.js +2 -0
- package/lib/module/api/cast/CastConfiguration.js.map +1 -0
- package/lib/module/api/cast/CastState.js +2 -0
- package/lib/module/api/cast/CastState.js.map +1 -0
- package/lib/module/api/cast/Chromecast.js +2 -0
- package/lib/module/api/cast/Chromecast.js.map +1 -0
- package/lib/module/api/cast/barrel.js +6 -0
- package/lib/module/api/cast/barrel.js.map +1 -0
- package/lib/module/api/config/PlayerConfiguration.js.map +1 -1
- package/lib/module/api/error/ChromecastError.js +2 -0
- package/lib/module/api/error/ChromecastError.js.map +1 -0
- package/lib/module/api/error/barrel.js +1 -0
- package/lib/module/api/error/barrel.js.map +1 -1
- package/lib/module/api/event/CastEvent.js +14 -0
- package/lib/module/api/event/CastEvent.js.map +1 -0
- package/lib/module/api/event/barrel.js +2 -1
- package/lib/module/api/event/barrel.js.map +1 -1
- package/lib/module/api/source/SourceDescription.js.map +1 -1
- package/lib/module/api/source/barrel.js +1 -0
- package/lib/module/api/source/barrel.js.map +1 -1
- package/lib/module/api/source/metadata/MetadataDescription.js +2 -0
- package/lib/module/api/source/metadata/MetadataDescription.js.map +1 -0
- package/lib/module/api/source/metadata/barrel.js +2 -0
- package/lib/module/api/source/metadata/barrel.js.map +1 -0
- package/lib/module/internal/THEOplayerView.js +15 -0
- package/lib/module/internal/THEOplayerView.js.map +1 -1
- package/lib/module/internal/THEOplayerView.web.js +8 -0
- package/lib/module/internal/THEOplayerView.web.js.map +1 -1
- package/lib/module/internal/cast/THEOplayerNativeAirplay.js +24 -0
- package/lib/module/internal/cast/THEOplayerNativeAirplay.js.map +1 -0
- package/lib/module/internal/cast/THEOplayerNativeCastApi.js +34 -0
- package/lib/module/internal/cast/THEOplayerNativeCastApi.js.map +1 -0
- package/lib/module/internal/cast/THEOplayerNativeChromecast.js +32 -0
- package/lib/module/internal/cast/THEOplayerNativeChromecast.js.map +1 -0
- package/lib/module/internal/cast/THEOplayerWebCastApi.js +22 -0
- package/lib/module/internal/cast/THEOplayerWebCastApi.js.map +1 -0
- package/lib/module/internal/web/stub/CastButtonStub.js +6 -0
- package/lib/module/internal/web/stub/CastButtonStub.js.map +1 -0
- package/lib/typescript/lib/commonjs/api/cast/Airplay.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/cast/CastAPI.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/cast/CastConfiguration.d.ts +0 -0
- package/lib/typescript/lib/commonjs/api/cast/CastState.d.ts +0 -0
- package/lib/typescript/lib/commonjs/api/cast/Chromecast.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/cast/barrel.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/error/ChromecastError.d.ts +0 -0
- package/lib/typescript/lib/commonjs/api/event/CastEvent.d.ts +2 -0
- package/lib/typescript/lib/commonjs/api/source/metadata/MetadataDescription.d.ts +0 -0
- package/lib/typescript/lib/commonjs/api/source/metadata/barrel.d.ts +1 -0
- package/lib/typescript/lib/commonjs/internal/THEOplayerView.d.ts +3 -0
- package/lib/typescript/lib/commonjs/internal/THEOplayerView.web.d.ts +3 -0
- package/lib/typescript/lib/commonjs/internal/cast/THEOplayerNativeAirplay.d.ts +9 -0
- package/lib/typescript/lib/commonjs/internal/cast/THEOplayerNativeCastApi.d.ts +12 -0
- package/lib/typescript/lib/commonjs/internal/cast/THEOplayerNativeChromecast.d.ts +11 -0
- package/lib/typescript/lib/commonjs/internal/cast/THEOplayerWebCastApi.d.ts +8 -0
- package/lib/typescript/lib/commonjs/internal/web/stub/CastButtonStub.d.ts +2 -0
- package/lib/typescript/lib/module/api/barrel.d.ts +1 -0
- package/lib/typescript/lib/module/api/cast/Airplay.d.ts +1 -0
- package/lib/typescript/lib/module/api/cast/CastAPI.d.ts +1 -0
- package/lib/typescript/lib/module/api/cast/CastConfiguration.d.ts +0 -0
- package/lib/typescript/lib/module/api/cast/CastState.d.ts +0 -0
- package/lib/typescript/lib/module/api/cast/Chromecast.d.ts +1 -0
- package/lib/typescript/lib/module/api/cast/barrel.d.ts +3 -0
- package/lib/typescript/lib/module/api/error/ChromecastError.d.ts +0 -0
- package/lib/typescript/lib/module/api/event/CastEvent.d.ts +1 -0
- package/lib/typescript/lib/module/api/event/barrel.d.ts +2 -1
- package/lib/typescript/lib/module/api/source/barrel.d.ts +1 -0
- package/lib/typescript/lib/module/api/source/metadata/MetadataDescription.d.ts +0 -0
- package/lib/typescript/lib/module/api/source/metadata/barrel.d.ts +1 -0
- package/lib/typescript/lib/module/internal/THEOplayerView.d.ts +3 -0
- package/lib/typescript/lib/module/internal/THEOplayerView.web.d.ts +3 -0
- package/lib/typescript/lib/module/internal/cast/THEOplayerNativeAirplay.d.ts +8 -0
- package/lib/typescript/lib/module/internal/cast/THEOplayerNativeCastApi.d.ts +11 -0
- package/lib/typescript/lib/module/internal/cast/THEOplayerNativeChromecast.d.ts +10 -0
- package/lib/typescript/lib/module/internal/cast/THEOplayerWebCastApi.d.ts +7 -0
- package/lib/typescript/lib/module/internal/web/stub/CastButtonStub.d.ts +2 -0
- package/lib/typescript/src/api/THEOplayerView.d.ts +10 -0
- package/lib/typescript/src/api/barrel.d.ts +1 -0
- package/lib/typescript/src/api/cast/Airplay.d.ts +27 -0
- package/lib/typescript/src/api/cast/CastAPI.d.ts +25 -0
- package/lib/typescript/src/api/cast/CastConfiguration.d.ts +41 -0
- package/lib/typescript/src/api/cast/CastState.d.ts +10 -0
- package/lib/typescript/src/api/cast/Chromecast.d.ts +39 -0
- package/lib/typescript/src/api/cast/barrel.d.ts +5 -0
- package/lib/typescript/src/api/config/PlayerConfiguration.d.ts +6 -1
- package/lib/typescript/src/api/error/ChromecastError.d.ts +34 -0
- package/lib/typescript/src/api/error/barrel.d.ts +1 -0
- package/lib/typescript/src/api/event/CastEvent.d.ts +21 -0
- package/lib/typescript/src/api/event/barrel.d.ts +2 -1
- package/lib/typescript/src/api/source/SourceDescription.d.ts +7 -0
- package/lib/typescript/src/api/source/barrel.d.ts +1 -0
- package/lib/typescript/src/api/source/metadata/MetadataDescription.d.ts +12 -0
- package/lib/typescript/src/api/source/metadata/barrel.d.ts +1 -0
- package/lib/typescript/src/internal/THEOplayerView.d.ts +5 -1
- package/lib/typescript/src/internal/THEOplayerView.web.d.ts +3 -1
- package/lib/typescript/src/internal/cast/THEOplayerNativeAirplay.d.ts +9 -0
- package/lib/typescript/src/internal/cast/THEOplayerNativeCastApi.d.ts +10 -0
- package/lib/typescript/src/internal/cast/THEOplayerNativeChromecast.d.ts +11 -0
- package/lib/typescript/src/internal/cast/THEOplayerWebCastApi.d.ts +9 -0
- package/lib/typescript/src/internal/web/stub/CastButtonStub.d.ts +3 -0
- package/package.json +2 -2
- package/react-native-theoplayer.podspec +2 -2
- package/src/api/THEOplayerView.ts +12 -0
- package/src/api/barrel.ts +1 -0
- package/src/api/cast/Airplay.ts +31 -0
- package/src/api/cast/CastAPI.ts +30 -0
- package/src/api/cast/CastConfiguration.ts +44 -0
- package/src/api/cast/CastState.ts +10 -0
- package/src/api/cast/Chromecast.ts +45 -0
- package/src/api/cast/barrel.ts +5 -0
- package/src/api/config/PlayerConfiguration.ts +7 -1
- package/src/api/error/ChromecastError.ts +46 -0
- package/src/api/error/barrel.ts +1 -0
- package/src/api/event/CastEvent.ts +45 -0
- package/src/api/event/barrel.ts +2 -1
- package/src/api/source/SourceDescription.ts +8 -0
- package/src/api/source/barrel.ts +1 -0
- package/src/api/source/metadata/MetadataDescription.ts +13 -0
- package/src/api/source/metadata/barrel.ts +1 -0
- package/src/internal/THEOplayerView.tsx +17 -0
- package/src/internal/THEOplayerView.web.tsx +8 -1
- package/src/internal/cast/THEOplayerNativeAirplay.ts +22 -0
- package/src/internal/cast/THEOplayerNativeCastApi.ts +28 -0
- package/src/internal/cast/THEOplayerNativeChromecast.ts +30 -0
- package/src/internal/cast/THEOplayerWebCastApi.ts +21 -0
- package/src/internal/web/stub/CastButtonStub.tsx +7 -0
- package/android/src/main/java/com/theoplayer/PlayerConfigHelper.java +0 -70
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerPackage.java +0 -32
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerView.java +0 -525
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerViewManager.java +0 -127
- package/android/src/main/java/com/theoplayer/SourceHelper.java +0 -362
- package/android/src/main/java/com/theoplayer/VideoEventEmitter.java +0 -578
- package/android/src/main/java/com/theoplayer/ads/AdEventAdapter.java +0 -92
- package/android/src/main/java/com/theoplayer/ads/AdInfo.java +0 -168
- package/android/src/main/java/com/theoplayer/ads/AdsModule.java +0 -152
- package/android/src/main/java/com/theoplayer/track/MediaTrackEventType.java +0 -11
- package/android/src/main/java/com/theoplayer/track/MediaTrackType.java +0 -11
- package/android/src/main/java/com/theoplayer/track/QualityListAdapter.java +0 -54
- package/android/src/main/java/com/theoplayer/track/QualityListFilter.java +0 -40
- package/android/src/main/java/com/theoplayer/track/TextTrackCueEventType.java +0 -11
- package/android/src/main/java/com/theoplayer/track/TrackEventType.java +0 -12
- package/android/src/main/java/com/theoplayer/track/TrackListInfo.java +0 -234
- package/android/src/main/java/com/theoplayer/util/ViewResolver.java +0 -42
- package/ios/custom/react-native-theoplayer_custom_ios.podspec +0 -36
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
|
|
3
|
-
import type { AdEvent, AdsAPI, MediaTrack, PlayerError, TextTrack, THEOplayerViewProps, TimeRange } from 'react-native-theoplayer';
|
|
3
|
+
import type { AdEvent, AdsAPI, CastAPI, MediaTrack, PlayerError, TextTrack, THEOplayerViewProps, TimeRange } from 'react-native-theoplayer';
|
|
4
4
|
import {
|
|
5
5
|
AdEventNames,
|
|
6
6
|
MediaTrackEventType,
|
|
@@ -22,6 +22,7 @@ import type {
|
|
|
22
22
|
import * as THEOplayer from 'theoplayer';
|
|
23
23
|
import { findNativeQualitiesByUid, fromNativeCue, fromNativeMediaTrack, fromNativeTextTrack } from './web/TrackUtils';
|
|
24
24
|
import { THEOplayerWebAdsAPI } from './ads/THEOplayerWebAdsAPI';
|
|
25
|
+
import { THEOplayerWebCastAPI } from './cast/THEOplayerWebCastApi';
|
|
25
26
|
|
|
26
27
|
interface THEOplayerRCTViewState {
|
|
27
28
|
isBuffering: boolean;
|
|
@@ -31,6 +32,7 @@ interface THEOplayerRCTViewState {
|
|
|
31
32
|
export class THEOplayerView extends PureComponent<THEOplayerViewProps, THEOplayerRCTViewState> implements THEOplayerViewComponent {
|
|
32
33
|
private _player: THEOplayer.ChromelessPlayer | null = null;
|
|
33
34
|
private readonly _adsApi: THEOplayerWebAdsAPI;
|
|
35
|
+
private readonly _castApi: THEOplayerWebCastAPI;
|
|
34
36
|
|
|
35
37
|
private static initialState: THEOplayerRCTViewState = {
|
|
36
38
|
isBuffering: false,
|
|
@@ -41,6 +43,7 @@ export class THEOplayerView extends PureComponent<THEOplayerViewProps, THEOplaye
|
|
|
41
43
|
super(props);
|
|
42
44
|
this.state = THEOplayerView.initialState;
|
|
43
45
|
this._adsApi = new THEOplayerWebAdsAPI(this);
|
|
46
|
+
this._castApi = new THEOplayerWebCastAPI(this);
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
componentDidMount() {
|
|
@@ -86,6 +89,10 @@ export class THEOplayerView extends PureComponent<THEOplayerViewProps, THEOplaye
|
|
|
86
89
|
return this._adsApi;
|
|
87
90
|
}
|
|
88
91
|
|
|
92
|
+
public get cast(): CastAPI {
|
|
93
|
+
return this._castApi;
|
|
94
|
+
}
|
|
95
|
+
|
|
89
96
|
public get nativePlayer(): THEOplayer.ChromelessPlayer | null {
|
|
90
97
|
return this._player;
|
|
91
98
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Airplay, CastState, THEOplayerView } from 'react-native-theoplayer';
|
|
2
|
+
import { NativeModules } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export class THEOplayerNativeAirplay implements Airplay {
|
|
5
|
+
public constructor(private readonly _player: THEOplayerView) {}
|
|
6
|
+
|
|
7
|
+
casting(): Promise<boolean> {
|
|
8
|
+
return NativeModules.CastModule.airplayCasting(this._player.nativeHandle);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
state(): Promise<CastState> {
|
|
12
|
+
return NativeModules.CastModule.airplayState(this._player.nativeHandle);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
start(): void {
|
|
16
|
+
NativeModules.CastModule.airplayStart(this._player.nativeHandle);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
stop(): void {
|
|
20
|
+
NativeModules.CastModule.airplayStop(this._player.nativeHandle);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
import { THEOplayerNativeChromecast } from './THEOplayerNativeChromecast';
|
|
3
|
+
import { THEOplayerNativeAirplay } from './THEOplayerNativeAirplay';
|
|
4
|
+
import type { Airplay, CastAPI, Chromecast, THEOplayerView } from 'react-native-theoplayer';
|
|
5
|
+
|
|
6
|
+
export class THEOplayerNativeCastAPI implements CastAPI {
|
|
7
|
+
private readonly _chromecast: Chromecast;
|
|
8
|
+
private readonly _airplay: Airplay | undefined;
|
|
9
|
+
|
|
10
|
+
constructor(private readonly _player: THEOplayerView) {
|
|
11
|
+
this._chromecast = new THEOplayerNativeChromecast(this._player);
|
|
12
|
+
if (Platform.OS !== 'android') {
|
|
13
|
+
this._airplay = new THEOplayerNativeAirplay(this._player);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
casting(): Promise<boolean> {
|
|
18
|
+
return NativeModules.CastModule.casting(this._player.nativeHandle);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get chromecast(): Chromecast | undefined {
|
|
22
|
+
return this._chromecast;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get airplay(): Airplay | undefined {
|
|
26
|
+
return this._airplay;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CastState, Chromecast, THEOplayerView } from 'react-native-theoplayer';
|
|
2
|
+
import { NativeModules } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export class THEOplayerNativeChromecast implements Chromecast {
|
|
5
|
+
public constructor(private readonly _player: THEOplayerView) {}
|
|
6
|
+
|
|
7
|
+
casting(): Promise<boolean> {
|
|
8
|
+
return NativeModules.CastModule.chromecastCasting(this._player.nativeHandle);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
state(): Promise<CastState> {
|
|
12
|
+
return NativeModules.CastModule.chromecastState(this._player.nativeHandle);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
start(): void {
|
|
16
|
+
NativeModules.CastModule.chromecastStart(this._player.nativeHandle);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
stop(): void {
|
|
20
|
+
NativeModules.CastModule.chromecastStop(this._player.nativeHandle);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
join(): void {
|
|
24
|
+
NativeModules.CastModule.chromecastJoin(this._player.nativeHandle);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
leave(): void {
|
|
28
|
+
NativeModules.CastModule.chromecastLeave(this._player.nativeHandle);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Airplay, CastAPI, Chromecast } from 'react-native-theoplayer';
|
|
2
|
+
import type { THEOplayerView } from '../THEOplayerView.web';
|
|
3
|
+
|
|
4
|
+
export class THEOplayerWebCastAPI implements CastAPI {
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
constructor(private readonly _player: THEOplayerView) {}
|
|
7
|
+
|
|
8
|
+
casting(): Promise<boolean> {
|
|
9
|
+
return Promise.resolve(false);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get chromecast(): Chromecast | undefined {
|
|
13
|
+
// TODO
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get airplay(): Airplay | undefined {
|
|
18
|
+
// TODO
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
package com.theoplayer;
|
|
2
|
-
|
|
3
|
-
import android.text.TextUtils;
|
|
4
|
-
|
|
5
|
-
import androidx.annotation.Nullable;
|
|
6
|
-
|
|
7
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
8
|
-
import com.theoplayer.android.api.THEOplayerConfig;
|
|
9
|
-
import com.theoplayer.android.api.ads.AdPreloadType;
|
|
10
|
-
import com.theoplayer.android.api.ads.AdsConfiguration;
|
|
11
|
-
import com.theoplayer.android.api.ads.GoogleImaConfiguration;
|
|
12
|
-
|
|
13
|
-
public class PlayerConfigHelper {
|
|
14
|
-
static final private String PROP_ADS_CONFIGURATION = "ads";
|
|
15
|
-
static final private String PROP_LICENSE = "license";
|
|
16
|
-
static final private String PROP_LICENSE_URL = "licenseUrl";
|
|
17
|
-
static final private String PROP_CHROMELESS = "chromeless";
|
|
18
|
-
static final private String PROP_PRELOAD = "preload";
|
|
19
|
-
static final private String PROP_UI_ENABLED = "uiEnabled";
|
|
20
|
-
static final private String PROP_GOOGLE_IMA_CONFIGURATION = "googleImaConfiguration";
|
|
21
|
-
static final private String PROP_USE_NATIVE_IMA = "useNativeIma";
|
|
22
|
-
|
|
23
|
-
static public THEOplayerConfig fromProps(@Nullable ReadableMap configProps) {
|
|
24
|
-
THEOplayerConfig.Builder configBuilder = new THEOplayerConfig.Builder();
|
|
25
|
-
if (configProps != null) {
|
|
26
|
-
AdsConfiguration adsConfig = adsConfigurationFromProps(configProps.getMap(PROP_ADS_CONFIGURATION));
|
|
27
|
-
if (adsConfig != null) {
|
|
28
|
-
configBuilder.ads(adsConfig);
|
|
29
|
-
}
|
|
30
|
-
String license = configProps.getString(PROP_LICENSE);
|
|
31
|
-
if (license != null) {
|
|
32
|
-
configBuilder.license(license);
|
|
33
|
-
}
|
|
34
|
-
String licenseUrl = configProps.getString(PROP_LICENSE_URL);
|
|
35
|
-
if (licenseUrl != null) {
|
|
36
|
-
configBuilder.licenseUrl(licenseUrl);
|
|
37
|
-
}
|
|
38
|
-
if (configProps.hasKey(PROP_CHROMELESS)) {
|
|
39
|
-
configBuilder.chromeless(configProps.getBoolean(PROP_CHROMELESS));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return configBuilder.build();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static private AdsConfiguration adsConfigurationFromProps(@Nullable ReadableMap configProps) {
|
|
46
|
-
if (configProps == null) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
AdsConfiguration.Builder builder = new AdsConfiguration.Builder();
|
|
50
|
-
String preloadTypeString = configProps.getString(PROP_PRELOAD);
|
|
51
|
-
if (!TextUtils.isEmpty(preloadTypeString)) {
|
|
52
|
-
builder.preload(AdPreloadType.from(preloadTypeString));
|
|
53
|
-
}
|
|
54
|
-
builder.showCountdown(!configProps.hasKey(PROP_UI_ENABLED) || configProps.getBoolean(PROP_UI_ENABLED));
|
|
55
|
-
GoogleImaConfiguration googleImaConfiguration = googleImaConfigurationFromProps(configProps.getMap(PROP_GOOGLE_IMA_CONFIGURATION));
|
|
56
|
-
if (googleImaConfiguration != null) {
|
|
57
|
-
builder.googleImaConfiguration(googleImaConfiguration);
|
|
58
|
-
}
|
|
59
|
-
return builder.build();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static private GoogleImaConfiguration googleImaConfigurationFromProps(@Nullable ReadableMap configProps) {
|
|
63
|
-
if (configProps == null) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
return new GoogleImaConfiguration.Builder()
|
|
67
|
-
.useNativeIma(configProps.hasKey(PROP_USE_NATIVE_IMA) && configProps.getBoolean(PROP_USE_NATIVE_IMA))
|
|
68
|
-
.build();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
package com.theoplayer;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.ReactPackage;
|
|
6
|
-
import com.facebook.react.bridge.NativeModule;
|
|
7
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
|
-
import com.facebook.react.uimanager.ViewManager;
|
|
9
|
-
import com.theoplayer.ads.AdsModule;
|
|
10
|
-
import com.theoplayer.drm.ContentProtectionModule;
|
|
11
|
-
|
|
12
|
-
import java.util.ArrayList;
|
|
13
|
-
import java.util.Arrays;
|
|
14
|
-
import java.util.List;
|
|
15
|
-
|
|
16
|
-
public class ReactTHEOplayerPackage implements ReactPackage {
|
|
17
|
-
|
|
18
|
-
@NonNull
|
|
19
|
-
@Override
|
|
20
|
-
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
21
|
-
List<NativeModule> modules = new ArrayList<>();
|
|
22
|
-
modules.add(new AdsModule(reactContext));
|
|
23
|
-
modules.add(new ContentProtectionModule(reactContext));
|
|
24
|
-
return modules;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@NonNull
|
|
28
|
-
@Override
|
|
29
|
-
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
30
|
-
return Arrays.<ViewManager>asList(new ReactTHEOplayerViewManager());
|
|
31
|
-
}
|
|
32
|
-
}
|