react-native-theoplayer 11.4.0 → 11.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -1
- package/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +12 -0
- package/ios/RCTBridgeModule+ViewHelpers.swift +59 -0
- package/ios/THEOplayerRCTBridge.m +1 -0
- package/ios/THEOplayerRCTMainEventHandler.swift +1 -0
- package/ios/THEOplayerRCTPlayerAPI.swift +194 -254
- package/ios/THEOplayerRCTTrackMetadataAggregator.swift +2 -2
- package/ios/THEOplayerRCTTypeUtils.swift +16 -0
- package/ios/THEOplayerRCTView.swift +7 -1
- package/ios/ads/THEOplayerRCTAdsAPI+DAI.swift +22 -21
- package/ios/ads/THEOplayerRCTAdsAPI+Omid.swift +4 -9
- package/ios/ads/THEOplayerRCTAdsAPI.swift +39 -50
- package/ios/backgroundAudio/THEOplayerRCTBackgroundAudioManager.swift +1 -1
- package/ios/backgroundAudio/THEOplayerRCTNowPlayingManager.swift +96 -45
- package/ios/cache/THEOplayerRCTCacheAPI.swift +23 -11
- package/ios/casting/THEOplayerRCTCastAPI+Airplay.swift +20 -22
- package/ios/casting/THEOplayerRCTCastAPI+Chromecast.swift +28 -34
- package/ios/casting/THEOplayerRCTCastAPI.swift +5 -8
- package/ios/eventBroadcasting/THEOplayerRCTEventBroadcastAPI.swift +2 -4
- package/ios/theoAds/THEOplayerRCTTHEOAdsAPI.swift +16 -18
- package/ios/theolive/THEOplayerRCTTHEOliveAPI.swift +14 -14
- package/lib/commonjs/api/error/ContentProtectionError.js +2 -0
- package/lib/commonjs/api/error/ContentProtectionError.js.map +1 -0
- package/lib/commonjs/api/error/barrel.js +11 -0
- package/lib/commonjs/api/error/barrel.js.map +1 -1
- package/lib/commonjs/api/event/PlayerEvent.js +8 -0
- package/lib/commonjs/api/event/PlayerEvent.js.map +1 -1
- package/lib/commonjs/api/player/PlayerEventMap.js +1 -0
- package/lib/commonjs/api/player/PlayerEventMap.js.map +1 -1
- package/lib/commonjs/api/track/TextTrack.js +5 -2
- package/lib/commonjs/api/track/TextTrack.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.js +4 -0
- package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
- package/lib/commonjs/internal/adapter/WebEventForwarder.js +22 -0
- package/lib/commonjs/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/PlayerEvents.js +8 -1
- package/lib/commonjs/internal/adapter/event/PlayerEvents.js.map +1 -1
- package/lib/commonjs/manifest.json +1 -1
- package/lib/module/api/error/ContentProtectionError.js +2 -0
- package/lib/module/api/error/ContentProtectionError.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/PlayerEvent.js +9 -0
- package/lib/module/api/event/PlayerEvent.js.map +1 -1
- package/lib/module/api/player/PlayerEventMap.js +1 -0
- package/lib/module/api/player/PlayerEventMap.js.map +1 -1
- package/lib/module/api/track/TextTrack.js +5 -2
- package/lib/module/api/track/TextTrack.js.map +1 -1
- package/lib/module/internal/THEOplayerView.js +5 -1
- package/lib/module/internal/THEOplayerView.js.map +1 -1
- package/lib/module/internal/adapter/WebEventForwarder.js +23 -1
- package/lib/module/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/module/internal/adapter/event/PlayerEvents.js +6 -0
- package/lib/module/internal/adapter/event/PlayerEvents.js.map +1 -1
- package/lib/module/manifest.json +1 -1
- package/lib/typescript/api/error/ContentProtectionError.d.ts +53 -0
- package/lib/typescript/api/error/ContentProtectionError.d.ts.map +1 -0
- package/lib/typescript/api/error/barrel.d.ts +1 -0
- package/lib/typescript/api/error/barrel.d.ts.map +1 -1
- package/lib/typescript/api/event/PlayerEvent.d.ts +15 -1
- package/lib/typescript/api/event/PlayerEvent.d.ts.map +1 -1
- package/lib/typescript/api/player/PlayerEventMap.d.ts +7 -2
- package/lib/typescript/api/player/PlayerEventMap.d.ts.map +1 -1
- package/lib/typescript/api/track/TextTrack.d.ts.map +1 -1
- package/lib/typescript/internal/THEOplayerView.d.ts +1 -0
- package/lib/typescript/internal/THEOplayerView.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/WebEventForwarder.d.ts +1 -0
- package/lib/typescript/internal/adapter/WebEventForwarder.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/event/PlayerEvents.d.ts +5 -1
- package/lib/typescript/internal/adapter/event/PlayerEvents.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/event/native/NativePlayerEvent.d.ts +4 -1
- package/lib/typescript/internal/adapter/event/native/NativePlayerEvent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/error/ContentProtectionError.ts +58 -0
- package/src/api/error/barrel.ts +1 -0
- package/src/api/event/PlayerEvent.ts +16 -1
- package/src/api/player/PlayerEventMap.ts +7 -0
- package/src/api/track/TextTrack.ts +5 -2
- package/src/internal/THEOplayerView.tsx +8 -0
- package/src/internal/adapter/WebEventForwarder.ts +19 -0
- package/src/internal/adapter/event/PlayerEvents.ts +8 -0
- package/src/internal/adapter/event/native/NativePlayerEvent.ts +5 -0
- package/src/manifest.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,25 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [11.5.0]
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Fixed an issue on iOS where fetching the artwork for the `NowPlayingInfo` could cause a crash due to unsafe thread usage.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Added `contentprotectionerror` player event on Web and Android platforms.
|
|
17
|
+
|
|
18
|
+
## [11.4.1] - 26-07-22
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Added RCTBridgeModule extension on iOS, with helper methods to resolve the view and native player APIs.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Fixed an issue on iOS where sideloaded texttracks were not stored for cached playout.
|
|
9
27
|
|
|
10
28
|
## [11.4.0] - 26-07-06
|
|
11
29
|
|
|
@@ -85,6 +85,7 @@ private const val EVENT_THEOLIVE_EVENT = "onNativeTHEOliveEvent"
|
|
|
85
85
|
private const val EVENT_THEOADS_EVENT = "onNativeTHEOadsEvent"
|
|
86
86
|
private const val EVENT_PRESENTATIONMODECHANGE = "onNativePresentationModeChange"
|
|
87
87
|
private const val EVENT_VOLUMECHANGE = "onNativeVolumeChange"
|
|
88
|
+
private const val EVENT_CONTENTPROTECTIONERROR = "onNativeContentProtectionError"
|
|
88
89
|
private const val EVENT_DIMENSIONCHANGE = "onNativeDimensionChange"
|
|
89
90
|
private const val EVENT_VIDEORESIZE = "onNativeVideoResize"
|
|
90
91
|
|
|
@@ -132,6 +133,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
132
133
|
EVENT_THEOADS_EVENT,
|
|
133
134
|
EVENT_PRESENTATIONMODECHANGE,
|
|
134
135
|
EVENT_VOLUMECHANGE,
|
|
136
|
+
EVENT_CONTENTPROTECTIONERROR,
|
|
135
137
|
EVENT_DIMENSIONCHANGE,
|
|
136
138
|
EVENT_VIDEORESIZE
|
|
137
139
|
)
|
|
@@ -171,6 +173,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
171
173
|
EVENT_THEOADS_EVENT,
|
|
172
174
|
EVENT_PRESENTATIONMODECHANGE,
|
|
173
175
|
EVENT_VOLUMECHANGE,
|
|
176
|
+
EVENT_CONTENTPROTECTIONERROR,
|
|
174
177
|
EVENT_DIMENSIONCHANGE,
|
|
175
178
|
EVENT_VIDEORESIZE
|
|
176
179
|
)
|
|
@@ -246,6 +249,8 @@ class PlayerEventEmitter internal constructor(
|
|
|
246
249
|
EventListener { event: PresentationModeChange -> onPresentationModeChange(event) }
|
|
247
250
|
playerListeners[PlayerEventTypes.VOLUMECHANGE] =
|
|
248
251
|
EventListener { event: VolumeChangeEvent -> onVolumeChange(event) }
|
|
252
|
+
playerListeners[PlayerEventTypes.CONTENTPROTECTIONERROR] =
|
|
253
|
+
EventListener { event: ContentProtectionErrorEvent -> onContentProtectionError(event) }
|
|
249
254
|
playerListeners[PlayerEventTypes.RESIZE] =
|
|
250
255
|
EventListener { event: ResizeEvent -> onResize(event) }
|
|
251
256
|
textTrackListeners[TextTrackListEventTypes.ADDTRACK] =
|
|
@@ -479,6 +484,13 @@ class PlayerEventEmitter internal constructor(
|
|
|
479
484
|
)
|
|
480
485
|
}
|
|
481
486
|
|
|
487
|
+
private fun onContentProtectionError(event: ContentProtectionErrorEvent) {
|
|
488
|
+
receiveEvent(
|
|
489
|
+
EVENT_CONTENTPROTECTIONERROR,
|
|
490
|
+
PayloadBuilder().error(event.errorObject.code.id.toString(), event.errorObject.message).build()
|
|
491
|
+
)
|
|
492
|
+
}
|
|
493
|
+
|
|
482
494
|
private fun onResize(event: ResizeEvent) {
|
|
483
495
|
receiveEvent(
|
|
484
496
|
EVENT_VIDEORESIZE,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// RCTBridgeModule+ViewHelpers.swift
|
|
2
|
+
|
|
3
|
+
import Foundation
|
|
4
|
+
import THEOplayerSDK
|
|
5
|
+
|
|
6
|
+
extension RCTBridgeModule {
|
|
7
|
+
|
|
8
|
+
/// Resolves the THEOplayerRCTView for the given react tag on the main thread and invokes the action.
|
|
9
|
+
/// If the view cannot be resolved, the optional onFailure callback is invoked instead.
|
|
10
|
+
func withView(_ node: NSNumber, _ action: @escaping (THEOplayerRCTView) -> Void, onFailure: (() -> Void)? = nil) {
|
|
11
|
+
DispatchQueue.main.async { [self] in
|
|
12
|
+
if let bridge = self.bridge as? RCTBridge,
|
|
13
|
+
let theView = bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView {
|
|
14
|
+
action(theView)
|
|
15
|
+
} else {
|
|
16
|
+
onFailure?()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/// Resolves the THEOplayerRCTView and its THEOplayer instance for the given react tag on the main thread.
|
|
22
|
+
/// If the view or player cannot be resolved, the optional onFailure callback is invoked instead.
|
|
23
|
+
func withViewAndPlayer(_ node: NSNumber, _ action: @escaping (THEOplayerRCTView, THEOplayer) -> Void, onFailure: (() -> Void)? = nil) {
|
|
24
|
+
withView(node, { theView in
|
|
25
|
+
if let player = theView.player {
|
|
26
|
+
action(theView, player)
|
|
27
|
+
} else {
|
|
28
|
+
onFailure?()
|
|
29
|
+
}
|
|
30
|
+
}, onFailure: onFailure)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// Resolves the THEOplayerRCTView and its Ads module for the given react tag on the main thread.
|
|
34
|
+
/// If the view or ads module cannot be resolved, the optional onFailure callback is invoked instead.
|
|
35
|
+
func withViewAndAds(_ node: NSNumber, _ action: @escaping (THEOplayerRCTView, Ads) -> Void, onFailure: (() -> Void)? = nil) {
|
|
36
|
+
withView(node, { theView in
|
|
37
|
+
if let ads = theView.ads() {
|
|
38
|
+
action(theView, ads)
|
|
39
|
+
} else {
|
|
40
|
+
onFailure?()
|
|
41
|
+
}
|
|
42
|
+
}, onFailure: onFailure)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#if os(iOS)
|
|
46
|
+
/// Resolves the THEOplayerRCTView and its Cast module for the given react tag on the main thread.
|
|
47
|
+
/// If the view or cast module cannot be resolved, the optional onFailure callback is invoked instead.
|
|
48
|
+
func withViewAndCast(_ node: NSNumber, _ action: @escaping (THEOplayerRCTView, Cast) -> Void, onFailure: (() -> Void)? = nil) {
|
|
49
|
+
withView(node, { theView in
|
|
50
|
+
if let cast = theView.cast() {
|
|
51
|
+
action(theView, cast)
|
|
52
|
+
} else {
|
|
53
|
+
onFailure?()
|
|
54
|
+
}
|
|
55
|
+
}, onFailure: onFailure)
|
|
56
|
+
}
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
}
|
|
@@ -47,6 +47,7 @@ RCT_EXPORT_VIEW_PROPERTY(onNativeMediaTrackEvent, RCTDirectEventBlock);
|
|
|
47
47
|
RCT_EXPORT_VIEW_PROPERTY(onNativeDeviceOrientationChanged, RCTDirectEventBlock);
|
|
48
48
|
RCT_EXPORT_VIEW_PROPERTY(onNativePlayerReady, RCTDirectEventBlock);
|
|
49
49
|
RCT_EXPORT_VIEW_PROPERTY(onNativePresentationModeChange, RCTDirectEventBlock);
|
|
50
|
+
RCT_EXPORT_VIEW_PROPERTY(onNativeContentProtectionError, RCTDirectEventBlock);
|
|
50
51
|
RCT_EXPORT_VIEW_PROPERTY(onNativeDimensionChange, RCTDirectEventBlock);
|
|
51
52
|
RCT_EXPORT_VIEW_PROPERTY(onNativeVideoResize, RCTDirectEventBlock);
|
|
52
53
|
RCT_EXPORT_VIEW_PROPERTY(onNativeAdEvent, RCTDirectEventBlock);
|
|
@@ -30,6 +30,7 @@ public class THEOplayerRCTMainEventHandler {
|
|
|
30
30
|
var onNativeRateChange: RCTDirectEventBlock?
|
|
31
31
|
var onNativeWaiting: RCTDirectEventBlock?
|
|
32
32
|
var onNativeCanPlay: RCTDirectEventBlock?
|
|
33
|
+
var onNativeContentProtectionError: RCTDirectEventBlock?
|
|
33
34
|
var onNativeDimensionChange: RCTDirectEventBlock?
|
|
34
35
|
var onNativeVideoResize: RCTDirectEventBlock?
|
|
35
36
|
|