react-native-theoplayer 1.7.1 → 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 +15 -6
- package/ios/THEOplayerRCTAdsAPI.swift +39 -40
- package/ios/THEOplayerRCTBridge.m +54 -1
- package/ios/THEOplayerRCTCastAPI.swift +275 -0
- package/ios/THEOplayerRCTDebug.swift +3 -0
- package/ios/THEOplayerRCTSourceDescriptionBuilder.swift +91 -19
- package/ios/THEOplayerRCTTrackEventTypes.swift +17 -0
- package/ios/{THEOplayerRCTMetadataAggregator.swift → THEOplayerRCTTrackMetadataAggregator.swift} +69 -55
- package/ios/THEOplayerRCTView.swift +126 -22
- package/ios/THEOplayerRCTViewAdEventHandler.swift +7 -5
- package/ios/THEOplayerRCTViewCastEventHandler.swift +124 -0
- package/ios/THEOplayerRCTViewMainEventHandler.swift +1 -1
- package/ios/THEOplayerRCTViewMediaTrackEventHandler.swift +185 -0
- package/ios/THEOplayerRCTViewTextTrackEventHandler.swift +30 -13
- 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/TrackEvent.js +17 -1
- package/lib/commonjs/api/event/TrackEvent.js.map +1 -1
- 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 +30 -0
- package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.web.js +80 -20
- 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/TrackEvent.js +14 -0
- package/lib/module/api/event/TrackEvent.js.map +1 -1
- 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 +29 -0
- package/lib/module/internal/THEOplayerView.js.map +1 -1
- package/lib/module/internal/THEOplayerView.web.js +80 -21
- 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/event/TrackEvent.d.ts +4 -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/TrackEvent.d.ts +2 -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 +21 -3
- 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/TrackEvent.d.ts +49 -3
- 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 +9 -1
- package/lib/typescript/src/internal/THEOplayerView.web.d.ts +7 -2
- 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 +25 -3
- 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/TrackEvent.ts +58 -2
- 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 +35 -0
- package/src/internal/THEOplayerView.web.tsx +87 -19
- 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 -442
- 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/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 -11
- package/android/src/main/java/com/theoplayer/track/TrackListInfo.java +0 -212
- package/android/src/main/java/com/theoplayer/util/ViewResolver.java +0 -42
- package/ios/custom/react-native-theoplayer_custom_ios.podspec +0 -36
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
package com.theoplayer.ads;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.Nullable;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.Arguments;
|
|
6
|
-
import com.facebook.react.bridge.WritableArray;
|
|
7
|
-
import com.facebook.react.bridge.WritableMap;
|
|
8
|
-
import com.theoplayer.android.api.ads.Ad;
|
|
9
|
-
import com.theoplayer.android.api.ads.AdBreak;
|
|
10
|
-
import com.theoplayer.android.api.ads.CompanionAd;
|
|
11
|
-
import com.theoplayer.android.api.ads.GoogleImaAd;
|
|
12
|
-
import com.theoplayer.android.api.ads.UniversalAdId;
|
|
13
|
-
|
|
14
|
-
import java.util.List;
|
|
15
|
-
|
|
16
|
-
public class AdInfo {
|
|
17
|
-
private static final String PROP_AD_SYSTEM = "adSystem";
|
|
18
|
-
private static final String PROP_AD_INTEGRATION = "integration";
|
|
19
|
-
private static final String PROP_AD_TYPE = "type";
|
|
20
|
-
private static final String PROP_AD_ID = "id";
|
|
21
|
-
private static final String PROP_AD_BREAK = "adBreak";
|
|
22
|
-
private static final String PROP_AD_COMPANIONS = "companions";
|
|
23
|
-
private static final String PROP_AD_SKIPOFFSET = "skipOffset";
|
|
24
|
-
private static final String PROP_AD_CREATIVE_ID = "creativeId";
|
|
25
|
-
private static final String PROP_AD_TRAFFICKING_PARAMETERS = "traffickingParametersString";
|
|
26
|
-
private static final String PROP_AD_BITRATE = "bitrate";
|
|
27
|
-
private static final String PROP_AD_UNIVERSAL_AD_IDS = "universalAdIds";
|
|
28
|
-
private static final String PROP_AD_TITLE = "title";
|
|
29
|
-
private static final String PROP_AD_DURATION = "duration";
|
|
30
|
-
private static final String PROP_AD_WRAPPER_AD_IDS = "wrapperAdIds";
|
|
31
|
-
private static final String PROP_AD_WRAPPER_AD_SYSTEMS = "wrapperAdSystems";
|
|
32
|
-
private static final String PROP_AD_WRAPPER_CREATIVE_IDS = "wrapperCreativeIds";
|
|
33
|
-
private static final String PROP_AD_WIDTH = "width";
|
|
34
|
-
private static final String PROP_AD_HEIGHT = "height";
|
|
35
|
-
private static final String PROP_AD_CONTENT_TYPE = "contentType";
|
|
36
|
-
|
|
37
|
-
private static final String PROP_ADBREAK_INTEGRATION = "integration";
|
|
38
|
-
private static final String PROP_ADBREAK_MAXDURATION = "maxDuration";
|
|
39
|
-
private static final String PROP_ADBREAK_TIMEOFFSET = "timeOffset";
|
|
40
|
-
private static final String PROP_ADBREAK_MAXREMAININGDURATION = "maxRemainingDuration";
|
|
41
|
-
private static final String PROP_ADBREAK_ADS = "ads";
|
|
42
|
-
|
|
43
|
-
private static final String PROP_COMPANION_ADSLOTID = "adSlotId";
|
|
44
|
-
private static final String PROP_COMPANION_ALTTEXT = "altText";
|
|
45
|
-
private static final String PROP_COMPANION_CLICKTHROUGH = "clickThrough";
|
|
46
|
-
private static final String PROP_COMPANION_WIDTH = "width";
|
|
47
|
-
private static final String PROP_COMPANION_HEIGHT = "height";
|
|
48
|
-
private static final String PROP_COMPANION_RESOURCEURI = "resourceURI";
|
|
49
|
-
|
|
50
|
-
private static final String PROP_UNIVERSAL_AD_ID_REGISTRY = "adIdRegistry";
|
|
51
|
-
private static final String PROP_UNIVERSAL_AD_ID_VALUE = "adIdValue";
|
|
52
|
-
|
|
53
|
-
public static WritableMap fromAd(final Ad ad) {
|
|
54
|
-
return fromAd(ad, true);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public static WritableArray fromAds(final List<Ad> ads) {
|
|
58
|
-
WritableArray payload = Arguments.createArray();
|
|
59
|
-
for (final Ad ad: ads) {
|
|
60
|
-
payload.pushMap(fromAd(ad, true));
|
|
61
|
-
}
|
|
62
|
-
return payload;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private static WritableMap fromAd(final Ad ad, boolean includeAdBreak) {
|
|
66
|
-
WritableMap adPayload = Arguments.createMap();
|
|
67
|
-
adPayload.putString(PROP_AD_INTEGRATION, ad.getIntegration() != null ? ad.getIntegration().getType() : "");
|
|
68
|
-
adPayload.putString(PROP_AD_TYPE, ad.getType());
|
|
69
|
-
adPayload.putString(PROP_AD_ID, ad.getId());
|
|
70
|
-
AdBreak adBreak = ad.getAdBreak();
|
|
71
|
-
if (includeAdBreak && adBreak != null) {
|
|
72
|
-
adPayload.putMap(PROP_AD_BREAK, fromAdBreak(adBreak));
|
|
73
|
-
}
|
|
74
|
-
adPayload.putArray(PROP_AD_COMPANIONS, fromCompanions(ad.getCompanions()));
|
|
75
|
-
adPayload.putInt(PROP_AD_SKIPOFFSET, ad.getSkipOffset());
|
|
76
|
-
|
|
77
|
-
if (ad instanceof GoogleImaAd) {
|
|
78
|
-
GoogleImaAd googleImaAd = (GoogleImaAd)ad;
|
|
79
|
-
adPayload.putString(PROP_AD_SYSTEM, googleImaAd.getAdSystem());
|
|
80
|
-
adPayload.putString(PROP_AD_CREATIVE_ID, googleImaAd.getCreativeId());
|
|
81
|
-
adPayload.putString(PROP_AD_TRAFFICKING_PARAMETERS, googleImaAd.getTraffickingParameters());
|
|
82
|
-
adPayload.putInt(PROP_AD_BITRATE, googleImaAd.getVastMediaBitrate());
|
|
83
|
-
try {
|
|
84
|
-
adPayload.putString(PROP_AD_TITLE, googleImaAd.getImaAd().getTitle());
|
|
85
|
-
adPayload.putInt(PROP_AD_DURATION, (int)(1e3 * googleImaAd.getImaAd().getDuration()));
|
|
86
|
-
adPayload.putDouble(PROP_AD_WIDTH, googleImaAd.getImaAd().getVastMediaWidth());
|
|
87
|
-
adPayload.putDouble(PROP_AD_HEIGHT, googleImaAd.getImaAd().getVastMediaHeight());
|
|
88
|
-
adPayload.putString(PROP_AD_CONTENT_TYPE, googleImaAd.getImaAd().getContentType());
|
|
89
|
-
} catch (Exception ignore) {
|
|
90
|
-
// googleImaAd.getImaAd() is not known yet
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
WritableArray universalAdIdsPayload = Arguments.createArray();
|
|
94
|
-
for (UniversalAdId universalAdId: googleImaAd.getUniversalAdIds()) {
|
|
95
|
-
WritableMap idPayload = Arguments.createMap();
|
|
96
|
-
idPayload.putString(PROP_UNIVERSAL_AD_ID_REGISTRY, universalAdId.getUniversalAdIdRegistry());
|
|
97
|
-
idPayload.putString(PROP_UNIVERSAL_AD_ID_VALUE, universalAdId.getUniversalAdIdValue());
|
|
98
|
-
universalAdIdsPayload.pushMap(idPayload);
|
|
99
|
-
}
|
|
100
|
-
adPayload.putArray(PROP_AD_UNIVERSAL_AD_IDS, universalAdIdsPayload);
|
|
101
|
-
|
|
102
|
-
WritableArray wrapperAdIdsPayload = Arguments.createArray();
|
|
103
|
-
for (String wrapperAdId: googleImaAd.getWrapperAdIds()) {
|
|
104
|
-
wrapperAdIdsPayload.pushString(wrapperAdId);
|
|
105
|
-
}
|
|
106
|
-
adPayload.putArray(PROP_AD_WRAPPER_AD_IDS, wrapperAdIdsPayload);
|
|
107
|
-
|
|
108
|
-
WritableArray wrapperAdSystemsPayload = Arguments.createArray();
|
|
109
|
-
for (String wrapperAdSystem: googleImaAd.getWrapperAdSystems()) {
|
|
110
|
-
wrapperAdSystemsPayload.pushString(wrapperAdSystem);
|
|
111
|
-
}
|
|
112
|
-
adPayload.putArray(PROP_AD_WRAPPER_AD_SYSTEMS, wrapperAdSystemsPayload);
|
|
113
|
-
|
|
114
|
-
WritableArray wrapperCreativeIdsPayload = Arguments.createArray();
|
|
115
|
-
for (String wrapperCreativeId: googleImaAd.getWrapperCreativeIds()) {
|
|
116
|
-
wrapperCreativeIdsPayload.pushString(wrapperCreativeId);
|
|
117
|
-
}
|
|
118
|
-
adPayload.putArray(PROP_AD_WRAPPER_CREATIVE_IDS, wrapperCreativeIdsPayload);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return adPayload;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
public static WritableMap fromAdBreak(@Nullable final AdBreak adbreak) {
|
|
125
|
-
WritableMap adbreakPayload = Arguments.createMap();
|
|
126
|
-
if (adbreak == null) {
|
|
127
|
-
return adbreakPayload;
|
|
128
|
-
}
|
|
129
|
-
adbreakPayload.putString(PROP_ADBREAK_INTEGRATION, adbreak.getIntegration().getType());
|
|
130
|
-
adbreakPayload.putInt(PROP_ADBREAK_MAXDURATION, (int)(1e3 * adbreak.getMaxDuration()));
|
|
131
|
-
adbreakPayload.putInt(PROP_ADBREAK_TIMEOFFSET, (int)(1e3 * adbreak.getTimeOffset()));
|
|
132
|
-
adbreakPayload.putInt(PROP_ADBREAK_MAXREMAININGDURATION, (int)(1e3 * adbreak.getMaxRemainingDuration()));
|
|
133
|
-
|
|
134
|
-
WritableArray adsPayload = Arguments.createArray();
|
|
135
|
-
for (Ad ad: adbreak.getAds()) {
|
|
136
|
-
// Some ads in the ad break are possibly not loaded yet.
|
|
137
|
-
if (ad != null) {
|
|
138
|
-
adsPayload.pushMap(fromAd(ad, false));
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
adbreakPayload.putArray(PROP_ADBREAK_ADS, adsPayload);
|
|
142
|
-
|
|
143
|
-
return adbreakPayload;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
public static WritableArray fromAdBreaks(final List<AdBreak> adbreaks) {
|
|
147
|
-
WritableArray payload = Arguments.createArray();
|
|
148
|
-
for (AdBreak adbreak: adbreaks) {
|
|
149
|
-
payload.pushMap(fromAdBreak(adbreak));
|
|
150
|
-
}
|
|
151
|
-
return payload;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
public static WritableArray fromCompanions(final List<CompanionAd> companions) {
|
|
155
|
-
WritableArray companionsPayload = Arguments.createArray();
|
|
156
|
-
for (CompanionAd companionAd: companions) {
|
|
157
|
-
WritableMap adPayload = Arguments.createMap();
|
|
158
|
-
adPayload.putString(PROP_COMPANION_ADSLOTID, companionAd.getAdSlotId());
|
|
159
|
-
adPayload.putString(PROP_COMPANION_ALTTEXT, companionAd.getAltText());
|
|
160
|
-
adPayload.putString(PROP_COMPANION_CLICKTHROUGH, companionAd.getClickThrough());
|
|
161
|
-
adPayload.putInt(PROP_COMPANION_WIDTH, companionAd.getWidth());
|
|
162
|
-
adPayload.putInt(PROP_COMPANION_HEIGHT, companionAd.getHeight());
|
|
163
|
-
adPayload.putString(PROP_COMPANION_RESOURCEURI, companionAd.getResourceURI());
|
|
164
|
-
companionsPayload.pushMap(adPayload);
|
|
165
|
-
}
|
|
166
|
-
return companionsPayload;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
package com.theoplayer.ads;
|
|
2
|
-
|
|
3
|
-
import android.util.Log;
|
|
4
|
-
|
|
5
|
-
import androidx.annotation.NonNull;
|
|
6
|
-
|
|
7
|
-
import com.facebook.react.bridge.Arguments;
|
|
8
|
-
import com.facebook.react.bridge.Promise;
|
|
9
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
11
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
12
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
13
|
-
import com.theoplayer.SourceHelper;
|
|
14
|
-
import com.theoplayer.android.api.ads.dai.GoogleDaiIntegration;
|
|
15
|
-
import com.theoplayer.android.api.error.THEOplayerException;
|
|
16
|
-
import com.theoplayer.util.ViewResolver;
|
|
17
|
-
|
|
18
|
-
public class AdsModule extends ReactContextBaseJavaModule {
|
|
19
|
-
private static final String TAG = "AdsModule";
|
|
20
|
-
private final SourceHelper sourceHelper = new SourceHelper();
|
|
21
|
-
private final ViewResolver viewResolver;
|
|
22
|
-
|
|
23
|
-
public AdsModule(ReactApplicationContext context) {
|
|
24
|
-
super(context);
|
|
25
|
-
viewResolver = new ViewResolver(context);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@NonNull
|
|
29
|
-
@Override
|
|
30
|
-
public String getName() {
|
|
31
|
-
return TAG;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Add an ad break request.
|
|
35
|
-
@ReactMethod
|
|
36
|
-
public void schedule(Integer tag, ReadableMap ad) {
|
|
37
|
-
viewResolver.resolveViewByTag(tag, view -> {
|
|
38
|
-
if (view != null) {
|
|
39
|
-
try {
|
|
40
|
-
view.getAdsApi().schedule(sourceHelper.parseAdFromJS(ad));
|
|
41
|
-
} catch (THEOplayerException exception) {
|
|
42
|
-
Log.e(TAG, exception.getMessage());
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// The currently playing ad break.
|
|
49
|
-
@ReactMethod
|
|
50
|
-
public void currentAdBreak(Integer tag, Promise promise) {
|
|
51
|
-
viewResolver.resolveViewByTag(tag, view -> {
|
|
52
|
-
if (view == null) {
|
|
53
|
-
promise.resolve(Arguments.createMap());
|
|
54
|
-
} else {
|
|
55
|
-
promise.resolve(AdInfo.fromAdBreak(view.getAdsApi().getCurrentAdBreak()));
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// List of currently playing ads.
|
|
61
|
-
@ReactMethod
|
|
62
|
-
public void currentAds(Integer tag, Promise promise) {
|
|
63
|
-
viewResolver.resolveViewByTag(tag, view -> {
|
|
64
|
-
if (view == null) {
|
|
65
|
-
promise.resolve(Arguments.createMap());
|
|
66
|
-
} else {
|
|
67
|
-
promise.resolve(AdInfo.fromAds(view.getAdsApi().getCurrentAds()));
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// List of ad breaks which still need to be played.
|
|
73
|
-
@ReactMethod
|
|
74
|
-
public void scheduledAdBreaks(Integer tag, Promise promise) {
|
|
75
|
-
viewResolver.resolveViewByTag(tag, view -> {
|
|
76
|
-
if (view == null) {
|
|
77
|
-
promise.resolve(Arguments.createMap());
|
|
78
|
-
} else {
|
|
79
|
-
promise.resolve(AdInfo.fromAdBreaks(view.getAdsApi().getScheduledAdBreaks()));
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Whether a linear ad is currently playing.
|
|
85
|
-
@ReactMethod
|
|
86
|
-
public void playing(Integer tag, Promise promise) {
|
|
87
|
-
viewResolver.resolveViewByTag(tag, view -> {
|
|
88
|
-
if (view == null) {
|
|
89
|
-
promise.resolve(false);
|
|
90
|
-
} else {
|
|
91
|
-
promise.resolve(view.getAdsApi().isPlaying());
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Skip the current linear ad.
|
|
97
|
-
// NOTE: This will have no effect when the current linear ad is (not yet) skippable.
|
|
98
|
-
@ReactMethod
|
|
99
|
-
public void skip(Integer tag) {
|
|
100
|
-
viewResolver.resolveViewByTag(tag, view -> {
|
|
101
|
-
if (view != null) {
|
|
102
|
-
view.getAdsApi().skip();
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
@ReactMethod
|
|
108
|
-
public void daiSnapback(Integer tag, Promise promise) {
|
|
109
|
-
viewResolver.resolveViewByTag(tag, view -> {
|
|
110
|
-
GoogleDaiIntegration daiIntegration = view != null ? view.getDaiIntegration() : null;
|
|
111
|
-
if (daiIntegration == null) {
|
|
112
|
-
promise.resolve(false);
|
|
113
|
-
} else {
|
|
114
|
-
promise.resolve(daiIntegration.getEnableSnapback());
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@ReactMethod
|
|
120
|
-
public void daiSetSnapback(Integer tag, Boolean enabled) {
|
|
121
|
-
viewResolver.resolveViewByTag(tag, view -> {
|
|
122
|
-
GoogleDaiIntegration daiIntegration = view != null ? view.getDaiIntegration() : null;
|
|
123
|
-
if (daiIntegration != null) {
|
|
124
|
-
daiIntegration.setEnableSnapback(enabled);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
@ReactMethod
|
|
130
|
-
public void daiContentTimeForStreamTime(Integer tag, Integer time, Promise promise) {
|
|
131
|
-
viewResolver.resolveViewByTag(tag, view -> {
|
|
132
|
-
GoogleDaiIntegration daiIntegration = view != null ? view.getDaiIntegration() : null;
|
|
133
|
-
if (daiIntegration == null) {
|
|
134
|
-
promise.resolve(time);
|
|
135
|
-
} else {
|
|
136
|
-
promise.resolve((int)(1e03 * daiIntegration.contentTimeForStreamTime(1e-03 * time)));
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
@ReactMethod
|
|
142
|
-
public void daiStreamTimeForContentTime(Integer tag, Integer time, Promise promise) {
|
|
143
|
-
viewResolver.resolveViewByTag(tag, view -> {
|
|
144
|
-
GoogleDaiIntegration daiIntegration = view != null ? view.getDaiIntegration() : null;
|
|
145
|
-
if (daiIntegration == null) {
|
|
146
|
-
promise.resolve(time);
|
|
147
|
-
} else {
|
|
148
|
-
promise.resolve((int)(1e03 * daiIntegration.streamTimeForContentTime(1e-03 * time)));
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
package com.theoplayer.track;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
|
|
5
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.Quality;
|
|
6
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.QualityList;
|
|
7
|
-
|
|
8
|
-
import java.util.ArrayList;
|
|
9
|
-
import java.util.Collections;
|
|
10
|
-
import java.util.Comparator;
|
|
11
|
-
import java.util.Iterator;
|
|
12
|
-
import java.util.List;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Adapts an Android List to a QualityList.
|
|
16
|
-
*/
|
|
17
|
-
public class QualityListAdapter<Q extends Quality> implements QualityList<Q> {
|
|
18
|
-
private List<Q> qualities;
|
|
19
|
-
|
|
20
|
-
public QualityListAdapter(@NonNull List<Q> qualities) {
|
|
21
|
-
this.qualities = qualities;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public QualityListAdapter(@NonNull QualityList<Q> qualities) {
|
|
25
|
-
this.qualities = new ArrayList<Q>();
|
|
26
|
-
for (final Q quality : qualities) {
|
|
27
|
-
this.qualities.add(quality);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@Override
|
|
32
|
-
public int length() {
|
|
33
|
-
return qualities.size();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@Override
|
|
37
|
-
public Q getItem(int i) {
|
|
38
|
-
return (i >= 0 && i < length()) ? qualities.get(i) : null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@NonNull
|
|
42
|
-
@Override
|
|
43
|
-
public Iterator<Q> iterator() {
|
|
44
|
-
return qualities.iterator();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public List<Q> asList() {
|
|
48
|
-
return qualities;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public void sort(Comparator<Q> comparator) {
|
|
52
|
-
Collections.sort(qualities, comparator);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
package com.theoplayer.track;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
6
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.Quality;
|
|
7
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.QualityList;
|
|
8
|
-
|
|
9
|
-
import java.util.ArrayList;
|
|
10
|
-
import java.util.List;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* QualityListFilter allows filtering a QualityList.
|
|
14
|
-
*/
|
|
15
|
-
public class QualityListFilter<Q extends Quality> {
|
|
16
|
-
|
|
17
|
-
private final QualityList<Q> qualities;
|
|
18
|
-
|
|
19
|
-
public QualityListFilter(QualityList<Q> qualities) {
|
|
20
|
-
this.qualities = qualities;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@NonNull
|
|
24
|
-
public QualityList<Q> filterQualityList(ReadableArray uids) {
|
|
25
|
-
return new QualityListAdapter<Q>(filterList(uids));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@NonNull
|
|
29
|
-
public List<Q> filterList(ReadableArray uids) {
|
|
30
|
-
final List<Q> filteredQualities = new ArrayList<>();
|
|
31
|
-
for (int q = 0; q < uids.size(); q++) {
|
|
32
|
-
for (final Q quality : qualities) {
|
|
33
|
-
if (uids.getInt(q) == quality.getUid()) {
|
|
34
|
-
filteredQualities.add(quality);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return filteredQualities;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
package com.theoplayer.track;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.Arguments;
|
|
6
|
-
import com.facebook.react.bridge.WritableArray;
|
|
7
|
-
import com.facebook.react.bridge.WritableMap;
|
|
8
|
-
import com.theoplayer.android.api.player.track.mediatrack.MediaTrack;
|
|
9
|
-
import com.theoplayer.android.api.player.track.mediatrack.MediaTrackList;
|
|
10
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.AudioQuality;
|
|
11
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.QualityList;
|
|
12
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.VideoQuality;
|
|
13
|
-
import com.theoplayer.android.api.player.track.texttrack.TextTrack;
|
|
14
|
-
import com.theoplayer.android.api.player.track.texttrack.TextTrackList;
|
|
15
|
-
import com.theoplayer.android.api.player.track.texttrack.cue.TextTrackCue;
|
|
16
|
-
import com.theoplayer.android.api.player.track.texttrack.cue.TextTrackCueList;
|
|
17
|
-
|
|
18
|
-
import org.json.JSONObject;
|
|
19
|
-
|
|
20
|
-
public class TrackListInfo {
|
|
21
|
-
|
|
22
|
-
private static final String PROP_ID = "id";
|
|
23
|
-
private static final String PROP_UID = "uid";
|
|
24
|
-
private static final String PROP_KIND = "kind";
|
|
25
|
-
private static final String PROP_LANGUAGE = "language";
|
|
26
|
-
private static final String PROP_MODE = "mode";
|
|
27
|
-
private static final String PROP_LABEL = "label";
|
|
28
|
-
private static final String PROP_TYPE = "type";
|
|
29
|
-
private static final String PROP_CODECS = "codecs";
|
|
30
|
-
private static final String PROP_NAME = "name";
|
|
31
|
-
private static final String PROP_SRC = "src";
|
|
32
|
-
private static final String PROP_FORCED = "forced";
|
|
33
|
-
private static final String PROP_AUDIO_SAMPLING_RATE = "audioSamplingRate";
|
|
34
|
-
private static final String PROP_BANDWIDTH = "bandwidth";
|
|
35
|
-
private static final String PROP_QUALITIES = "qualities";
|
|
36
|
-
private static final String PROP_ACTIVE_QUALITY = "activeQuality";
|
|
37
|
-
private static final String PROP_TARGET_QUALITY = "targetQuality";
|
|
38
|
-
private static final String PROP_WIDTH = "width";
|
|
39
|
-
private static final String PROP_HEIGHT = "height";
|
|
40
|
-
private static final String PROP_FRAMERATE = "framerate";
|
|
41
|
-
private static final String PROP_STARTTIME = "startTime";
|
|
42
|
-
private static final String PROP_ENDTIME = "endTime";
|
|
43
|
-
private static final String PROP_CUES = "cues";
|
|
44
|
-
private static final String PROP_CUE_CONTENT = "content";
|
|
45
|
-
|
|
46
|
-
public static WritableArray fromTextTrackList(final TextTrackList textTrackList) {
|
|
47
|
-
WritableArray textTracks = Arguments.createArray();
|
|
48
|
-
for (int i = 0; i < textTrackList.length(); i++) {
|
|
49
|
-
textTracks.pushMap(fromTextTrack(textTrackList.getItem(i)));
|
|
50
|
-
}
|
|
51
|
-
return textTracks;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public static WritableMap fromTextTrack(final TextTrack textTrack) {
|
|
55
|
-
WritableMap textTrackPayload = Arguments.createMap();
|
|
56
|
-
textTrackPayload.putString(PROP_ID, textTrack.getId());
|
|
57
|
-
textTrackPayload.putInt(PROP_UID, textTrack.getUid());
|
|
58
|
-
textTrackPayload.putString(PROP_KIND, textTrack.getKind());
|
|
59
|
-
textTrackPayload.putString(PROP_LANGUAGE, textTrack.getLanguage());
|
|
60
|
-
textTrackPayload.putString(PROP_MODE, textTrack.getMode().getMode());
|
|
61
|
-
textTrackPayload.putString(PROP_LABEL, textTrack.getLabel());
|
|
62
|
-
textTrackPayload.putString(PROP_TYPE, textTrack.getType().getType());
|
|
63
|
-
|
|
64
|
-
// THEOplayer v3.5+
|
|
65
|
-
textTrackPayload.putString(PROP_SRC, textTrack.getSource());
|
|
66
|
-
textTrackPayload.putBoolean(PROP_FORCED, textTrack.isForced());
|
|
67
|
-
|
|
68
|
-
// Optionally pass cue list.
|
|
69
|
-
final TextTrackCueList cueList = textTrack.getCues();
|
|
70
|
-
if (cueList != null) {
|
|
71
|
-
WritableArray cueListPayload = Arguments.createArray();
|
|
72
|
-
for (TextTrackCue cue : cueList) {
|
|
73
|
-
cueListPayload.pushMap(fromTextTrackCue(cue));
|
|
74
|
-
}
|
|
75
|
-
textTrackPayload.putArray(PROP_CUES, cueListPayload);
|
|
76
|
-
}
|
|
77
|
-
return textTrackPayload;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public static WritableMap fromTextTrackCue(final TextTrackCue cue) {
|
|
81
|
-
WritableMap cuePayload = Arguments.createMap();
|
|
82
|
-
cuePayload.putString(PROP_ID, cue.getId());
|
|
83
|
-
cuePayload.putDouble(PROP_UID, cue.getUid());
|
|
84
|
-
cuePayload.putDouble(PROP_STARTTIME, (long) (1e03 * cue.getStartTime()));
|
|
85
|
-
cuePayload.putDouble(PROP_ENDTIME, (long) (1e03 * cue.getEndTime()));
|
|
86
|
-
final JSONObject content = cue.getContent();
|
|
87
|
-
if (content != null) {
|
|
88
|
-
cuePayload.putString(PROP_CUE_CONTENT, content.optString("content"));
|
|
89
|
-
}
|
|
90
|
-
return cuePayload;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
@NonNull
|
|
94
|
-
public static WritableArray fromAudioTrackList(@NonNull final MediaTrackList<AudioQuality> audioTrackList) {
|
|
95
|
-
WritableArray audioTracks = Arguments.createArray();
|
|
96
|
-
for (int i = 0; i < audioTrackList.length(); i++) {
|
|
97
|
-
final MediaTrack<AudioQuality> audioTrack = audioTrackList.getItem(i);
|
|
98
|
-
WritableMap audioTrackPayload = Arguments.createMap();
|
|
99
|
-
audioTrackPayload.putString(PROP_ID, audioTrack.getId());
|
|
100
|
-
audioTrackPayload.putInt(PROP_UID, audioTrack.getUid());
|
|
101
|
-
audioTrackPayload.putString(PROP_KIND, audioTrack.getKind());
|
|
102
|
-
audioTrackPayload.putString(PROP_LABEL, audioTrack.getLabel());
|
|
103
|
-
audioTrackPayload.putString(PROP_LANGUAGE, audioTrack.getLanguage());
|
|
104
|
-
|
|
105
|
-
final QualityList<AudioQuality> qualityList = audioTrack.getQualities();
|
|
106
|
-
WritableArray qualities = Arguments.createArray();
|
|
107
|
-
if (qualityList != null) {
|
|
108
|
-
for (int j = 0; j < qualityList.length(); j++) {
|
|
109
|
-
final AudioQuality audioQuality = qualityList.getItem(j);
|
|
110
|
-
WritableMap audioQualityPayload = Arguments.createMap();
|
|
111
|
-
audioQualityPayload.putString(PROP_ID, audioQuality.getId());
|
|
112
|
-
audioQualityPayload.putInt(PROP_UID, audioQuality.getUid());
|
|
113
|
-
audioQualityPayload.putString(PROP_CODECS, audioQuality.getCodecs());
|
|
114
|
-
audioQualityPayload.putString(PROP_NAME, audioQuality.getName());
|
|
115
|
-
audioQualityPayload.putDouble(PROP_BANDWIDTH, audioQuality.getBandwidth());
|
|
116
|
-
audioQualityPayload.putDouble(PROP_AUDIO_SAMPLING_RATE, audioQuality.getAudioSamplingRate());
|
|
117
|
-
qualities.pushMap(audioQualityPayload);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
audioTrackPayload.putArray(PROP_QUALITIES, qualities);
|
|
121
|
-
|
|
122
|
-
final QualityList<AudioQuality> targetQualityList = audioTrack.getTargetQualities();
|
|
123
|
-
WritableArray targetQualities = Arguments.createArray();
|
|
124
|
-
if (targetQualityList != null) {
|
|
125
|
-
for (int j = 0; j < targetQualityList.length(); j++) {
|
|
126
|
-
final AudioQuality quality = targetQualityList.getItem(j);
|
|
127
|
-
WritableMap audioQualityPayload = Arguments.createMap();
|
|
128
|
-
audioQualityPayload.putInt(PROP_UID, quality.getUid());
|
|
129
|
-
targetQualities.pushMap(audioQualityPayload);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
final AudioQuality activeQuality = audioTrack.getActiveQuality();
|
|
134
|
-
if (activeQuality != null) {
|
|
135
|
-
audioTrackPayload.putInt(PROP_ACTIVE_QUALITY, activeQuality.getUid());
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
final AudioQuality targetQuality = audioTrack.getTargetQuality();
|
|
139
|
-
if (targetQuality != null) {
|
|
140
|
-
audioTrackPayload.putInt(PROP_TARGET_QUALITY, targetQuality.getUid());
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
audioTracks.pushMap(audioTrackPayload);
|
|
144
|
-
}
|
|
145
|
-
return audioTracks;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
@NonNull
|
|
149
|
-
static public WritableArray fromVideoTrackList(@NonNull final MediaTrackList<VideoQuality> videoTrackList) {
|
|
150
|
-
WritableArray videoTracks = Arguments.createArray();
|
|
151
|
-
for (int i = 0; i < videoTrackList.length(); i++) {
|
|
152
|
-
final MediaTrack<VideoQuality> videoTrack = videoTrackList.getItem(i);
|
|
153
|
-
WritableMap videoTrackPayload = Arguments.createMap();
|
|
154
|
-
videoTrackPayload.putString(PROP_ID, videoTrack.getId());
|
|
155
|
-
videoTrackPayload.putInt(PROP_UID, videoTrack.getUid());
|
|
156
|
-
videoTrackPayload.putString(PROP_KIND, videoTrack.getKind());
|
|
157
|
-
videoTrackPayload.putString(PROP_LABEL, videoTrack.getLabel());
|
|
158
|
-
videoTrackPayload.putString(PROP_LANGUAGE, videoTrack.getLanguage());
|
|
159
|
-
|
|
160
|
-
final QualityList<VideoQuality> qualityList = videoTrack.getQualities();
|
|
161
|
-
WritableArray qualities = Arguments.createArray();
|
|
162
|
-
|
|
163
|
-
if (qualityList != null) {
|
|
164
|
-
// Sort qualities according to (height, bandwidth)
|
|
165
|
-
final QualityListAdapter<VideoQuality> sortedQualityList = new QualityListAdapter<>(qualityList);
|
|
166
|
-
sortedQualityList.sort(
|
|
167
|
-
(o, t1) ->
|
|
168
|
-
(o.getHeight() == t1.getHeight()) ?
|
|
169
|
-
Long.compare(t1.getBandwidth(), o.getBandwidth()) : Integer.compare(t1.getHeight(), o.getHeight())
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
for (final VideoQuality quality : sortedQualityList) {
|
|
173
|
-
WritableMap videoQualityPayload = Arguments.createMap();
|
|
174
|
-
videoQualityPayload.putString(PROP_ID, quality.getId());
|
|
175
|
-
videoQualityPayload.putInt(PROP_UID, quality.getUid());
|
|
176
|
-
videoQualityPayload.putString(PROP_CODECS, quality.getCodecs());
|
|
177
|
-
videoQualityPayload.putString(PROP_NAME, quality.getName());
|
|
178
|
-
videoQualityPayload.putDouble(PROP_BANDWIDTH, quality.getBandwidth());
|
|
179
|
-
videoQualityPayload.putDouble(PROP_WIDTH, quality.getWidth());
|
|
180
|
-
videoQualityPayload.putDouble(PROP_HEIGHT, quality.getHeight());
|
|
181
|
-
videoQualityPayload.putDouble(PROP_FRAMERATE, quality.getFrameRate());
|
|
182
|
-
qualities.pushMap(videoQualityPayload);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
videoTrackPayload.putArray(PROP_QUALITIES, qualities);
|
|
186
|
-
|
|
187
|
-
final QualityList<VideoQuality> targetQualityList = videoTrack.getTargetQualities();
|
|
188
|
-
WritableArray targetQualities = Arguments.createArray();
|
|
189
|
-
if (targetQualityList != null) {
|
|
190
|
-
for (int j = 0; j < targetQualityList.length(); j++) {
|
|
191
|
-
final VideoQuality quality = targetQualityList.getItem(j);
|
|
192
|
-
WritableMap videoQualityPayload = Arguments.createMap();
|
|
193
|
-
videoQualityPayload.putInt(PROP_UID, quality.getUid());
|
|
194
|
-
targetQualities.pushMap(videoQualityPayload);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
final VideoQuality activeQuality = videoTrack.getActiveQuality();
|
|
199
|
-
if (activeQuality != null) {
|
|
200
|
-
videoTrackPayload.putInt(PROP_ACTIVE_QUALITY, activeQuality.getUid());
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
final VideoQuality targetQuality = videoTrack.getTargetQuality();
|
|
204
|
-
if (targetQuality != null) {
|
|
205
|
-
videoTrackPayload.putInt(PROP_TARGET_QUALITY, targetQuality.getUid());
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
videoTracks.pushMap(videoTrackPayload);
|
|
209
|
-
}
|
|
210
|
-
return videoTracks;
|
|
211
|
-
}
|
|
212
|
-
}
|