react-native-theoplayer 2.3.0 → 2.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +12 -0
  3. package/android/src/main/java/com/theoplayer/presentation/PipUtils.kt +5 -1
  4. package/android/src/main/java/com/theoplayer/track/TrackListAdapter.kt +3 -2
  5. package/android/src/main/java/com/theoplayer/util/TypeUtils.kt +6 -6
  6. package/ios/THEOplayerRCTBridge.m +3 -0
  7. package/ios/THEOplayerRCTMainEventHandler.swift +16 -13
  8. package/ios/THEOplayerRCTPlayerAPI.swift +15 -0
  9. package/ios/THEOplayerRCTTrackMetadataAggregator.swift +2 -2
  10. package/ios/THEOplayerRCTTypeUtils.swift +26 -0
  11. package/ios/THEOplayerRCTView.swift +3 -1
  12. package/ios/backgroundAudio/THEOplayerRCTNowPlayingManager.swift +7 -5
  13. package/ios/backgroundAudio/THEOplayerRCTView+BackgroundAudioConfig.swift +12 -0
  14. package/lib/commonjs/api/player/THEOplayer.js +18 -0
  15. package/lib/commonjs/api/player/THEOplayer.js.map +1 -1
  16. package/lib/commonjs/api/source/SourceDescription.js.map +1 -1
  17. package/lib/commonjs/internal/THEOplayerView.js +6 -1
  18. package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
  19. package/lib/commonjs/internal/THEOplayerView.web.js +7 -7
  20. package/lib/commonjs/internal/THEOplayerView.web.js.map +1 -1
  21. package/lib/commonjs/internal/adapter/NativePlayerState.js.map +1 -1
  22. package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +9 -1
  23. package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
  24. package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js +7 -1
  25. package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
  26. package/lib/commonjs/internal/adapter/web/TrackUtils.js +3 -2
  27. package/lib/commonjs/internal/adapter/web/TrackUtils.js.map +1 -1
  28. package/lib/commonjs/internal/adapter/web/WebMediaSession.js +17 -29
  29. package/lib/commonjs/internal/adapter/web/WebMediaSession.js.map +1 -1
  30. package/lib/commonjs/internal/adapter/web/WebPresentationModeManager.js +1 -1
  31. package/lib/commonjs/internal/adapter/web/WebPresentationModeManager.js.map +1 -1
  32. package/lib/module/api/player/THEOplayer.js +16 -1
  33. package/lib/module/api/player/THEOplayer.js.map +1 -1
  34. package/lib/module/api/source/SourceDescription.js.map +1 -1
  35. package/lib/module/internal/THEOplayerView.js +6 -1
  36. package/lib/module/internal/THEOplayerView.js.map +1 -1
  37. package/lib/module/internal/THEOplayerView.web.js +7 -7
  38. package/lib/module/internal/THEOplayerView.web.js.map +1 -1
  39. package/lib/module/internal/adapter/NativePlayerState.js.map +1 -1
  40. package/lib/module/internal/adapter/THEOplayerAdapter.js +10 -2
  41. package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
  42. package/lib/module/internal/adapter/THEOplayerWebAdapter.js +7 -1
  43. package/lib/module/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
  44. package/lib/module/internal/adapter/web/TrackUtils.js +3 -2
  45. package/lib/module/internal/adapter/web/TrackUtils.js.map +1 -1
  46. package/lib/module/internal/adapter/web/WebMediaSession.js +15 -29
  47. package/lib/module/internal/adapter/web/WebMediaSession.js.map +1 -1
  48. package/lib/module/internal/adapter/web/WebPresentationModeManager.js +1 -1
  49. package/lib/module/internal/adapter/web/WebPresentationModeManager.js.map +1 -1
  50. package/lib/typescript/api/player/THEOplayer.d.ts +22 -0
  51. package/lib/typescript/api/source/SourceDescription.d.ts +6 -0
  52. package/lib/typescript/internal/adapter/NativePlayerState.d.ts +2 -0
  53. package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts +3 -1
  54. package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts +4 -2
  55. package/lib/typescript/internal/adapter/web/WebMediaSession.d.ts +2 -1
  56. package/package.json +9 -4
  57. package/src/api/player/THEOplayer.ts +24 -0
  58. package/src/api/source/SourceDescription.ts +8 -0
  59. package/src/internal/THEOplayerView.tsx +6 -1
  60. package/src/internal/THEOplayerView.web.tsx +4 -7
  61. package/src/internal/adapter/NativePlayerState.ts +2 -0
  62. package/src/internal/adapter/THEOplayerAdapter.ts +12 -1
  63. package/src/internal/adapter/THEOplayerWebAdapter.ts +10 -2
  64. package/src/internal/adapter/web/TrackUtils.ts +3 -2
  65. package/src/internal/adapter/web/WebMediaSession.ts +14 -29
  66. package/src/internal/adapter/web/WebPresentationModeManager.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,35 @@ 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.0.0/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.5.0] - 23-04-26
9
+
10
+ ### Added
11
+
12
+ - Added an `aspectRatio` property on the `THEOplayer` instance that can be either `FIT` (default), `FILL` or `ASPECT_FILL`.
13
+
14
+ ### Changed
15
+
16
+ - Set `theoplayer` Web SDK as optional peer dependency.
17
+
18
+ ## [2.4.0] - 23-04-21
19
+
20
+ ### Fixed
21
+
22
+ - Fixed an issue on iOS and Android where cue event properties `startTime` and `endTime` with value `Infinity` or `NaN` were not passed correctly.
23
+ - Fixed an issue on iOS Safari where switching to fullscreen presentation during an ad would not work.
24
+ - Fixed an issue on iOS Safari where an ad could be skipped during unmuted autoplay.
25
+ - Fixed a memory leak on iOS where the player would be allocated after being destroyed.
26
+ - Fixed an issue on Android where building the SDK would require IMA to be enabled.
27
+
28
+ ### Changed
29
+
30
+ - Changed Web media session controls to only show trick-play buttons if the player is in foreground, or `backgroundAudioEnabled` is `true`, and never for ads and live stream.
31
+ - Changed Web media session controls to only show a play/pause button if the player is in foreground, or `backgroundAudioEnabled` is `true`, and never for ads.
32
+
33
+ ### Added
34
+
35
+ - Added the `crossOrigin` property to `SourceDescription` for requesting CORS access to content.
36
+
8
37
  ## [2.3.0] - 23-04-14
9
38
 
10
39
  ### Changed
@@ -3,6 +3,7 @@ package com.theoplayer.player
3
3
  import com.facebook.react.bridge.*
4
4
  import com.theoplayer.*
5
5
  import com.theoplayer.abr.ABRConfigurationAdapter
6
+ import com.theoplayer.android.api.player.AspectRatio
6
7
  import com.theoplayer.android.api.player.PreloadType
7
8
  import com.theoplayer.android.api.player.PresentationMode
8
9
  import com.theoplayer.android.api.player.track.mediatrack.MediaTrack
@@ -175,4 +176,15 @@ class PlayerModule(context: ReactApplicationContext) : ReactContextBaseJavaModul
175
176
  view?.playerContext?.backgroundAudioConfig = BackgroundAudioConfigAdapter.fromProps(config)
