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,525 +0,0 @@
|
|
|
1
|
-
package com.theoplayer;
|
|
2
|
-
|
|
3
|
-
import android.annotation.SuppressLint;
|
|
4
|
-
import android.app.Activity;
|
|
5
|
-
import android.os.Build;
|
|
6
|
-
import android.os.Handler;
|
|
7
|
-
import android.util.Log;
|
|
8
|
-
import android.view.View;
|
|
9
|
-
import android.view.Window;
|
|
10
|
-
import android.widget.FrameLayout;
|
|
11
|
-
|
|
12
|
-
import androidx.annotation.NonNull;
|
|
13
|
-
import androidx.annotation.Nullable;
|
|
14
|
-
|
|
15
|
-
import com.facebook.react.bridge.Arguments;
|
|
16
|
-
import com.facebook.react.bridge.LifecycleEventListener;
|
|
17
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
18
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
19
|
-
import com.facebook.react.bridge.WritableArray;
|
|
20
|
-
import com.facebook.react.bridge.WritableMap;
|
|
21
|
-
import com.facebook.react.uimanager.ThemedReactContext;
|
|
22
|
-
import com.google.ads.interactivemedia.v3.api.AdsRenderingSettings;
|
|
23
|
-
import com.google.ads.interactivemedia.v3.api.ImaSdkFactory;
|
|
24
|
-
import com.theoplayer.android.api.ads.dai.GoogleDaiIntegration;
|
|
25
|
-
import com.theoplayer.android.api.ads.dai.GoogleDaiIntegrationFactory;
|
|
26
|
-
import com.theoplayer.abr.ABRConfigurationAdapter;
|
|
27
|
-
import com.theoplayer.android.api.THEOplayerConfig;
|
|
28
|
-
import com.theoplayer.android.api.THEOplayerView;
|
|
29
|
-
import com.theoplayer.android.api.ads.ima.GoogleImaIntegration;
|
|
30
|
-
import com.theoplayer.android.api.ads.ima.GoogleImaIntegrationFactory;
|
|
31
|
-
import com.theoplayer.android.api.ads.wrapper.AdsApiWrapper;
|
|
32
|
-
import com.theoplayer.android.api.cast.CastIntegration;
|
|
33
|
-
import com.theoplayer.android.api.cast.CastIntegrationFactory;
|
|
34
|
-
import com.theoplayer.android.api.error.THEOplayerException;
|
|
35
|
-
import com.theoplayer.android.api.player.Player;
|
|
36
|
-
import com.theoplayer.android.api.player.RequestCallback;
|
|
37
|
-
import com.theoplayer.android.api.player.track.mediatrack.MediaTrack;
|
|
38
|
-
import com.theoplayer.android.api.player.track.mediatrack.MediaTrackList;
|
|
39
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.AudioQuality;
|
|
40
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.QualityList;
|
|
41
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.VideoQuality;
|
|
42
|
-
import com.theoplayer.android.api.player.track.texttrack.TextTrack;
|
|
43
|
-
import com.theoplayer.android.api.player.track.texttrack.TextTrackList;
|
|
44
|
-
import com.theoplayer.android.api.player.track.texttrack.TextTrackMode;
|
|
45
|
-
import com.theoplayer.android.api.player.track.texttrack.cue.TextTrackCue;
|
|
46
|
-
import com.theoplayer.android.api.source.SourceDescription;
|
|
47
|
-
import com.theoplayer.android.api.timerange.TimeRanges;
|
|
48
|
-
import com.theoplayer.track.QualityListFilter;
|
|
49
|
-
import com.theoplayer.track.TrackListInfo;
|
|
50
|
-
import com.theoplayer.util.TypeUtils;
|
|
51
|
-
|
|
52
|
-
import java.util.Collections;
|
|
53
|
-
|
|
54
|
-
@SuppressLint("ViewConstructor")
|
|
55
|
-
public class ReactTHEOplayerView extends FrameLayout implements LifecycleEventListener {
|
|
56
|
-
|
|
57
|
-
private static final String TAG = ReactTHEOplayerView.class.getName();
|
|
58
|
-
|
|
59
|
-
public static final long TIME_UNSET = Long.MIN_VALUE + 1;
|
|
60
|
-
|
|
61
|
-
private final VideoEventEmitter eventEmitter;
|
|
62
|
-
|
|
63
|
-
private final ThemedReactContext reactContext;
|
|
64
|
-
|
|
65
|
-
private THEOplayerView playerView;
|
|
66
|
-
|
|
67
|
-
private GoogleDaiIntegration daiIntegration;
|
|
68
|
-
|
|
69
|
-
private GoogleImaIntegration imaIntegration;
|
|
70
|
-
|
|
71
|
-
private final AdsApiWrapper adsApi;
|
|
72
|
-
|
|
73
|
-
private Player player;
|
|
74
|
-
private ReadableMap abrConfig;
|
|
75
|
-
private boolean paused;
|
|
76
|
-
private boolean muted = false;
|
|
77
|
-
private boolean fullscreen = false;
|
|
78
|
-
private double playbackRate = 1.0;
|
|
79
|
-
private double volume = 1.0;
|
|
80
|
-
private double seekTime = TIME_UNSET;
|
|
81
|
-
private SourceDescription sourceDescription;
|
|
82
|
-
private final Handler handler = new Handler();
|
|
83
|
-
|
|
84
|
-
public ReactTHEOplayerView(ThemedReactContext context) {
|
|
85
|
-
super(context);
|
|
86
|
-
this.reactContext = context;
|
|
87
|
-
this.eventEmitter = new VideoEventEmitter(context, this);
|
|
88
|
-
reactContext.addLifecycleEventListener(this);
|
|
89
|
-
adsApi = new AdsApiWrapper();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
public void initialize(@Nullable ReadableMap configProps) {
|
|
93
|
-
createViews(PlayerConfigHelper.fromProps(configProps));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@Nullable
|
|
97
|
-
public GoogleDaiIntegration getDaiIntegration() {
|
|
98
|
-
return daiIntegration;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@NonNull
|
|
102
|
-
public WritableArray getTextTrackInfo() {
|
|
103
|
-
if (player != null) {
|
|
104
|
-
return TrackListInfo.fromTextTrackList(player.getTextTracks());
|
|
105
|
-
}
|
|
106
|
-
return Arguments.createArray();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@NonNull
|
|
110
|
-
public WritableMap getTextTrackInfo(TextTrack track) {
|
|
111
|
-
if (player != null) {
|
|
112
|
-
return TrackListInfo.fromTextTrack(track);
|
|
113
|
-
}
|
|
114
|
-
return Arguments.createMap();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
@NonNull
|
|
118
|
-
public WritableMap getTextTrackCueInfo(TextTrackCue cue) {
|
|
119
|
-
if (player != null) {
|
|
120
|
-
return TrackListInfo.fromTextTrackCue(cue);
|
|
121
|
-
}
|
|
122
|
-
return Arguments.createMap();
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
@NonNull
|
|
126
|
-
public WritableArray getAudioTrackInfo() {
|
|
127
|
-
if (player != null) {
|
|
128
|
-
return TrackListInfo.fromAudioTrackList(player.getAudioTracks());
|
|
129
|
-
}
|
|
130
|
-
return Arguments.createArray();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
@NonNull
|
|
134
|
-
public WritableArray getVideoTrackInfo() {
|
|
135
|
-
if (player != null) {
|
|
136
|
-
return TrackListInfo.fromVideoTrackList(player.getVideoTracks());
|
|
137
|
-
}
|
|
138
|
-
return Arguments.createArray();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
public double getDuration() {
|
|
142
|
-
return TypeUtils.INSTANCE.encodeInfNan(player != null? 1e03 * player.getDuration() : Double.NaN);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
public void getSeekableRange(RequestCallback<TimeRanges> callback) {
|
|
146
|
-
if (player != null) {
|
|
147
|
-
player.requestSeekable(callback);
|
|
148
|
-
} else {
|
|
149
|
-
callback.handleResult(null);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
public void getBufferedRange(RequestCallback<TimeRanges> callback) {
|
|
154
|
-
if (player != null) {
|
|
155
|
-
player.requestBuffered(callback);
|
|
156
|
-
} else {
|
|
157
|
-
callback.handleResult(null);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
@Override
|
|
162
|
-
public void setId(int id) {
|
|
163
|
-
super.setId(id);
|
|
164
|
-
eventEmitter.setViewId(id);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
private void createViews(@NonNull THEOplayerConfig playerConfig) {
|
|
168
|
-
if (BuildConfig.LOG_VIEW_EVENTS) {
|
|
169
|
-
Log.d(TAG, "Create views");
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
LayoutParams layoutParams = new LayoutParams(
|
|
173
|
-
LayoutParams.MATCH_PARENT,
|
|
174
|
-
LayoutParams.MATCH_PARENT);
|
|
175
|
-
|
|
176
|
-
playerView = new THEOplayerView(reactContext.getCurrentActivity(), playerConfig) {
|
|
177
|
-
private void measureAndLayout() {
|
|
178
|
-
measure(
|
|
179
|
-
View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), View.MeasureSpec.EXACTLY),
|
|
180
|
-
View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), View.MeasureSpec.EXACTLY));
|
|
181
|
-
layout(getLeft(), getTop(), getRight(), getBottom());
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
@Override
|
|
185
|
-
public void requestLayout() {
|
|
186
|
-
super.requestLayout();
|
|
187
|
-
|
|
188
|
-
// schedule a forced layout
|
|
189
|
-
handler.post(this::measureAndLayout);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
playerView.setLayoutParams(layoutParams);
|
|
193
|
-
|
|
194
|
-
addView(playerView, 0, layoutParams);
|
|
195
|
-
addIntegrations(playerView, playerConfig);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
private void addIntegrations(@NonNull final THEOplayerView playerView, @NonNull THEOplayerConfig playerConfig) {
|
|
199
|
-
try {
|
|
200
|
-
if (BuildConfig.EXTENSION_GOOGLE_IMA) {
|
|
201
|
-
imaIntegration = GoogleImaIntegrationFactory.createGoogleImaIntegration(playerView);
|
|
202
|
-
imaIntegration.setAdsRenderingSettings(createRenderSettings(playerConfig));
|
|
203
|
-
playerView.getPlayer().addIntegration(imaIntegration);
|
|
204
|
-
}
|
|
205
|
-
} catch (Exception ignore) {
|
|
206
|
-
}
|
|
207
|
-
try {
|
|
208
|
-
if (BuildConfig.EXTENSION_GOOGLE_DAI) {
|
|
209
|
-
daiIntegration = GoogleDaiIntegrationFactory.createGoogleDaiIntegration(playerView);
|
|
210
|
-
daiIntegration.setAdsRenderingSettings(createRenderSettings(playerConfig));
|
|
211
|
-
playerView.getPlayer().addIntegration(daiIntegration);
|
|
212
|
-
}
|
|
213
|
-
} catch (Exception ignore) {
|
|
214
|
-
}
|
|
215
|
-
try {
|
|
216
|
-
if (BuildConfig.EXTENSION_CAST) {
|
|
217
|
-
CastIntegration castIntegration = CastIntegrationFactory.createCastIntegration(playerView);
|
|
218
|
-
playerView.getPlayer().addIntegration(castIntegration);
|
|
219
|
-
}
|
|
220
|
-
// Add other future integrations here.
|
|
221
|
-
} catch (Exception ignore) {
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
private AdsRenderingSettings createRenderSettings(@NonNull THEOplayerConfig playerConfig) {
|
|
226
|
-
AdsRenderingSettings renderingSettings = ImaSdkFactory.getInstance().createAdsRenderingSettings();
|
|
227
|
-
if (playerConfig.getAds() != null && !playerConfig.getAds().isShowCountdown()) {
|
|
228
|
-
renderingSettings.setUiElements(Collections.emptySet());
|
|
229
|
-
renderingSettings.setDisableUi(true);
|
|
230
|
-
}
|
|
231
|
-
return renderingSettings;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
@Override
|
|
235
|
-
protected void onAttachedToWindow() {
|
|
236
|
-
if (BuildConfig.LOG_VIEW_EVENTS) {
|
|
237
|
-
Log.d(TAG, "onAttachedToWindow");
|
|
238
|
-
}
|
|
239
|
-
super.onAttachedToWindow();
|
|
240
|
-
initializePlayer();
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
@Override
|
|
244
|
-
protected void onDetachedFromWindow() {
|
|
245
|
-
if (BuildConfig.LOG_VIEW_EVENTS) {
|
|
246
|
-
Log.d(TAG, "onDetachedFromWindow");
|
|
247
|
-
}
|
|
248
|
-
super.onDetachedFromWindow();
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
private void initializePlayer() {
|
|
252
|
-
// This ensures all props have been settled, to avoid async racing conditions.
|
|
253
|
-
new Handler().postDelayed(() -> {
|
|
254
|
-
if (player == null) {
|
|
255
|
-
player = playerView.getPlayer();
|
|
256
|
-
ABRConfigurationAdapter.INSTANCE.applyABRConfigurationFromProps(player, abrConfig);
|
|
257
|
-
if (BuildConfig.EXTENSION_ADS) {
|
|
258
|
-
adsApi.initialize(player, imaIntegration, daiIntegration);
|
|
259
|
-
}
|
|
260
|
-
eventEmitter.attachListeners(player);
|
|
261
|
-
player.setMuted(muted);
|
|
262
|
-
player.setVolume(volume);
|
|
263
|
-
player.setPlaybackRate(playbackRate);
|
|
264
|
-
|
|
265
|
-
setSource(sourceDescription);
|
|
266
|
-
|
|
267
|
-
if (!this.paused) {
|
|
268
|
-
player.play();
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
if (seekTime != TIME_UNSET) {
|
|
272
|
-
seekTo(seekTime);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}, 1);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
@Nullable
|
|
279
|
-
public Player getPlayer() {
|
|
280
|
-
return player;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
@NonNull
|
|
284
|
-
public AdsApiWrapper getAdsApi() {
|
|
285
|
-
return adsApi;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
@Override
|
|
289
|
-
public void onHostResume() {
|
|
290
|
-
if (BuildConfig.LOG_VIEW_EVENTS) {
|
|
291
|
-
Log.d(TAG, "onHostResume");
|
|
292
|
-
}
|
|
293
|
-
if (playerView != null) {
|
|
294
|
-
playerView.onResume();
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
@Override
|
|
299
|
-
public void onHostPause() {
|
|
300
|
-
if (BuildConfig.LOG_VIEW_EVENTS) {
|
|
301
|
-
Log.d(TAG, "onHostPause");
|
|
302
|
-
}
|
|
303
|
-
if (playerView != null) {
|
|
304
|
-
playerView.onPause();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
@Override
|
|
309
|
-
public void onHostDestroy() {
|
|
310
|
-
if (BuildConfig.LOG_VIEW_EVENTS) {
|
|
311
|
-
Log.d(TAG, "onHostDestroy");
|
|
312
|
-
}
|
|
313
|
-
cleanUpResources();
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
public void cleanUpResources() {
|
|
317
|
-
if (BuildConfig.LOG_VIEW_EVENTS) {
|
|
318
|
-
Log.d(TAG, "cleanUpResources");
|
|
319
|
-
}
|
|
320
|
-
releasePlayer();
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
private void releasePlayer() {
|
|
324
|
-
if (player != null) {
|
|
325
|
-
eventEmitter.removeListeners(player);
|
|
326
|
-
|
|
327
|
-
if (adsApi != null) {
|
|
328
|
-
adsApi.destroy();
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
player.stop();
|
|
332
|
-
player = null;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (playerView != null) {
|
|
336
|
-
playerView.onDestroy();
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
reactContext.removeLifecycleEventListener(this);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
public void setSource(@Nullable final ReadableMap source) {
|
|
343
|
-
try {
|
|
344
|
-
setSource(new SourceHelper().parseSourceFromJS(source));
|
|
345
|
-
} catch (THEOplayerException exception) {
|
|
346
|
-
Log.e(TAG, exception.getMessage());
|
|
347
|
-
eventEmitter.emitError(exception);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
public void setABRConfig(@Nullable ReadableMap abrConfigProps) {
|
|
352
|
-
abrConfig = abrConfigProps;
|
|
353
|
-
ABRConfigurationAdapter.INSTANCE.applyABRConfigurationFromProps(player, abrConfig);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
public void setSource(@Nullable final SourceDescription sourceDescription) {
|
|
357
|
-
this.sourceDescription = sourceDescription;
|
|
358
|
-
if (adsApi != null) {
|
|
359
|
-
adsApi.setSource(sourceDescription);
|
|
360
|
-
}
|
|
361
|
-
if (player != null && sourceDescription != null) {
|
|
362
|
-
player.setSource(sourceDescription);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
public void setPaused(boolean paused) {
|
|
367
|
-
this.paused = paused;
|
|
368
|
-
if (player != null) {
|
|
369
|
-
final boolean playerIsPaused = player.isPaused();
|
|
370
|
-
if (!paused && playerIsPaused) {
|
|
371
|
-
player.play();
|
|
372
|
-
} else if (paused && (!playerIsPaused || adsApi.isPlaying())) {
|
|
373
|
-
player.pause();
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
public void setMuted(boolean muted) {
|
|
379
|
-
this.muted = muted;
|
|
380
|
-
if (player != null) {
|
|
381
|
-
player.setMuted(muted);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
public void setVolume(double volume) {
|
|
386
|
-
this.volume = volume;
|
|
387
|
-
if (player != null) {
|
|
388
|
-
player.setVolume(volume);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
public void setPlaybackRate(double playbackRate) {
|
|
393
|
-
this.playbackRate = playbackRate;
|
|
394
|
-
if (player != null) {
|
|
395
|
-
player.setPlaybackRate(playbackRate);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
public void seekTo(double seekTime) {
|
|
400
|
-
this.seekTime = seekTime;
|
|
401
|
-
if (player != null) {
|
|
402
|
-
player.setCurrentTime(1e-03 * seekTime);
|
|
403
|
-
this.seekTime = TIME_UNSET;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
@Nullable
|
|
408
|
-
public TextTrack getSelectedTextTrack() {
|
|
409
|
-
if (player != null) {
|
|
410
|
-
final TextTrackList tracks = player.getTextTracks();
|
|
411
|
-
for (int i = 0; i < tracks.length(); i++) {
|
|
412
|
-
final TextTrack track = tracks.getItem(i);
|
|
413
|
-
if (track.getMode() == TextTrackMode.SHOWING) {
|
|
414
|
-
return track;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
return null;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
public void setSelectedTextTrack(int uid) {
|
|
422
|
-
if (player != null) {
|
|
423
|
-
for (final TextTrack track: player.getTextTracks()) {
|
|
424
|
-
if (track.getUid() == uid) {
|
|
425
|
-
track.setMode(TextTrackMode.SHOWING);
|
|
426
|
-
} else if (track.getMode() == TextTrackMode.SHOWING) {
|
|
427
|
-
track.setMode(TextTrackMode.DISABLED);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
@Nullable
|
|
434
|
-
public MediaTrack<AudioQuality> getSelectedAudioTrack() {
|
|
435
|
-
if (player != null) {
|
|
436
|
-
final MediaTrackList<AudioQuality> tracks = player.getAudioTracks();
|
|
437
|
-
for (int i = 0; i < tracks.length(); i++) {
|
|
438
|
-
final MediaTrack<AudioQuality> track = tracks.getItem(i);
|
|
439
|
-
if (track.isEnabled()) {
|
|
440
|
-
return track;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
return null;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
public void setSelectedAudioTrack(int uid) {
|
|
448
|
-
if (player != null) {
|
|
449
|
-
for (final MediaTrack<AudioQuality> track: player.getAudioTracks()) {
|
|
450
|
-
track.setEnabled(track.getUid() == uid);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
@Nullable
|
|
456
|
-
public MediaTrack<VideoQuality> getSelectedVideoTrack() {
|
|
457
|
-
if (player != null) {
|
|
458
|
-
final MediaTrackList<VideoQuality> tracks = player.getVideoTracks();
|
|
459
|
-
for (int i = 0; i < tracks.length(); i++) {
|
|
460
|
-
final MediaTrack<VideoQuality> track = tracks.getItem(i);
|
|
461
|
-
if (track.isEnabled()) {
|
|
462
|
-
return track;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
return null;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
public void setSelectedVideoTrack(int uid) {
|
|
470
|
-
if (player != null) {
|
|
471
|
-
for (final MediaTrack<VideoQuality> track: player.getVideoTracks()) {
|
|
472
|
-
track.setEnabled(track.getUid() == uid);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
public void setTargetVideoQualities(ReadableArray uids) {
|
|
478
|
-
MediaTrack<VideoQuality> currentVideoTrack = getSelectedVideoTrack();
|
|
479
|
-
if (currentVideoTrack != null) {
|
|
480
|
-
if (uids.size() == 0) {
|
|
481
|
-
// Reset target qualities when passing empty list.
|
|
482
|
-
currentVideoTrack.setTargetQuality(null);
|
|
483
|
-
} else {
|
|
484
|
-
QualityList<VideoQuality> qualities = currentVideoTrack.getQualities();
|
|
485
|
-
if (qualities != null) {
|
|
486
|
-
currentVideoTrack.setTargetQualities(new QualityListFilter<>(qualities).filterQualityList(uids));
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
@SuppressLint("ObsoleteSdkInt")
|
|
493
|
-
public void setFullscreen(boolean fullscreen) {
|
|
494
|
-
if (fullscreen == this.fullscreen) {
|
|
495
|
-
return; // Avoid generating events when nothing is changing
|
|
496
|
-
}
|
|
497
|
-
this.fullscreen = fullscreen;
|
|
498
|
-
|
|
499
|
-
Activity activity = reactContext.getCurrentActivity();
|
|
500
|
-
if (activity == null) {
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
Window window = activity.getWindow();
|
|
504
|
-
View decorView = window.getDecorView();
|
|
505
|
-
int uiOptions;
|
|
506
|
-
if (fullscreen) {
|
|
507
|
-
if (Build.VERSION.SDK_INT >= 19) { // 4.4+
|
|
508
|
-
uiOptions = SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
509
|
-
| SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
|
510
|
-
| SYSTEM_UI_FLAG_FULLSCREEN;
|
|
511
|
-
} else {
|
|
512
|
-
uiOptions = SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
513
|
-
| SYSTEM_UI_FLAG_FULLSCREEN;
|
|
514
|
-
}
|
|
515
|
-
eventEmitter.onFullscreenWillPresent();
|
|
516
|
-
decorView.setSystemUiVisibility(uiOptions);
|
|
517
|
-
eventEmitter.onFullscreenDidPresent();
|
|
518
|
-
} else {
|
|
519
|
-
uiOptions = View.SYSTEM_UI_FLAG_VISIBLE;
|
|
520
|
-
eventEmitter.onFullscreenWillDismiss();
|
|
521
|
-
decorView.setSystemUiVisibility(uiOptions);
|
|
522
|
-
eventEmitter.onFullscreenDidDismiss();
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
package com.theoplayer;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
import androidx.annotation.Nullable;
|
|
5
|
-
|
|
6
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
7
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
8
|
-
import com.facebook.react.common.MapBuilder;
|
|
9
|
-
import com.facebook.react.uimanager.ThemedReactContext;
|
|
10
|
-
import com.facebook.react.uimanager.ViewGroupManager;
|
|
11
|
-
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
12
|
-
|
|
13
|
-
import java.util.Map;
|
|
14
|
-
|
|
15
|
-
public class ReactTHEOplayerViewManager extends ViewGroupManager<ReactTHEOplayerView> {
|
|
16
|
-
public static final String REACT_CLASS = "THEOplayerRCTView";
|
|
17
|
-
|
|
18
|
-
private static final String PROP_CONFIG = "config";
|
|
19
|
-
private static final String PROP_ABR_CONFIG = "abrConfig";
|
|
20
|
-
private static final String PROP_SRC = "src";
|
|
21
|
-
private static final String PROP_SEEK = "seek";
|
|
22
|
-
private static final String PROP_PAUSED = "paused";
|
|
23
|
-
private static final String PROP_MUTED = "muted";
|
|
24
|
-
private static final String PROP_VOLUME = "volume";
|
|
25
|
-
private static final String PROP_PLAYBACKRATE = "playbackRate";
|
|
26
|
-
private static final String PROP_FULLSCREEN = "fullscreen";
|
|
27
|
-
private static final String PROP_SELECTED_TEXTTRACK = "selectedTextTrack";
|
|
28
|
-
private static final String PROP_SELECTED_AUDIOTRACK = "selectedAudioTrack";
|
|
29
|
-
private static final String PROP_SELECTED_VIDEOTRACK = "selectedVideoTrack";
|
|
30
|
-
private static final String PROP_TARGET_VIDEOQUALITY = "targetVideoQuality";
|
|
31
|
-
|
|
32
|
-
@Override
|
|
33
|
-
@NonNull
|
|
34
|
-
public String getName() {
|
|
35
|
-
return REACT_CLASS;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@NonNull
|
|
39
|
-
@Override
|
|
40
|
-
protected ReactTHEOplayerView createViewInstance(@NonNull ThemedReactContext reactContext) {
|
|
41
|
-
return new ReactTHEOplayerView(reactContext);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@Override
|
|
45
|
-
public void onDropViewInstance(ReactTHEOplayerView view) {
|
|
46
|
-
view.cleanUpResources();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@ReactProp(name = PROP_CONFIG)
|
|
50
|
-
public void setConfig(final ReactTHEOplayerView videoView, @Nullable ReadableMap config) {
|
|
51
|
-
videoView.initialize(config);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@ReactProp(name = PROP_ABR_CONFIG)
|
|
55
|
-
public void setABRConfig(final ReactTHEOplayerView videoView, @Nullable ReadableMap config) {
|
|
56
|
-
videoView.setABRConfig(config);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@ReactProp(name = PROP_SRC)
|
|
60
|
-
public void setSource(final ReactTHEOplayerView videoView, @Nullable ReadableMap src) {
|
|
61
|
-
videoView.setSource(src);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@ReactProp(name = PROP_SEEK)
|
|
65
|
-
public void setSeek(final ReactTHEOplayerView videoView, final double seek) {
|
|
66
|
-
videoView.seekTo(seek);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
@ReactProp(name = PROP_PAUSED, defaultBoolean = false)
|
|
70
|
-
public void setPaused(final ReactTHEOplayerView videoView, final boolean paused) {
|
|
71
|
-
videoView.setPaused(paused);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@ReactProp(name = PROP_MUTED, defaultBoolean = false)
|
|
75
|
-
public void setMuted(final ReactTHEOplayerView videoView, final boolean muted) {
|
|
76
|
-
videoView.setMuted(muted);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
@ReactProp(name = PROP_VOLUME, defaultDouble = 1.0)
|
|
80
|
-
public void setVolume(final ReactTHEOplayerView videoView, final double volume) {
|
|
81
|
-
videoView.setVolume(volume);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@ReactProp(name = PROP_PLAYBACKRATE, defaultDouble = 1.0)
|
|
85
|
-
public void setPlaybackRate(final ReactTHEOplayerView videoView, final double playbackRate) {
|
|
86
|
-
videoView.setPlaybackRate(playbackRate);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@ReactProp(name = PROP_FULLSCREEN, defaultBoolean = false)
|
|
90
|
-
public void setFullscreen(final ReactTHEOplayerView videoView, final boolean fullscreen) {
|
|
91
|
-
videoView.setFullscreen(fullscreen);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@ReactProp(name = PROP_SELECTED_TEXTTRACK, defaultInt = -1)
|
|
95
|
-
public void setSelectedTextTrack(final ReactTHEOplayerView videoView, final int uid) {
|
|
96
|
-
videoView.setSelectedTextTrack(uid);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@ReactProp(name = PROP_SELECTED_AUDIOTRACK, defaultInt = -1)
|
|
100
|
-
public void setSelectedAudioTrack(final ReactTHEOplayerView videoView, final int uid) {
|
|
101
|
-
if (uid != -1) {
|
|
102
|
-
videoView.setSelectedAudioTrack(uid);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
@ReactProp(name = PROP_SELECTED_VIDEOTRACK, defaultInt = -1)
|
|
107
|
-
public void setSelectedVideoTrack(final ReactTHEOplayerView videoView, final int uid) {
|
|
108
|
-
if (uid != -1) {
|
|
109
|
-
videoView.setSelectedVideoTrack(uid);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
@ReactProp(name = PROP_TARGET_VIDEOQUALITY)
|
|
114
|
-
public void setTargetVideoQuality(final ReactTHEOplayerView videoView, final ReadableArray uid) {
|
|
115
|
-
videoView.setTargetVideoQualities(uid);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
@Override
|
|
119
|
-
public @Nullable
|
|
120
|
-
Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
121
|
-
MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
|
|
122
|
-
for (String event : VideoEventEmitter.Events) {
|
|
123
|
-
builder.put(event, MapBuilder.of("registrationName", event));
|
|
124
|
-
}
|
|
125
|
-
return builder.build();
|
|
126
|
-
}
|
|
127
|
-
}
|