176
177
  }
177
178
  }
179
+
180
+ @ReactMethod
181
+ fun setAspectRatio(tag: Int, ratio: String) {
182
+ viewResolver.resolveViewByTag(tag) { view: ReactTHEOplayerView? ->
183
+ view?.player?.setAspectRatio(when (ratio) {
184
+ "fill" -> AspectRatio.FILL
185
+ "aspectFill" -> AspectRatio.ASPECT_FILL
186
+ else -> AspectRatio.FIT
187
+ })
188
+ }
189
+ }
178
190
  }
@@ -17,6 +17,7 @@ import android.view.View
17
17
  import android.view.ViewGroup
18
18
  import androidx.annotation.RequiresApi
19
19
  import com.facebook.react.uimanager.ThemedReactContext
20
+ import com.theoplayer.BuildConfig
20
21
  import com.theoplayer.R
21
22
  import com.theoplayer.ReactTHEOplayerContext
22
23
  import com.theoplayer.android.api.ads.ima.GoogleImaAdEvent
@@ -48,7 +49,7 @@ class PipUtils(
48
49
  private var onPlayerAction: EventListener<PlayerEvent<*>>? = null
49
50
  private var onAdAction: EventListener<GoogleImaAdEvent>? = null
50
51
  private val playerEvents = listOf(PlayerEventTypes.PLAY, PlayerEventTypes.PAUSE)
51
- private val adEvents = listOf(GoogleImaAdEventType.STARTED, GoogleImaAdEventType.CONTENT_RESUME_REQUESTED)
52
+ private var adEvents = listOf<GoogleImaAdEventType>()
52
53
  private val broadcastReceiver: BroadcastReceiver = buildBroadcastReceiver()
53
54
 
54
55
  private val player: Player
@@ -61,6 +62,9 @@ class PipUtils(
61
62
  onAdAction = EventListener {
62
63
  updatePipParams()
63
64
  }
65
+ if (BuildConfig.EXTENSION_GOOGLE_IMA) {
66
+ adEvents = listOf(GoogleImaAdEventType.STARTED, GoogleImaAdEventType.CONTENT_RESUME_REQUESTED)
67
+ }
64
68
  }
65
69
 
66
70
  fun enable() {
@@ -11,6 +11,7 @@ import com.theoplayer.android.api.player.track.mediatrack.quality.Quality
11
11
  import com.theoplayer.android.api.player.track.mediatrack.quality.AudioQuality
12
12
  import com.theoplayer.android.api.player.track.mediatrack.quality.VideoQuality
13
13
  import com.theoplayer.android.api.player.track.mediatrack.MediaTrackList
14
+ import com.theoplayer.util.TypeUtils
14
15
 
15
16
  private const val PROP_ID = "id"
16
17
  private const val PROP_UID = "uid"
@@ -75,8 +76,8 @@ object TrackListAdapter {
75
76
  val cuePayload = Arguments.createMap()
76
77
  cuePayload.putString(PROP_ID, cue.id)
77
78
  cuePayload.putDouble(PROP_UID, cue.uid.toDouble())
78
- cuePayload.putDouble(PROP_STARTTIME, (1e3 * cue.startTime).toLong().toDouble())
79
- cuePayload.putDouble(PROP_ENDTIME, (1e3 * cue.endTime).toLong().toDouble())
79
+ cuePayload.putDouble(PROP_STARTTIME, TypeUtils.encodeInfNan(1e3 * cue.startTime))
80
+ cuePayload.putDouble(PROP_ENDTIME, TypeUtils.encodeInfNan(1e3 * cue.endTime))
80
81
  val content = cue.content
81
82
  if (content != null) {
82
83
  cuePayload.putString(
@@ -6,12 +6,12 @@ const val POS_INF_VALUE: Double = -2.0
6
6
  object TypeUtils {
7
7
  // Make sure we do not send INF or NaN double values over the bridge. It will break debug sessions.
8
8
  fun encodeInfNan(v: Double): Double {
9
- return when (v) {
10
- Double.NaN -> NAN_VALUE
11
- Double.POSITIVE_INFINITY -> POS_INF_VALUE
12
- else -> {
13
- return v
14
- }
9
+ if (v.isNaN()) {
10
+ return NAN_VALUE
15
11
  }
12
+ if (v.isInfinite()) {
13
+ return POS_INF_VALUE
14
+ }
15
+ return v
16
16
  }
17
17
  }
@@ -84,6 +84,9 @@ RCT_EXTERN_METHOD(setPlaybackRate:(nonnull NSNumber *)node
84
84
  RCT_EXTERN_METHOD(setPresentationMode:(nonnull NSNumber *)node
85
85
  presentationMode:(nonnull NSString *)presentationMode)
86
86
 
87
+ RCT_EXTERN_METHOD(setAspectRatio:(nonnull NSNumber *)node
88
+ ratio:(nonnull NSString *)ratio)
89
+
87
90
  RCT_EXTERN_METHOD(setPipConfig:(nonnull NSNumber *)node
88
91
  pipConfig:(NSDictionary)pipConfig)
89
92
 
@@ -3,7 +3,7 @@
3
3
  import Foundation
4
4
  import THEOplayerSDK
5
5
 
6
- class THEOplayerRCTMainEventHandler {
6
+ public class THEOplayerRCTMainEventHandler {
7
7
  // MARK: Members
8
8
  private weak var player: THEOplayer?
9
9
  private weak var presentationModeContext: THEOplayerRCTPresentationModeContext?
@@ -22,7 +22,7 @@ class THEOplayerRCTMainEventHandler {
22
22
  var onNativeSeeking: RCTDirectEventBlock?
23
23
  var onNativeSeeked: RCTDirectEventBlock?
24
24
  var onNativeEnded: RCTDirectEventBlock?
25
- var onNativeError: RCTDirectEventBlock?
25
+ public internal(set) var onNativeError: RCTDirectEventBlock?
26
26
  var onNativeLoadedData: RCTDirectEventBlock?
27
27
  var onNativeLoadedMetadata: RCTDirectEventBlock?
28
28
  var onNativeRateChange: RCTDirectEventBlock?
@@ -113,7 +113,7 @@ class THEOplayerRCTMainEventHandler {
113
113
  self.readyStateChangeListener = player.addEventListener(type: PlayerEventTypes.READY_STATE_CHANGE) { [weak self] event in
114
114
  if DEBUG_THEOPLAYER_EVENTS { print("[NATIVE] Received READY_STATE_CHANGE event from THEOplayer") }
115
115
  if let forwardedReadyStateChangeEvent = self?.onNativeReadyStateChange {
116
- forwardedReadyStateChangeEvent(["readyState": event.readyState.rawValue])
116
+ forwardedReadyStateChangeEvent(["readyState": event.readyState.rawValue - 1]) // [1-5] (iOS only) => [0-4] (other platforms + RN)
117
117
  }
118
118
  }
119
119
  if DEBUG_EVENTHANDLER { print("[NATIVE] ReadyStateChange listener attached to THEOplayer") }
@@ -132,13 +132,14 @@ class THEOplayerRCTMainEventHandler {
132
132
  if DEBUG_EVENTHANDLER { print("[NATIVE] DurationChange listener attached to THEOplayer") }
133
133
 
134
134
  // VOLUME_CHANGE
135
- self.volumeChangeListener = player.addEventListener(type: PlayerEventTypes.VOLUME_CHANGE) { [weak self] event in
135
+ self.volumeChangeListener = player.addEventListener(type: PlayerEventTypes.VOLUME_CHANGE) { [weak self, weak player] event in
136
136
  if DEBUG_THEOPLAYER_EVENTS { print("[NATIVE] Received VOLUME_CHANGE event from THEOplayer") }
137
- if let forwardedVolumeChangeEvent = self?.onNativeVolumeChange {
137
+ if let wplayer = player,
138
+ let forwardedVolumeChangeEvent = self?.onNativeVolumeChange {
138
139
  forwardedVolumeChangeEvent(
139
140
  [
140
141
  "volume": event.volume,
141
- "muted": player.muted
142
+ "muted": wplayer.muted
142
143
  ]
143
144
  )
144
145
  }
@@ -146,11 +147,12 @@ class THEOplayerRCTMainEventHandler {
146
147
  if DEBUG_EVENTHANDLER { print("[NATIVE] VolumeChange listener attached to THEOplayer") }
147
148
 
148
149
  // PROGRESS
149
- self.progressListener = player.addEventListener(type: PlayerEventTypes.PROGRESS) { [weak self] event in
150
+ self.progressListener = player.addEventListener(type: PlayerEventTypes.PROGRESS) { [weak self, weak player] event in
150
151
  //if DEBUG_THEOPLAYER_EVENTS { print("[NATIVE] Received PROGRESS event from THEOplayer") }
151
- if let forwardedProgressEvent = self?.onNativeProgress {
152
- player.requestSeekable(completionHandler: { seekableTimeRanges, error in
153
- player.requestBuffered(completionHandler: { bufferedTimeRanges, error in
152
+ if let wplayer = player,
153
+ let forwardedProgressEvent = self?.onNativeProgress {
154
+ wplayer.requestSeekable(completionHandler: { seekableTimeRanges, error in
155
+ wplayer.requestBuffered(completionHandler: { bufferedTimeRanges, error in
154
156
  var seekable: [[String:Double]] = []
155
157
  seekableTimeRanges?.forEach({ timeRange in
156
158
  seekable.append(
@@ -263,10 +265,11 @@ class THEOplayerRCTMainEventHandler {
263
265
  if DEBUG_EVENTHANDLER { print("[NATIVE] LoadedData listener attached to THEOplayer") }
264
266
 
265
267
  // LOADED_META_DATA
266
- self.loadedMetadataListener = player.addEventListener(type: PlayerEventTypes.LOADED_META_DATA) { [weak self] event in
268
+ self.loadedMetadataListener = player.addEventListener(type: PlayerEventTypes.LOADED_META_DATA) { [weak self, weak player] event in
267
269
  if DEBUG_THEOPLAYER_EVENTS { print("[NATIVE] Received LOADED_META_DATA event from THEOplayer") }
268
- if let forwardedLoadedMetadataEvent = self?.onNativeLoadedMetadata {
269
- let metadata = THEOplayerRCTTrackMetadataAggregator.aggregateTrackMetadata(player: player)
270
+ if let wplayer = player,
271
+ let forwardedLoadedMetadataEvent = self?.onNativeLoadedMetadata {
272
+ let metadata = THEOplayerRCTTrackMetadataAggregator.aggregateTrackMetadata(player: wplayer)
270
273
  print(metadata)
271
274
  forwardedLoadedMetadataEvent(metadata)
272
275
  }
@@ -121,6 +121,21 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
121
121
  return
122
122
  }
123
123
 
124
+ @objc(setAspectRatio:ratio:)
125
+ func setAspectRatio(_ node: NSNumber, ratio: String) -> Void {
126
+ DispatchQueue.main.async {
127
+ let newAspectRatio: AspectRatio = THEOplayerRCTTypeUtils.aspectRatioFromString(ratio)
128
+ if let theView = self.bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView,
129
+ let player = theView.player {
130
+ if player.fullscreen.aspectRatio != newAspectRatio {
131
+ if DEBUG_PLAYER_API { print("[NATIVE] Changing TheoPlayer's aspectRatio to \(ratio)") }
132
+ player.fullscreen.setAspectRatio(aspectRatio: newAspectRatio)
133
+ }
134
+ }
135
+ }
136
+ return
137
+ }
138
+
124
139
  @objc(setPipConfig:pipConfig:)
125
140
  func setPipConfig(_ node: NSNumber, pipConfig: NSDictionary) -> Void {
126
141
  DispatchQueue.main.async {
@@ -95,8 +95,8 @@ class THEOplayerRCTTrackMetadataAggregator {
95
95
  var entry: [String:Any] = [:]
96
96
  entry[PROP_ID] = textTrackCue.id
97
97
  entry[PROP_UID] = textTrackCue.uid
98
- entry[PROP_STARTTIME] = (textTrackCue.startTime ?? 0) * 1000
99
- entry[PROP_ENDTIME] = (textTrackCue.endTime ?? 0) * 1000
98
+ entry[PROP_STARTTIME] = THEOplayerRCTTypeUtils.encodeInfNan((textTrackCue.startTime ?? 0) * 1000)
99
+ entry[PROP_ENDTIME] = THEOplayerRCTTypeUtils.encodeInfNan((textTrackCue.endTime ?? 0) * 1000)
100
100
  if let content = textTrackCue.content {
101
101
  entry[PROP_CUE_CONTENT] = content
102
102
  } else if let contentString = textTrackCue.contentString {
@@ -57,4 +57,30 @@ class THEOplayerRCTTypeUtils {
57
57
  return "inline"
58
58
  }
59
59
  }
60
+
61
+ class func aspectRatioFromString(_ ratio: String) -> AspectRatio {
62
+ switch ratio {
63
+ case "fit":
64
+ return AspectRatio.fit
65
+ case "fill":
66
+ return AspectRatio.fill
67
+ case "aspectFill":
68
+ return AspectRatio.aspectFill
69
+ default:
70
+ return AspectRatio.fit
71
+ }
72
+ }
73
+
74
+ class func aspectRatioToString(_ ratio: AspectRatio) -> String {
75
+ switch ratio {
76
+ case AspectRatio.fit:
77
+ return "fit"
78
+ case AspectRatio.fill:
79
+ return "fill"
80
+ case AspectRatio.aspectFill:
81
+ return "aspectFill"
82
+ default:
83
+ return "fit"
84
+ }
85
+ }
60
86
  }
@@ -7,7 +7,7 @@ import THEOplayerSDK
7
7
  public class THEOplayerRCTView: UIView {
8
8
  // MARK: Members
9
9
  public private(set) var player: THEOplayer?
10
- var mainEventHandler: THEOplayerRCTMainEventHandler
10
+ public private(set) var mainEventHandler: THEOplayerRCTMainEventHandler
11
11
  var textTrackEventHandler: THEOplayerRCTTextTrackEventHandler
12
12
  var mediaTrackEventHandler: THEOplayerRCTMediaTrackEventHandler
13
13
  var adEventHandler: THEOplayerRCTAdsEventHandler
@@ -136,6 +136,8 @@ public class THEOplayerRCTView: UIView {
136
136
  self.remoteCommandsManager.destroy()
137
137
  self.pipControlsManager.destroy()
138
138
 
139
+ self.destroyBackgroundAudio()
140
+ self.player?.removeAllIntegrations()
139
141
  self.player?.destroy()
140
142
  self.player = nil
141
143
  if DEBUG_THEOPLAYER_INTERACTION { print("[NATIVE] THEOplayer instance destroyed.") }
@@ -155,9 +155,10 @@ class THEOplayerRCTNowPlayingManager {
155
155
  }
156
156
 
157
157
  // DURATION_CHANGE
158
- self.durationChangeListener = player.addEventListener(type: PlayerEventTypes.DURATION_CHANGE) { [weak self] event in
158
+ self.durationChangeListener = player.addEventListener(type: PlayerEventTypes.DURATION_CHANGE) { [weak self, weak player] event in
159
159
  if let welf = self,
160
- let duration = player.duration {
160
+ let wplayer = player,
161
+ let duration = wplayer.duration {
161
162
  welf.nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = duration.isInfinite
162
163
  if (!duration.isInfinite) {
163
164
  welf.nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = duration
@@ -191,9 +192,10 @@ class THEOplayerRCTNowPlayingManager {
191
192
 
192
193
 
193
194
  // RATE_CHANGE
194
- self.rateChangeListener = player.addEventListener(type: PlayerEventTypes.RATE_CHANGE) { [weak self] event in
195
- if let welf = self {
196
- welf.nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = NSNumber(value: player.playbackRate)
195
+ self.rateChangeListener = player.addEventListener(type: PlayerEventTypes.RATE_CHANGE) { [weak self, weak player] event in
196
+ if let welf = self,
197
+ let wplayer = player {
198
+ welf.nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = NSNumber(value: wplayer.playbackRate)
197
199
  MPNowPlayingInfoCenter.default().nowPlayingInfo = welf.nowPlayingInfo
198
200
  if DEBUG_NOWINFO { print("[NATIVE] RATE_CHANGE: PlaybackRate updated on NowPlayingInfoCenter.") }
199
201
  }
@@ -11,6 +11,7 @@ struct BackgroundAudioConfig {
11
11
 
12
12
  extension THEOplayerRCTView {
13
13
  func initBackgroundAudio() {}
14
+ func destroyBackgroundAudio() {}
14
15
  public func shouldContinueAudioPlaybackInBackground() -> Bool { return false }
15
16
  }
16
17
 
@@ -22,6 +23,13 @@ extension THEOplayerRCTView: BackgroundPlaybackDelegate {
22
23
  self.player?.backgroundPlaybackDelegate = self
23
24
  }
24
25
 
26
+ func destroyBackgroundAudio() {
27
+ guard let player = self.player else {
28
+ return
29
+ }
30
+ player.backgroundPlaybackDelegate = DefaultBackgroundPlaybackDelegate()
31
+ }
32
+
25
33
  public func shouldContinueAudioPlaybackInBackground() -> Bool {
26
34
  // Make sure to go to the background with updated NowPlayingInfo
27
35
  self.nowPlayingManager.updateNowPlaying()
@@ -30,4 +38,8 @@ extension THEOplayerRCTView: BackgroundPlaybackDelegate {
30
38
  }
31
39
  }
32
40
 
41
+ struct DefaultBackgroundPlaybackDelegate: BackgroundPlaybackDelegate {
42
+ func shouldContinueAudioPlaybackInBackground() -> Bool { false }
43
+ }
44
+
33
45
  #endif
@@ -3,4 +3,22 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.AspectRatio = void 0;
7
+ /**
8
+ * Specifies an aspect ratio for the player.
9
+ *
10
+ * <br/> - `FIT` (default): Scales the player so that all content fits inside its bounding box, keeping the original aspect ratio of the content..
11
+ * <br/> - `FILL`: Scales the player so that all content fits inside the bounding box, which will be stretched to fill it entirely.
12
+ * <br/> - `ASPECT_FILL`: Scales the player so that the content fills up the entire bounding box, keeping the original aspect ratio of the content.
13
+ *
14
+ * @public
15
+ * @defaultValue `'FIT'`
16
+ */
17
+ let AspectRatio;
18
+ exports.AspectRatio = AspectRatio;
19
+ (function (AspectRatio) {
20
+ AspectRatio["FIT"] = "fit";
21
+ AspectRatio["FILL"] = "fill";
22
+ AspectRatio["ASPECT_FILL"] = "aspectFill";
23
+ })(AspectRatio || (exports.AspectRatio = AspectRatio = {}));
6
24
  //# sourceMappingURL=THEOplayer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["THEOplayer.ts"],"sourcesContent":["import type { EventDispatcher } from '../event/EventDispatcher';\nimport type { PlayerEventMap } from './PlayerEventMap';\nimport type { ABRConfiguration } from '../abr/ABRConfiguration';\nimport type { SourceDescription } from '../source/SourceDescription';\nimport type { AdsAPI } from '../ads/AdsAPI';\nimport type { CastAPI } from '../cast/CastAPI';\nimport type { MediaTrack } from '../track/MediaTrack';\nimport type { TextTrack } from '../track/TextTrack';\nimport type { TimeRange } from '../timeranges/TimeRange';\nimport type { TextTrackStyle } from '../track/TextTrackStyle';\nimport type { PresentationMode } from '../presentation/PresentationMode';\nimport type { PiPConfiguration } from '../pip/PiPConfiguration';\nimport type { BackgroundAudioConfiguration } from '../backgroundAudio/BackgroundAudioConfiguration';\n\nexport type PreloadType = 'none' | 'metadata' | 'auto' | '';\n\nexport type NativeHandleType = unknown;\n\n/**\n * The THEOplayer API.\n */\nexport interface THEOplayer extends EventDispatcher<PlayerEventMap> {\n /**\n * The player's adaptive bitrate (ABR) configuration.\n *\n * @remarks\n * <br/> - This property is supported on Android & Web platforms only.\n */\n readonly abr: ABRConfiguration | undefined;\n\n /**\n * A source description that determines the current media resource.\n */\n source: SourceDescription | undefined;\n\n /**\n * Start or resume playback.\n */\n play(): void;\n\n /**\n * Pause playback.\n */\n pause(): void;\n\n /**\n * Whether the player is paused.\n */\n readonly paused: boolean;\n\n /**\n * Whether the player should immediately start playback after source change.\n */\n autoplay: boolean;\n\n /**\n * The preload setting of the player.\n */\n preload: PreloadType;\n\n /**\n * Returns a list of TimeRanges that represents the ranges of the media resource that are seekable by the player.\n */\n seekable: TimeRange[];\n\n /**\n * Returns a list of TimeRanges that represents the ranges of the media resource that are buffered by the player.\n */\n buffered: TimeRange[];\n\n /**\n * Used to set the playback rate of the media.\n *\n * @example\n * <br/> - `playbackRate = 0.70` will slow down the playback rate of the media by 30%.\n * <br/> - `playbackRate = 1.25` will speed up the playback rate of the media by 25%.\n *\n * @remarks\n * <br/> - Playback rate is represented by a number where `1` is default playback speed.\n * <br/> - Playback rate must be a positive number.\n * <br/> - It is recommended that you limit the range to between 0.5 and 4.\n */\n playbackRate: number;\n\n /**\n * Used to set the volume of the audio.\n *\n * @remarks\n * <br/> - Volume is represented by a floating point number between `0.0` and `1.0`.\n */\n volume: number;\n\n /**\n * Determines whether audio is muted.\n */\n muted: boolean;\n\n /**\n * Whether the player is seeking.\n */\n readonly seeking: boolean;\n\n /**\n * The PresentationMode of the player. Can be switched to: `picture-in-picture`, `fullscreen` or `inline`\n */\n presentationMode: PresentationMode;\n\n /**\n * List of audio tracks of the current source.\n */\n audioTracks: MediaTrack[];\n\n /**\n * List of video tracks of the current source.\n */\n videoTracks: MediaTrack[];\n\n /**\n * List of text tracks of the current source.\n */\n textTracks: TextTrack[];\n\n /**\n * Used to set the current selected text track by passing its `uid`, or `undefined` to select none.\n */\n selectedTextTrack: number | undefined;\n\n /**\n * The text track style API.\n *\n * @remarks\n * Only available for Web.\n */\n readonly textTrackStyle: TextTrackStyle;\n\n /**\n * Used to set the current selected video track by passing its `uid`, or `undefined` to select none.\n */\n selectedVideoTrack: number | undefined;\n\n /**\n * Used to set the current selected video quality by passing its `uid`, or `undefined` to select none.\n */\n targetVideoQuality: number | number[] | undefined;\n\n /**\n * Used to set the current selected audio track by passing its `uid`, or `undefined` to select none.\n */\n selectedAudioTrack: number | undefined;\n\n /**\n * The current playback position of the media, in milliseconds.\n */\n currentTime: number;\n\n /**\n * The active configuration for PiP.\n */\n pipConfiguration: PiPConfiguration;\n\n /**\n * The active configuration for PiP.\n */\n backgroundAudioConfiguration: BackgroundAudioConfiguration;\n\n /**\n * The duration of the media, in milliseconds.\n */\n readonly duration: number;\n\n /**\n * The API for advertisements.\n */\n readonly ads: AdsAPI;\n\n /**\n * The API for casting devices.\n */\n readonly cast: CastAPI;\n\n /**\n * Native player handle.\n */\n readonly nativeHandle: NativeHandleType;\n}\n"],"mappings":""}
1
+ {"version":3,"names":["AspectRatio","exports"],"sources":["THEOplayer.ts"],"sourcesContent":["import type { EventDispatcher } from '../event/EventDispatcher';\nimport type { PlayerEventMap } from './PlayerEventMap';\nimport type { ABRConfiguration } from '../abr/ABRConfiguration';\nimport type { SourceDescription } from '../source/SourceDescription';\nimport type { AdsAPI } from '../ads/AdsAPI';\nimport type { CastAPI } from '../cast/CastAPI';\nimport type { MediaTrack } from '../track/MediaTrack';\nimport type { TextTrack } from '../track/TextTrack';\nimport type { TimeRange } from '../timeranges/TimeRange';\nimport type { TextTrackStyle } from '../track/TextTrackStyle';\nimport type { PresentationMode } from '../presentation/PresentationMode';\nimport type { PiPConfiguration } from '../pip/PiPConfiguration';\nimport type { BackgroundAudioConfiguration } from '../backgroundAudio/BackgroundAudioConfiguration';\n\nexport type PreloadType = 'none' | 'metadata' | 'auto' | '';\n\n/**\n * Specifies an aspect ratio for the player.\n *\n * <br/> - `FIT` (default): Scales the player so that all content fits inside its bounding box, keeping the original aspect ratio of the content..\n * <br/> - `FILL`: Scales the player so that all content fits inside the bounding box, which will be stretched to fill it entirely.\n * <br/> - `ASPECT_FILL`: Scales the player so that the content fills up the entire bounding box, keeping the original aspect ratio of the content.\n *\n * @public\n * @defaultValue `'FIT'`\n */\nexport enum AspectRatio {\n FIT = 'fit',\n FILL = 'fill',\n ASPECT_FILL = 'aspectFill',\n}\n\nexport type NativeHandleType = unknown;\n\n/**\n * The THEOplayer API.\n */\nexport interface THEOplayer extends EventDispatcher<PlayerEventMap> {\n /**\n * The player's adaptive bitrate (ABR) configuration.\n *\n * @remarks\n * <br/> - This property is supported on Android & Web platforms only.\n */\n readonly abr: ABRConfiguration | undefined;\n\n /**\n * A source description that determines the current media resource.\n */\n source: SourceDescription | undefined;\n\n /**\n * Start or resume playback.\n */\n play(): void;\n\n /**\n * Pause playback.\n */\n pause(): void;\n\n /**\n * Whether the player is paused.\n */\n readonly paused: boolean;\n\n /**\n * Whether the player should immediately start playback after source change.\n */\n autoplay: boolean;\n\n /**\n * The preload setting of the player.\n */\n preload: PreloadType;\n\n /**\n * Returns a list of TimeRanges that represents the ranges of the media resource that are seekable by the player.\n */\n seekable: TimeRange[];\n\n /**\n * Returns a list of TimeRanges that represents the ranges of the media resource that are buffered by the player.\n */\n buffered: TimeRange[];\n\n /**\n * Used to set the playback rate of the media.\n *\n * @example\n * <br/> - `playbackRate = 0.70` will slow down the playback rate of the media by 30%.\n * <br/> - `playbackRate = 1.25` will speed up the playback rate of the media by 25%.\n *\n * @remarks\n * <br/> - Playback rate is represented by a number where `1` is default playback speed.\n * <br/> - Playback rate must be a positive number.\n * <br/> - It is recommended that you limit the range to between 0.5 and 4.\n */\n playbackRate: number;\n\n /**\n * Used to set the volume of the audio.\n *\n * @remarks\n * <br/> - Volume is represented by a floating point number between `0.0` and `1.0`.\n */\n volume: number;\n\n /**\n * Determines whether audio is muted.\n */\n muted: boolean;\n\n /**\n * Whether the player is seeking.\n */\n readonly seeking: boolean;\n\n /**\n * The PresentationMode of the player. Can be switched to: `picture-in-picture`, `fullscreen` or `inline`\n */\n presentationMode: PresentationMode;\n\n /**\n * List of audio tracks of the current source.\n */\n audioTracks: MediaTrack[];\n\n /**\n * List of video tracks of the current source.\n */\n videoTracks: MediaTrack[];\n\n /**\n * List of text tracks of the current source.\n */\n textTracks: TextTrack[];\n\n /**\n * Used to set the current selected text track by passing its `uid`, or `undefined` to select none.\n */\n selectedTextTrack: number | undefined;\n\n /**\n * The text track style API.\n *\n * @remarks\n * Only available for Web.\n */\n readonly textTrackStyle: TextTrackStyle;\n\n /**\n * Used to set the current selected video track by passing its `uid`, or `undefined` to select none.\n */\n selectedVideoTrack: number | undefined;\n\n /**\n * Used to set the current selected video quality by passing its `uid`, or `undefined` to select none.\n */\n targetVideoQuality: number | number[] | undefined;\n\n /**\n * Used to set the current selected audio track by passing its `uid`, or `undefined` to select none.\n */\n selectedAudioTrack: number | undefined;\n\n /**\n * The current playback position of the media, in milliseconds.\n */\n currentTime: number;\n\n /**\n * Used to set the aspect ratio of the player.\n *\n * @remarks\n * Only available for iOS and Android.\n */\n aspectRatio: AspectRatio;\n\n /**\n * The active configuration for PiP.\n */\n pipConfiguration: PiPConfiguration;\n\n /**\n * The active configuration for PiP.\n */\n backgroundAudioConfiguration: BackgroundAudioConfiguration;\n\n /**\n * The duration of the media, in milliseconds.\n */\n readonly duration: number;\n\n /**\n * The API for advertisements.\n */\n readonly ads: AdsAPI;\n\n /**\n * The API for casting devices.\n */\n readonly cast: CastAPI;\n\n /**\n * Native player handle.\n */\n readonly nativeHandle: NativeHandleType;\n}\n"],"mappings":";;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA,IAUYA,WAAW;AAAAC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAAA,WAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;AAAA,GAAXA,WAAW,KAAAC,OAAA,CAAAD,WAAA,GAAXA,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["SourceDescription.ts"],"sourcesContent":["/**\n * Represents a media resource.\n *\n * @remarks\n * <br/> - Can be a string value representing the URL of a media resource, a {@link TypedSource}.\n *\n * @public\n */\nimport type { DashPlaybackConfiguration } from './dash/DashPlaybackConfiguration';\nimport type { DRMConfiguration } from './drm/DRMConfiguration';\nimport type { HlsPlaybackConfiguration } from './hls/HlsPlaybackConfiguration';\nimport type { AdDescription } from './ads/Ads';\nimport type { MetadataDescription } from './metadata/MetadataDescription';\nimport type { ServerSideAdInsertionConfiguration } from \"./ads/ssai/ServerSideAdInsertionConfiguration\";\n\nexport type Source = TypedSource;\n\n/**\n * A media resource or list of media resources.\n *\n * @remarks\n * <br/> - The order of sources when using a list determines their priority when attempting playback.\n *\n * @public\n */\nexport type Sources = Source | Source[];\n\n/**\n * The cross-origin setting of a source, represented by a value from the following list:\n * <br/> - `'anonymous'`: CORS requests will have the credentials flag set to 'same-origin'.\n * <br/> - `'use-credentials'`: CORS requests will have the credentials flag set to 'include'.\n * <br/> - `''`: Setting the empty string is the same as `'anonymous'`\n *\n * @remarks\n * <br/> - See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes | The crossorigin attribute: Requesting CORS access to content}\n *\n * @public\n */\nexport type CrossOriginSetting = '' | 'anonymous' | 'use-credentials';\n\n/**\n * Describes the configuration of a player's source.\n *\n * @public\n */\nexport interface SourceConfiguration {\n /**\n * List of {@link AdDescription}s to be queued for playback.\n */\n ads?: AdDescription[];\n\n /**\n * Content protection configuration.\n */\n contentProtection?: DRMConfiguration;\n\n /**\n * The poster of the media source.\n *\n * @remarks\n * <br/> - An empty string (`''`) clears the current poster.\n * <br/> - This poster has priority over {@link ChromelessPlayer.poster}.\n */\n poster?: string;\n\n /**\n * List of text tracks to be side-loaded with the media source.\n *\n * @remarks\n * <br/> - A source change will reset side-loaded text tracks.\n */\n textTracks?: TextTrackDescription[];\n\n /**\n * The URL of a time server used by the player to synchronise the time in DASH sources.\n *\n * @remarks\n * <br/> - The time server should return time in ISO-8601 format.\n * <br/> - Overrides the time server provided the DASH manifest's `<UTCTiming>`.\n * <br/> - All sources will use the time server. Alternatively, for one source use {@link BaseSource.timeServer}.\n */\n timeServer?: string;\n\n /**\n * Describes the metadata of a source.\n *\n * @public\n */\n metadata?: MetadataDescription;\n}\n\n/**\n * Describes the configuration of a player's source.\n *\n * @public\n */\nexport interface SourceDescription extends SourceConfiguration {\n /**\n * One or more media resources for playback.\n *\n * @remarks\n * <br/> - Multiple media sources should be used to increase platform compatibility. See examples below for important use cases.\n * <br/> - The player will try each source in the provided order.\n *\n * @example\n * In this example, the player will first try to play the DASH source.\n * This might fail if the browser does not support the {@link https://www.widevine.com/ | Widevine} or {@link https://www.microsoft.com/playready/ | PlayReady} CDM, for example on Safari.\n * In that case, the player will try to play the HLS source instead.\n *\n * ```\n * [{\n * src: 'dash-source-with-drm.mpd'\n * contentProtection: {\n * widevine: {\n * licenseAcquisitionURL: 'https://license.company.com/wv'\n * },\n * playready: {\n * licenseAcquisitionURL: 'https://license.company.com/pr'\n * }\n * }\n * },{\n * src: 'hls-source-with-drm.m3u8',\n * contentProtection: {\n * fairplay: {\n * certificateURL: 'https://license.company.com/fp'\n * }\n * }\n * }]\n * ```\n *\n * @example\n * In this example, the player will first try to play the DASH source.\n * This might fail if the browser does not support the {@link https://developer.mozilla.org/en-US/docs/Web/API/Media_Source_Extensions_API | Media Source Extensions API}.\n * In that case, the player will try to play the MP4 source instead, though without features such as adaptive bitrate switching.\n *\n * ```\n * [{\n * src: 'source.mpd'\n * },{\n * src: 'source.mp4'\n * }]\n * ```\n */\n sources?: Sources;\n}\n\n/**\n * Describes the configuration of a side-loaded text track.\n *\n * @public\n */\nexport interface TextTrackDescription {\n /**\n * Whether the text track should be enabled by default.\n *\n * @remarks\n * <br/> - Only one text track per {@link TextTrack.kind} may be marked as default.\n *\n * @defaultValue `false`\n */\n default?: boolean;\n\n /**\n * The kind of the text track, represented by a value from the following list:\n * <br/> - `'subtitles'`: The track provides subtitles, used to display subtitles in a video.\n * <br/> - `'captions'`: The track provides a translation of dialogue and sound effects (suitable for users with a hearing impairment).\n * <br/> - `'descriptions'`: The track provides a textual description of the video (suitable for users with a vision impairment).\n * <br/> - `'chapters'`: The track provides chapter titles (suitable for navigating the media resource).\n * <br/> - `'metadata'`: The track provides content used by scripts and is not visible for users.\n *\n * @remarks\n * <br/> - If an unrecognized value is provided, the player will interpret it as `'metadata'`.\n *\n * @defaultValue `'subtitles'`\n */\n kind?: string;\n\n /**\n * The format of the track, represented by a value from the following list:\n * <br/> - `'srt'`\n * <br/> - `'ttml'`\n * <br/> - `'webvtt'`\n * <br/> - `'emsg'`\n * <br/> - `'eventstream'`\n * <br/> - `'id3'`\n * <br/> - `'cea608'`\n * <br/> - `'daterange'`\n *\n * @defaultValue `''`\n */\n format?: string;\n\n /**\n * The source URL of the text track.\n */\n src: string;\n\n /**\n * The language of the text track.\n */\n srclang?: string;\n\n /**\n * A label for the text track.\n *\n * @remarks\n * <br/> - This will be used as an identifier on the player API and in the UI.\n */\n label?: string;\n\n /**\n * The identifier of this text track.\n *\n * @internal\n */\n // Note: This works for HLS, but not for DASH.\n id?: string;\n}\n\n/**\n * Represents the common properties of a media resource.\n *\n * @public\n */\nexport interface BaseSource {\n /**\n * The URL of a time server used by the player to synchronise the time in DASH sources.\n *\n * @remarks\n * <br/> - Available since v2.47.0.\n * <br/> - The time server should return time in ISO-8601 format.\n * <br/> - Overrides the time server provided the DASH manifest's `<UTCTiming>`.\n * <br/> - Only this source will use the time server. Alternatively, for all source use {@link SourceConfiguration.timeServer}.\n */\n timeServer?: string;\n\n /**\n * Whether the source should be played in the low-latency-mode of the player.\n *\n * @defaultValue `false`\n *\n * @remarks\n * <br/> - This setting must be `true` when using Low-Latency CMAF with ABR.\n * <br/> - Available since v2.62.0.\n */\n lowLatency?: boolean;\n\n /**\n * The configuration for controlling playback of an MPEG-DASH stream.\n *\n * @remarks\n * <br/> - Available since v2.79.0.\n * <br/> - Ignored for non-DASH streams.\n */\n dash?: DashPlaybackConfiguration;\n\n /**\n * The configuration for controlling playback of an HLS stream.\n *\n * @remarks\n * <br/> - Available since v2.82.0.\n * <br/> - Ignored for non-HLS streams.\n */\n hls?: HlsPlaybackConfiguration;\n}\n\n/**\n * Represents a media resource characterized by a URL to the resource and optionally information about the resource.\n *\n * @public\n */\nexport interface TypedSource extends BaseSource {\n /**\n * The source URL of the media resource.\n *\n * @remarks\n * <br/> - Required if the `ssai` property is absent.\n * <br/> - Available since v2.4.0.\n */\n src?: string;\n\n /**\n * The content type (MIME type) of the media resource, represented by a value from the following list:\n * <br/> - `'application/dash+xml'`: The media resource is an MPEG-DASH stream.\n * <br/> - `'application/x-mpegURL'` or `'application/vnd.apple.mpegurl'`: The media resource is an HLS stream.\n * <br/> - `'video/mp4'`, `'video/webm'` and other formats: The media resource should use native HTML5 playback if supported by the browser.\n * <br/> - `'application/vnd.theo.hesp+json'`: The media resource is an HESP stream.\n *\n * @remarks\n * <br/> - Available since v2.4.0.\n */\n type?: string;\n\n /**\n * The content protection parameters for the media resource.\n *\n * @remarks\n * <br/> - Available since v2.15.0.\n */\n contentProtection?: DRMConfiguration;\n\n /**\n * The Server-side Ad Insertion parameters for the media resource.\n *\n * @remarks\n * <br/> - Available since v2.12.0.\n */\n ssai?: ServerSideAdInsertionConfiguration;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["SourceDescription.ts"],"sourcesContent":["/**\n * Represents a media resource.\n *\n * @remarks\n * <br/> - Can be a string value representing the URL of a media resource, a {@link TypedSource}.\n *\n * @public\n */\nimport type { DashPlaybackConfiguration } from './dash/DashPlaybackConfiguration';\nimport type { DRMConfiguration } from './drm/DRMConfiguration';\nimport type { HlsPlaybackConfiguration } from './hls/HlsPlaybackConfiguration';\nimport type { AdDescription } from './ads/Ads';\nimport type { MetadataDescription } from './metadata/MetadataDescription';\nimport type { ServerSideAdInsertionConfiguration } from \"./ads/ssai/ServerSideAdInsertionConfiguration\";\n\nexport type Source = TypedSource;\n\n/**\n * A media resource or list of media resources.\n *\n * @remarks\n * <br/> - The order of sources when using a list determines their priority when attempting playback.\n *\n * @public\n */\nexport type Sources = Source | Source[];\n\n/**\n * The cross-origin setting of a source, represented by a value from the following list:\n * <br/> - `'anonymous'`: CORS requests will have the credentials flag set to 'same-origin'.\n * <br/> - `'use-credentials'`: CORS requests will have the credentials flag set to 'include'.\n * <br/> - `''`: Setting the empty string is the same as `'anonymous'`\n *\n * @remarks\n * <br/> - See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes | The crossorigin attribute: Requesting CORS access to content}\n *\n * @public\n */\nexport type CrossOriginSetting = '' | 'anonymous' | 'use-credentials';\n\n/**\n * Describes the configuration of a player's source.\n *\n * @public\n */\nexport interface SourceConfiguration {\n /**\n * List of {@link AdDescription}s to be queued for playback.\n */\n ads?: AdDescription[];\n\n /**\n * Content protection configuration.\n */\n contentProtection?: DRMConfiguration;\n\n /**\n * The poster of the media source.\n *\n * @remarks\n * <br/> - An empty string (`''`) clears the current poster.\n * <br/> - This poster has priority over {@link ChromelessPlayer.poster}.\n */\n poster?: string;\n\n /**\n * List of text tracks to be side-loaded with the media source.\n *\n * @remarks\n * <br/> - A source change will reset side-loaded text tracks.\n */\n textTracks?: TextTrackDescription[];\n\n /**\n * The URL of a time server used by the player to synchronise the time in DASH sources.\n *\n * @remarks\n * <br/> - The time server should return time in ISO-8601 format.\n * <br/> - Overrides the time server provided the DASH manifest's `<UTCTiming>`.\n * <br/> - All sources will use the time server. Alternatively, for one source use {@link BaseSource.timeServer}.\n */\n timeServer?: string;\n\n /**\n * Describes the metadata of a source.\n *\n * @public\n */\n metadata?: MetadataDescription;\n}\n\n/**\n * Describes the configuration of a player's source.\n *\n * @public\n */\nexport interface SourceDescription extends SourceConfiguration {\n /**\n * One or more media resources for playback.\n *\n * @remarks\n * <br/> - Multiple media sources should be used to increase platform compatibility. See examples below for important use cases.\n * <br/> - The player will try each source in the provided order.\n *\n * @example\n * In this example, the player will first try to play the DASH source.\n * This might fail if the browser does not support the {@link https://www.widevine.com/ | Widevine} or {@link https://www.microsoft.com/playready/ | PlayReady} CDM, for example on Safari.\n * In that case, the player will try to play the HLS source instead.\n *\n * ```\n * [{\n * src: 'dash-source-with-drm.mpd'\n * contentProtection: {\n * widevine: {\n * licenseAcquisitionURL: 'https://license.company.com/wv'\n * },\n * playready: {\n * licenseAcquisitionURL: 'https://license.company.com/pr'\n * }\n * }\n * },{\n * src: 'hls-source-with-drm.m3u8',\n * contentProtection: {\n * fairplay: {\n * certificateURL: 'https://license.company.com/fp'\n * }\n * }\n * }]\n * ```\n *\n * @example\n * In this example, the player will first try to play the DASH source.\n * This might fail if the browser does not support the {@link https://developer.mozilla.org/en-US/docs/Web/API/Media_Source_Extensions_API | Media Source Extensions API}.\n * In that case, the player will try to play the MP4 source instead, though without features such as adaptive bitrate switching.\n *\n * ```\n * [{\n * src: 'source.mpd'\n * },{\n * src: 'source.mp4'\n * }]\n * ```\n */\n sources?: Sources;\n}\n\n/**\n * Describes the configuration of a side-loaded text track.\n *\n * @public\n */\nexport interface TextTrackDescription {\n /**\n * Whether the text track should be enabled by default.\n *\n * @remarks\n * <br/> - Only one text track per {@link TextTrack.kind} may be marked as default.\n *\n * @defaultValue `false`\n */\n default?: boolean;\n\n /**\n * The kind of the text track, represented by a value from the following list:\n * <br/> - `'subtitles'`: The track provides subtitles, used to display subtitles in a video.\n * <br/> - `'captions'`: The track provides a translation of dialogue and sound effects (suitable for users with a hearing impairment).\n * <br/> - `'descriptions'`: The track provides a textual description of the video (suitable for users with a vision impairment).\n * <br/> - `'chapters'`: The track provides chapter titles (suitable for navigating the media resource).\n * <br/> - `'metadata'`: The track provides content used by scripts and is not visible for users.\n *\n * @remarks\n * <br/> - If an unrecognized value is provided, the player will interpret it as `'metadata'`.\n *\n * @defaultValue `'subtitles'`\n */\n kind?: string;\n\n /**\n * The format of the track, represented by a value from the following list:\n * <br/> - `'srt'`\n * <br/> - `'ttml'`\n * <br/> - `'webvtt'`\n * <br/> - `'emsg'`\n * <br/> - `'eventstream'`\n * <br/> - `'id3'`\n * <br/> - `'cea608'`\n * <br/> - `'daterange'`\n *\n * @defaultValue `''`\n */\n format?: string;\n\n /**\n * The source URL of the text track.\n */\n src: string;\n\n /**\n * The language of the text track.\n */\n srclang?: string;\n\n /**\n * A label for the text track.\n *\n * @remarks\n * <br/> - This will be used as an identifier on the player API and in the UI.\n */\n label?: string;\n\n /**\n * The identifier of this text track.\n *\n * @internal\n */\n // Note: This works for HLS, but not for DASH.\n id?: string;\n}\n\n/**\n * Represents the common properties of a media resource.\n *\n * @public\n */\nexport interface BaseSource {\n\n /**\n * The cross-origin setting of the source.\n *\n * @defaultValue `''`\n */\n crossOrigin?: CrossOriginSetting;\n\n /**\n * The URL of a time server used by the player to synchronise the time in DASH sources.\n *\n * @remarks\n * <br/> - Available since v2.47.0.\n * <br/> - The time server should return time in ISO-8601 format.\n * <br/> - Overrides the time server provided the DASH manifest's `<UTCTiming>`.\n * <br/> - Only this source will use the time server. Alternatively, for all source use {@link SourceConfiguration.timeServer}.\n */\n timeServer?: string;\n\n /**\n * Whether the source should be played in the low-latency-mode of the player.\n *\n * @defaultValue `false`\n *\n * @remarks\n * <br/> - This setting must be `true` when using Low-Latency CMAF with ABR.\n * <br/> - Available since v2.62.0.\n */\n lowLatency?: boolean;\n\n /**\n * The configuration for controlling playback of an MPEG-DASH stream.\n *\n * @remarks\n * <br/> - Available since v2.79.0.\n * <br/> - Ignored for non-DASH streams.\n */\n dash?: DashPlaybackConfiguration;\n\n /**\n * The configuration for controlling playback of an HLS stream.\n *\n * @remarks\n * <br/> - Available since v2.82.0.\n * <br/> - Ignored for non-HLS streams.\n */\n hls?: HlsPlaybackConfiguration;\n}\n\n/**\n * Represents a media resource characterized by a URL to the resource and optionally information about the resource.\n *\n * @public\n */\nexport interface TypedSource extends BaseSource {\n /**\n * The source URL of the media resource.\n *\n * @remarks\n * <br/> - Required if the `ssai` property is absent.\n * <br/> - Available since v2.4.0.\n */\n src?: string;\n\n /**\n * The content type (MIME type) of the media resource, represented by a value from the following list:\n * <br/> - `'application/dash+xml'`: The media resource is an MPEG-DASH stream.\n * <br/> - `'application/x-mpegURL'` or `'application/vnd.apple.mpegurl'`: The media resource is an HLS stream.\n * <br/> - `'video/mp4'`, `'video/webm'` and other formats: The media resource should use native HTML5 playback if supported by the browser.\n * <br/> - `'application/vnd.theo.hesp+json'`: The media resource is an HESP stream.\n *\n * @remarks\n * <br/> - Available since v2.4.0.\n */\n type?: string;\n\n /**\n * The content protection parameters for the media resource.\n *\n * @remarks\n * <br/> - Available since v2.15.0.\n */\n contentProtection?: DRMConfiguration;\n\n /**\n * The Server-side Ad Insertion parameters for the media resource.\n *\n * @remarks\n * <br/> - Available since v2.12.0.\n */\n ssai?: ServerSideAdInsertionConfiguration;\n}\n"],"mappings":""}
@@ -111,7 +111,12 @@ class THEOplayerView extends _react.PureComponent {
111
111
  });
112
112
  _defineProperty(this, "_onTextTrackEvent", event => {
113
113
  const nativeEvent = event.nativeEvent;
114
- this._facade.dispatchEvent(new _PlayerEvents.DefaultTextTrackEvent((0, _NativeTrackEvent.toTextTrackEventType)(nativeEvent.type), nativeEvent.trackUid, nativeEvent.cue));
114
+ const cue = nativeEvent.cue;
115
+ if (cue) {
116
+ cue.startTime = (0, _TypeUtils.decodeNanInf)(cue.startTime);
117
+ cue.endTime = (0, _TypeUtils.decodeNanInf)(cue.endTime);
118
+ }
119
+ this._facade.dispatchEvent(new _PlayerEvents.DefaultTextTrackEvent((0, _NativeTrackEvent.toTextTrackEventType)(nativeEvent.type), nativeEvent.trackUid, cue));
115
120
  });
116
121
  _defineProperty(this, "_onMediaTrackListEvent", event => {
117
122
  const nativeEvent = event.nativeEvent;