react-native-theoplayer 2.4.0 → 2.6.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 (50) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +9 -15
  3. package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +12 -0
  4. package/android/src/main/java/com/theoplayer/util/PayloadBuilder.kt +2 -1
  5. package/ios/THEOplayerRCTBridge.m +3 -0
  6. package/ios/THEOplayerRCTMainEventHandler.swift +1 -1
  7. package/ios/THEOplayerRCTPlayerAPI.swift +15 -0
  8. package/ios/THEOplayerRCTTypeUtils.swift +26 -0
  9. package/ios/backgroundAudio/THEOplayerRCTNowPlayingManager.swift +49 -24
  10. package/lib/commonjs/api/abr/ABRConfiguration.js +25 -0
  11. package/lib/commonjs/api/abr/ABRConfiguration.js.map +1 -1
  12. package/lib/commonjs/api/player/THEOplayer.js +18 -0
  13. package/lib/commonjs/api/player/THEOplayer.js.map +1 -1
  14. package/lib/commonjs/api/track/Track.js +5 -1
  15. package/lib/commonjs/api/track/Track.js.map +1 -1
  16. package/lib/commonjs/internal/THEOplayerView.web.js +2 -6
  17. package/lib/commonjs/internal/THEOplayerView.web.js.map +1 -1
  18. package/lib/commonjs/internal/adapter/NativePlayerState.js.map +1 -1
  19. package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +8 -0
  20. package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
  21. package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js +112 -53
  22. package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
  23. package/lib/module/api/abr/ABRConfiguration.js +19 -0
  24. package/lib/module/api/abr/ABRConfiguration.js.map +1 -1
  25. package/lib/module/api/player/THEOplayer.js +16 -1
  26. package/lib/module/api/player/THEOplayer.js.map +1 -1
  27. package/lib/module/api/track/Track.js +4 -1
  28. package/lib/module/api/track/Track.js.map +1 -1
  29. package/lib/module/internal/THEOplayerView.web.js +2 -6
  30. package/lib/module/internal/THEOplayerView.web.js.map +1 -1
  31. package/lib/module/internal/adapter/NativePlayerState.js.map +1 -1
  32. package/lib/module/internal/adapter/THEOplayerAdapter.js +9 -1
  33. package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
  34. package/lib/module/internal/adapter/THEOplayerWebAdapter.js +112 -53
  35. package/lib/module/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
  36. package/lib/typescript/api/abr/ABRConfiguration.d.ts +5 -1
  37. package/lib/typescript/api/player/THEOplayer.d.ts +22 -0
  38. package/lib/typescript/api/track/Track.d.ts +1 -0
  39. package/lib/typescript/internal/adapter/NativePlayerState.d.ts +2 -0
  40. package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts +3 -1
  41. package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts +7 -5
  42. package/package.json +9 -4
  43. package/react-native-theoplayer.podspec +1 -1
  44. package/src/api/abr/ABRConfiguration.ts +5 -1
  45. package/src/api/player/THEOplayer.ts +24 -0
  46. package/src/api/track/Track.ts +5 -1
  47. package/src/internal/THEOplayerView.web.tsx +2 -6
  48. package/src/internal/adapter/NativePlayerState.ts +2 -0
  49. package/src/internal/adapter/THEOplayerAdapter.ts +11 -0
  50. package/src/internal/adapter/THEOplayerWebAdapter.ts +106 -51
package/CHANGELOG.md CHANGED
@@ -5,7 +5,31 @@ 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
- ## [unreleased]
8
+ ## [2.6.0] - 23-05-05
9
+
10
+ ### Fixed
11
+
12
+ - Fixed an issue on Android where the `currentProgramDateTime` property of `TimeUpdateEvent` would not be formatted in milliseconds.
13
+ - Fixed an issue on Android where the order of text and media tracks would change when adding tracks.
14
+ - Fixed an issue on Web where an exception would be thrown when accessing the player API after the player had been destroyed.
15
+ - Fixed an issue with Google IMA where the main content wasn't resumed after a pre-roll ended.
16
+
17
+ ### Changed
18
+
19
+ - Use `enum` instead of a string union for `ABRStrategyType`.
20
+ - Changed the way artwork is fetched for NowPlayingInfo on the iOS Lockscreen, to prevent a crash caused by threading issues.
21
+
22
+ ## [2.5.0] - 23-04-26
23
+
24
+ ### Added
25
+
26
+ - Added an `aspectRatio` property on the `THEOplayer` instance that can be either `FIT` (default), `FILL` or `ASPECT_FILL`.
27
+
28
+ ### Changed
29
+
30
+ - Set `theoplayer` Web SDK as optional peer dependency.
31
+
32
+ ## [2.4.0] - 23-04-21
9
33
 
10
34
  ### Fixed
11
35
 
@@ -338,7 +338,7 @@ class PlayerEventEmitter internal constructor(
338
338
 
339
339
  // Limit update rate.
340
340
  val dt = now - lastTimeUpdate
341
- return timeUpdateRate == TimeUpdateRate.LIMITED_ONE_HZ && dt < 1e03 ||
341
+ return timeUpdateRate == TimeUpdateRate.LIMITED_ONE_HZ && dt < 1e3 ||
342
342
  timeUpdateRate == TimeUpdateRate.LIMITED_TWO_HZ && dt < 500 ||
343
343
  timeUpdateRate == TimeUpdateRate.LIMITED_THREE_HZ && dt < 333
344
344
  }
@@ -481,24 +481,17 @@ class PlayerEventEmitter internal constructor(
481
481
  }
482
482
 
483
483
  private fun activeAudioTrack(): MediaTrack<AudioQuality>? {
484
- return if (playerView.player != null) activeTrack(
485
- playerView.player!!.audioTracks
486
- ) else null
484
+ return activeTrack(playerView.player?.audioTracks)
487
485
  }
488
486
 
489
487
  private fun activeVideoTrack(): MediaTrack<VideoQuality>? {
490
- return if (playerView.player != null) activeTrack(
491
- playerView.player!!.videoTracks
492
- ) else null
488
+ return activeTrack(playerView.player?.videoTracks)
493
489
  }
494
490
 
495
491
  private fun <T : Quality?> activeTrack(tracks: MediaTrackList<T>?): MediaTrack<T>? {
496
- tracks?.forEach { track ->
497
- if (track.isEnabled) {
498
- return track
499
- }
492
+ return tracks?.first { track ->
493
+ track.isEnabled
500
494
  }
501
- return null
502
495
  }
503
496
 
504
497
  private val onActiveQualityChanged = EventListener<QualityChangedEvent<*, *>> { event ->
@@ -642,13 +635,14 @@ class PlayerEventEmitter internal constructor(
642
635
  }
643
636
  })
644
637
  }
645
- if (BuildConfig.EXTENSION_CAST && playerView.castApi != null) {
646
- castEventAdapter = CastEventAdapter(playerView.castApi!!,
647
- object : CastEventAdapter.Emitter {
638
+ if (BuildConfig.EXTENSION_CAST) {
639
+ castEventAdapter = playerView.castApi?.let {
640
+ CastEventAdapter(it, object : CastEventAdapter.Emitter {
648
641
  override fun emit(payload: WritableMap?) {
649
642
  receiveEvent(EVENT_CAST_EVENT, payload)
650
643
  }
651
644
  })
645
+ }
652
646
  }
653
647
  }
654
648
 
@@ -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
  }
@@ -74,7 +74,8 @@ class PayloadBuilder {
74
74
  currentProgramDateTime?.let {
75
75
  payload.putDouble(
76
76
  EVENT_PROP_CURRENT_PROGRAM_DATE_TIME,
77
- (1e03 * currentProgramDateTime.time).toLong().toDouble()
77
+ // Date.time is already formatted in msecs.
78
+ currentProgramDateTime.time.toDouble()
78
79
  )
79
80
  }
80
81
  }
@@ -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
 
@@ -113,7 +113,7 @@ public 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") }
@@ -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 {
@@ -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
  }
@@ -1,4 +1,4 @@
1
- // THEOplayerRCTView+BackgroundAudioConfig.swift
1
+ // THEOplayerRCTNowPlayingManager.swift
2
2
 
3
3
  import Foundation
4
4
  import THEOplayerSDK
@@ -41,32 +41,47 @@ class THEOplayerRCTNowPlayingManager {
41
41
  let sourceDescription = player.source,
42
42
  let metadata = sourceDescription.metadata {
43
43
  let artWorkUrlString = self.getArtWorkUrlStringFromSourceDescription(sourceDescription)
44
- DispatchQueue.global().async {
45
- self.nowPlayingInfo = [String : Any]()
46
- self.updatePlaybackState()
47
- self.updateTitle(metadata.title)
48
- self.updateSubtitle(metadata.metadataKeys?["subtitle"] as? String)
49
- self.updateDuration(player.duration)
50
- self.updateMediaType() // video
51
- self.updateArtWork(artWorkUrlString)
52
- self.updatePlaybackRate(player.playbackRate)
53
- self.updateServiceIdentifier(metadata.metadataKeys?["nowPlayingServiceIdentifier"] as? String)
54
- self.updateContentIdentifier(metadata.metadataKeys?["nowPlayingContentIdentifier"] as? String)
55
- self.updateCurrentTime { [weak self] in
56
- if let welf = self {
57
- MPNowPlayingInfoCenter.default().nowPlayingInfo = welf.nowPlayingInfo
58
- if DEBUG_NOWINFO { print("[NATIVE] NowPlayingInfoCenter Updated.") }
59
- }
44
+ self.updatePlaybackState()
45
+ self.nowPlayingInfo = [String : Any]()
46
+ self.updateTitle(metadata.title)
47
+ self.updateSubtitle(metadata.metadataKeys?["subtitle"] as? String)
48
+ self.updateDuration(player.duration)
49
+ self.updateMediaType() // video
50
+ self.updatePlaybackRate(player.playbackRate)
51
+ self.updateServiceIdentifier(metadata.metadataKeys?["nowPlayingServiceIdentifier"] as? String)
52
+ self.updateContentIdentifier(metadata.metadataKeys?["nowPlayingContentIdentifier"] as? String)
53
+ self.updateArtWork(artWorkUrlString) { [weak self] in
54
+ self?.updateCurrentTime { [weak self] in
55
+ self?.processNowPlayingToInfoCenter()
60
56
  }
61
57
  }
62
58
  }
63
59
  }
64
60
 
61
+ private func processNowPlayingToInfoCenter() {
62
+ DispatchQueue.main.async {
63
+ MPNowPlayingInfoCenter.default().nowPlayingInfo = self.nowPlayingInfo
64
+ }
65
+ }
66
+
67
+ private func clearNowPlayingOnInfoCenter() {
68
+ DispatchQueue.main.async {
69
+ MPNowPlayingInfoCenter.default().nowPlayingInfo = nil
70
+ }
71
+ }
72
+
73
+ private func processPlaybackStateToInfoCenter(paused: Bool) {
74
+ if #available(iOS 13.0, tvOS 13.0, *) {
75
+ DispatchQueue.main.async {
76
+ MPNowPlayingInfoCenter.default().playbackState = paused ? MPNowPlayingPlaybackState.paused : MPNowPlayingPlaybackState.playing
77
+ }
78
+ }
79
+ }
80
+
65
81
  private func getArtWorkUrlStringFromSourceDescription(_ sourceDescription: SourceDescription) -> String? {
66
82
  if let posterUrlString = sourceDescription.poster?.absoluteString {
67
83
  return posterUrlString
68
84
  }
69
-
70
85
  if let metadata = sourceDescription.metadata,
71
86
  let displayIconUrlString = metadata.metadataKeys?["displayIconUri"] as? String {
72
87
  return displayIconUrlString
@@ -120,14 +135,24 @@ class THEOplayerRCTNowPlayingManager {
120
135
  }
121
136
  }
122
137
 
123
- private func updateArtWork(_ urlString: String?) {
138
+ private func updateArtWork(_ urlString: String?, completion: (() -> Void)?) {
124
139
  if let artUrlString = urlString,
125
- let artUrl = URL(string: artUrlString),
126
- let displayIconData = try? Data(contentsOf: artUrl),
127
- let displayIcon = UIImage(data: displayIconData) {
128
- self.nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: displayIcon.size) { size in
129
- return displayIcon
140
+ let artUrl = URL(string: artUrlString) {
141
+ let dataTask = URLSession.shared.dataTask(with: artUrl) { [weak self] (data, _, _) in
142
+ if let displayIconData = data,
143
+ let displayIcon = UIImage(data: displayIconData) {
144
+ self?.nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: displayIcon.size) { size in
145
+ return displayIcon
146
+ }
147
+ if DEBUG_NOWINFO { print("[NATIVE] Artwork updated in nowPlayingInfo.") }
148
+ } else {
149
+ if DEBUG_NOWINFO { print("[NATIVE] Failed to update artwork in nowPlayingInfo.") }
150
+ }
151
+ completion?()
130
152
  }
153
+ dataTask.resume()
154
+ } else {
155
+ completion?()
131
156
  }
132
157
  }
133
158
 
@@ -1,2 +1,27 @@
1
1
  "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ABRStrategyType = void 0;
7
+ /**
8
+ * The adaptive bitrate strategy of the first segment, represented by a value from the following list:
9
+ * <br/> - `'performance'`: The player will optimize ABR behavior to focus on the performance of the player. This strategy initiates playback with the lowest quality suitable for the device which means faster start-up time.
10
+ * <br/> - `'quality'`: The player will optimize ABR behavior to focus displaying the best visual quality to the end-user. This strategy initiates playback with the highest bit rate suitable for the device.
11
+ * <br/> - `'bandwidth'`: The player will optimize the ABR behavior to focus on displaying the most optimal quality based on historic data of available bandwidth and knowledge of the network conditions.
12
+ *
13
+ * @public
14
+ */
15
+ let ABRStrategyType;
16
+ /**
17
+ * Describes the metadata of the adaptive bitrate strategy.
18
+ *
19
+ * @public
20
+ */
21
+ exports.ABRStrategyType = ABRStrategyType;
22
+ (function (ABRStrategyType) {
23
+ ABRStrategyType["performance"] = "performance";
24
+ ABRStrategyType["quality"] = "quality";
25
+ ABRStrategyType["bandwidth"] = "bandwidth";
26
+ })(ABRStrategyType || (exports.ABRStrategyType = ABRStrategyType = {}));
2
27
  //# sourceMappingURL=ABRConfiguration.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["ABRConfiguration.ts"],"sourcesContent":["/**\n * The adaptive bitrate strategy of the first segment, represented by a value from the following list:\n * <br/> - `'performance'`: The player will optimize ABR behavior to focus on the performance of the player. This strategy initiates playback with the lowest quality suitable for the device which means faster start-up time.\n * <br/> - `'quality'`: The player will optimize ABR behavior to focus displaying the best visual quality to the end-user. This strategy initiates playback with the highest bit rate suitable for the device.\n * <br/> - `'bandwidth'`: The player will optimize the ABR behavior to focus on displaying the most optimal quality based on historic data of available bandwidth and knowledge of the network conditions.\n *\n * @public\n */\nexport type ABRStrategyType = 'performance' | 'quality' | 'bandwidth';\n\n/**\n * Describes the metadata of the adaptive bitrate strategy.\n *\n * @public\n */\nexport interface ABRMetadata {\n /**\n * The initial bitrate, in bits per second.\n *\n * @defaultValue Bitrate available to the browser.\n */\n bitrate?: number;\n}\n\n/**\n * Describes the configuration of the adaptive bitrate strategy.\n *\n * @public\n */\nexport interface ABRStrategyConfiguration {\n /**\n * The strategy for initial playback.\n */\n type: ABRStrategyType;\n\n /**\n * The metadata for the initial playback strategy.\n *\n * @defaultValue A {@link ABRMetadata} object with default values.\n */\n metadata?: ABRMetadata;\n}\n\n/**\n * The adaptive bitrate stratey.\n *\n * @public\n */\nexport type ABRStrategy = ABRStrategyConfiguration | ABRStrategyType;\n\n/**\n * Describes the adaptive bitrate configuration.\n *\n * @public\n */\nexport interface ABRConfiguration {\n /**\n * The adaptive bitrate strategy.\n *\n * @defaultValue `'bandwidth'`\n */\n strategy?: ABRStrategy;\n\n /**\n * The amount which the player should buffer ahead of the current playback position, in seconds.\n *\n * @remarks\n * <br/> - Before v4.3.0: This duration has a maximum of 60 seconds.\n * <br/> - After v4.3.0: This duration has no maximum.\n * <br/> - The player might reduce or ignore the configured amount because of device or performance constraints.\n *\n * @defaultValue `20`\n */\n targetBuffer?: number;\n\n /**\n * The amount of data which the player should keep in its buffer before the current playback position, in seconds.\n * This configuration option can be used to reduce the memory footprint on memory restricted devices or on devices\n * which don't automatically prune decoder buffers.\n *\n * Note that the player can decide to keep less data in the decoder buffer in case memory is running low.\n * A value of 0 or lower is not accepted and will be treated as default.\n *\n * @defaultValue `30`\n *\n * @remarks\n * <br/> - This property is currently supported on Web platforms only.\n */\n bufferLookbackWindow?: number;\n\n /**\n * The maximum length of the player's buffer, in seconds.\n *\n * The player will initially buffer up to {@link ABRConfiguration.targetBuffer} seconds of media data.\n * If the player detects that the decoder is unable to hold so much data,\n * it will reduce `maxBufferLength` and restrict `targetBuffer` to be less than\n * this maximum.\n *\n * @remarks\n * <br/> - This property is currently supported on Web platforms only.\n */\n readonly maxBufferLength?: number;\n}\n"],"mappings":""}
1
+ {"version":3,"names":["ABRStrategyType","exports"],"sources":["ABRConfiguration.ts"],"sourcesContent":["/**\n * The adaptive bitrate strategy of the first segment, represented by a value from the following list:\n * <br/> - `'performance'`: The player will optimize ABR behavior to focus on the performance of the player. This strategy initiates playback with the lowest quality suitable for the device which means faster start-up time.\n * <br/> - `'quality'`: The player will optimize ABR behavior to focus displaying the best visual quality to the end-user. This strategy initiates playback with the highest bit rate suitable for the device.\n * <br/> - `'bandwidth'`: The player will optimize the ABR behavior to focus on displaying the most optimal quality based on historic data of available bandwidth and knowledge of the network conditions.\n *\n * @public\n */\nexport enum ABRStrategyType {\n performance = 'performance',\n quality = 'quality',\n bandwidth = 'bandwidth',\n}\n\n/**\n * Describes the metadata of the adaptive bitrate strategy.\n *\n * @public\n */\nexport interface ABRMetadata {\n /**\n * The initial bitrate, in bits per second.\n *\n * @defaultValue Bitrate available to the browser.\n */\n bitrate?: number;\n}\n\n/**\n * Describes the configuration of the adaptive bitrate strategy.\n *\n * @public\n */\nexport interface ABRStrategyConfiguration {\n /**\n * The strategy for initial playback.\n */\n type: ABRStrategyType;\n\n /**\n * The metadata for the initial playback strategy.\n *\n * @defaultValue A {@link ABRMetadata} object with default values.\n */\n metadata?: ABRMetadata;\n}\n\n/**\n * The adaptive bitrate stratey.\n *\n * @public\n */\nexport type ABRStrategy = ABRStrategyConfiguration | ABRStrategyType;\n\n/**\n * Describes the adaptive bitrate configuration.\n *\n * @public\n */\nexport interface ABRConfiguration {\n /**\n * The adaptive bitrate strategy.\n *\n * @defaultValue `'bandwidth'`\n */\n strategy?: ABRStrategy;\n\n /**\n * The amount which the player should buffer ahead of the current playback position, in seconds.\n *\n * @remarks\n * <br/> - Before v4.3.0: This duration has a maximum of 60 seconds.\n * <br/> - After v4.3.0: This duration has no maximum.\n * <br/> - The player might reduce or ignore the configured amount because of device or performance constraints.\n *\n * @defaultValue `20`\n */\n targetBuffer?: number;\n\n /**\n * The amount of data which the player should keep in its buffer before the current playback position, in seconds.\n * This configuration option can be used to reduce the memory footprint on memory restricted devices or on devices\n * which don't automatically prune decoder buffers.\n *\n * Note that the player can decide to keep less data in the decoder buffer in case memory is running low.\n * A value of 0 or lower is not accepted and will be treated as default.\n *\n * @defaultValue `30`\n *\n * @remarks\n * <br/> - This property is currently supported on Web platforms only.\n */\n bufferLookbackWindow?: number;\n\n /**\n * The maximum length of the player's buffer, in seconds.\n *\n * The player will initially buffer up to {@link ABRConfiguration.targetBuffer} seconds of media data.\n * If the player detects that the decoder is unable to hold so much data,\n * it will reduce `maxBufferLength` and restrict `targetBuffer` to be less than\n * this maximum.\n *\n * @remarks\n * <br/> - This property is currently supported on Web platforms only.\n */\n readonly maxBufferLength?: number;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAQYA,eAAe;AAM3B;AACA;AACA;AACA;AACA;AAJAC,OAAA,CAAAD,eAAA,GAAAA,eAAA;AAAA,WANYA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,KAAAC,OAAA,CAAAD,eAAA,GAAfA,eAAe"}
@@ -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"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.addTrack = addTrack;
7
7
  exports.hasTrack = hasTrack;
8
8
  exports.removeTrack = removeTrack;
9
+ exports.sortTracks = sortTracks;
9
10
  /**
10
11
  * Represents a track of a media resource.
11
12
  *
@@ -22,6 +23,9 @@ function removeTrack(trackList, track) {
22
23
  return trackList && track ? trackList.filter(t => t.uid !== track.uid) : trackList;
23
24
  }
24
25
  function addTrack(trackList, track) {
25
- return trackList && track && !hasTrack(trackList, track) ? [...trackList, track] : trackList;
26
+ return trackList && track && !hasTrack(trackList, track) ? sortTracks([...trackList, track]) : trackList;
27
+ }
28
+ function sortTracks(trackList) {
29
+ return (trackList === null || trackList === void 0 ? void 0 : trackList.sort((t1, t2) => t1.uid - t2.uid)) || [];
26
30
  }
27
31
  //# sourceMappingURL=Track.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["hasTrack","trackList","track","find","t","uid","removeTrack","filter","addTrack"],"sources":["Track.ts"],"sourcesContent":["/**\n * Represents a track of a media resource.\n *\n * @remarks\n * <br/> - A specific track type (e.g. {@link TextTrack}) will always be used.\n *\n * @public\n */\nexport interface Track {\n /**\n * The kind of the track.\n *\n * @remarks\n * <br/> - The values for this property depend on the specific type of the track.\n */\n readonly kind: string;\n\n /**\n * The label of the track.\n */\n label: string;\n\n /**\n * The identifier of the track.\n *\n * @remarks\n * <br/> - This identifier can be used to distinguish between related tracks, e.g. tracks in the same list.\n *\n * @privateRemarks\n * <br/> - This identifier is a randomly generated string.\n */\n readonly id: string;\n\n /**\n * A unique identifier of the track.\n *\n * @remarks\n * <br/> - This identifier is unique across tracks of a THEOplayer instance and can be used to distinguish between tracks.\n * <br/> - This identifier is a randomly generated number.\n */\n readonly uid: number;\n\n /**\n * The language of the track.\n */\n readonly language: string;\n}\n\nexport function hasTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): boolean {\n return !!(trackList && track && trackList.find((t) => t.uid === track.uid));\n}\n\nexport function removeTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): TTrack[] {\n return trackList && track ? trackList.filter((t) => t.uid !== track.uid) : trackList;\n}\n\nexport function addTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): TTrack[] {\n return trackList && track && !hasTrack(trackList, track) ? [...trackList, track] : trackList;\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyCO,SAASA,QAAQA,CAAuBC,SAAmB,EAAEC,KAAa,EAAW;EAC1F,OAAO,CAAC,EAAED,SAAS,IAAIC,KAAK,IAAID,SAAS,CAACE,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,GAAG,KAAKH,KAAK,CAACG,GAAG,CAAC,CAAC;AAC7E;AAEO,SAASC,WAAWA,CAAuBL,SAAmB,EAAEC,KAAa,EAAY;EAC9F,OAAOD,SAAS,IAAIC,KAAK,GAAGD,SAAS,CAACM,MAAM,CAAEH,CAAC,IAAKA,CAAC,CAACC,GAAG,KAAKH,KAAK,CAACG,GAAG,CAAC,GAAGJ,SAAS;AACtF;AAEO,SAASO,QAAQA,CAAuBP,SAAmB,EAAEC,KAAa,EAAY;EAC3F,OAAOD,SAAS,IAAIC,KAAK,IAAI,CAACF,QAAQ,CAACC,SAAS,EAAEC,KAAK,CAAC,GAAG,CAAC,GAAGD,SAAS,EAAEC,KAAK,CAAC,GAAGD,SAAS;AAC9F"}
1
+ {"version":3,"names":["hasTrack","trackList","track","find","t","uid","removeTrack","filter","addTrack","sortTracks","sort","t1","t2"],"sources":["Track.ts"],"sourcesContent":["/**\n * Represents a track of a media resource.\n *\n * @remarks\n * <br/> - A specific track type (e.g. {@link TextTrack}) will always be used.\n *\n * @public\n */\nexport interface Track {\n /**\n * The kind of the track.\n *\n * @remarks\n * <br/> - The values for this property depend on the specific type of the track.\n */\n readonly kind: string;\n\n /**\n * The label of the track.\n */\n label: string;\n\n /**\n * The identifier of the track.\n *\n * @remarks\n * <br/> - This identifier can be used to distinguish between related tracks, e.g. tracks in the same list.\n *\n * @privateRemarks\n * <br/> - This identifier is a randomly generated string.\n */\n readonly id: string;\n\n /**\n * A unique identifier of the track.\n *\n * @remarks\n * <br/> - This identifier is unique across tracks of a THEOplayer instance and can be used to distinguish between tracks.\n * <br/> - This identifier is a randomly generated number.\n */\n readonly uid: number;\n\n /**\n * The language of the track.\n */\n readonly language: string;\n}\n\nexport function hasTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): boolean {\n return !!(trackList && track && trackList.find((t) => t.uid === track.uid));\n}\n\nexport function removeTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): TTrack[] {\n return trackList && track ? trackList.filter((t) => t.uid !== track.uid) : trackList;\n}\n\nexport function addTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): TTrack[] {\n return trackList && track && !hasTrack(trackList, track) ? sortTracks([...trackList, track]) : trackList;\n}\n\nexport function sortTracks<TTrack extends Track>(trackList?: TTrack[]): TTrack[] {\n return trackList?.sort((t1: TTrack, t2: TTrack) => t1.uid - t2.uid) || [];\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyCO,SAASA,QAAQA,CAAuBC,SAAmB,EAAEC,KAAa,EAAW;EAC1F,OAAO,CAAC,EAAED,SAAS,IAAIC,KAAK,IAAID,SAAS,CAACE,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,GAAG,KAAKH,KAAK,CAACG,GAAG,CAAC,CAAC;AAC7E;AAEO,SAASC,WAAWA,CAAuBL,SAAmB,EAAEC,KAAa,EAAY;EAC9F,OAAOD,SAAS,IAAIC,KAAK,GAAGD,SAAS,CAACM,MAAM,CAAEH,CAAC,IAAKA,CAAC,CAACC,GAAG,KAAKH,KAAK,CAACG,GAAG,CAAC,GAAGJ,SAAS;AACtF;AAEO,SAASO,QAAQA,CAAuBP,SAAmB,EAAEC,KAAa,EAAY;EAC3F,OAAOD,SAAS,IAAIC,KAAK,IAAI,CAACF,QAAQ,CAACC,SAAS,EAAEC,KAAK,CAAC,GAAGO,UAAU,CAAC,CAAC,GAAGR,SAAS,EAAEC,KAAK,CAAC,CAAC,GAAGD,SAAS;AAC1G;AAEO,SAASQ,UAAUA,CAAuBR,SAAoB,EAAY;EAC/E,OAAO,CAAAA,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAES,IAAI,CAAC,CAACC,EAAU,EAAEC,EAAU,KAAKD,EAAE,CAACN,GAAG,GAAGO,EAAE,CAACP,GAAG,CAAC,KAAI,EAAE;AAC3E"}
@@ -7,8 +7,6 @@ exports.THEOplayerView = THEOplayerView;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var THEOplayer = _interopRequireWildcard(require("theoplayer"));
9
9
  var _THEOplayerWebAdapter = require("./adapter/THEOplayerWebAdapter");
10
- var _BaseEvent = require("./adapter/event/BaseEvent");
11
- var _reactNativeTheoplayer = require("react-native-theoplayer");
12
10
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
11
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
12
  function THEOplayerView(props) {
@@ -55,7 +53,7 @@ function THEOplayerView(props) {
55
53
 
56
54
  // Clean-up
57
55
  return () => {
58
- var _adapter$current, _adapter$current2, _player$current;
56
+ var _adapter$current;
59
57
  // Notify the player will be destroyed.
60
58
  const {
61
59
  onPlayerDestroy
@@ -63,9 +61,7 @@ function THEOplayerView(props) {
63
61
  if (adapter !== null && adapter !== void 0 && adapter.current && onPlayerDestroy) {
64
62
  onPlayerDestroy(adapter === null || adapter === void 0 ? void 0 : adapter.current);
65
63
  }
66
- adapter === null || adapter === void 0 ? void 0 : (_adapter$current = adapter.current) === null || _adapter$current === void 0 ? void 0 : _adapter$current.dispatchEvent(new _BaseEvent.BaseEvent(_reactNativeTheoplayer.PlayerEventType.DESTROY));
67
- adapter === null || adapter === void 0 ? void 0 : (_adapter$current2 = adapter.current) === null || _adapter$current2 === void 0 ? void 0 : _adapter$current2.destroy();
68
- player === null || player === void 0 ? void 0 : (_player$current = player.current) === null || _player$current === void 0 ? void 0 : _player$current.destroy();
64
+ adapter === null || adapter === void 0 ? void 0 : (_adapter$current = adapter.current) === null || _adapter$current === void 0 ? void 0 : _adapter$current.destroy();
69
65
  };
70
66
  }, [container]);
71
67
  const chromeless = (config === null || config === void 0 ? void 0 : config.chromeless) === undefined || (config === null || config === void 0 ? void 0 : config.chromeless) === true;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","THEOplayer","_THEOplayerWebAdapter","_BaseEvent","_reactNativeTheoplayer","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","THEOplayerView","props","config","children","player","useRef","adapter","container","useEffect","current","_props$onPlayerReady","chromeless","undefined","updatedConfig","allowNativeFullscreen","ChromelessPlayer","Player","ui","fluid","THEOplayerWebAdapter","window","nativePlayer","onPlayerReady","_adapter$current","_adapter$current2","_player$current","onPlayerDestroy","dispatchEvent","BaseEvent","PlayerEventType","DESTROY","destroy","createElement","Fragment","ref","style","styles","className","display","position","width","height","maxHeight","maxWidth","aspectRatio"],"sources":["THEOplayerView.web.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport type { THEOplayerViewProps } from 'react-native-theoplayer';\nimport * as THEOplayer from 'theoplayer';\nimport { THEOplayerWebAdapter } from './adapter/THEOplayerWebAdapter';\nimport { BaseEvent } from './adapter/event/BaseEvent';\nimport { PlayerEventType } from 'react-native-theoplayer';\n\nexport function THEOplayerView(props: React.PropsWithChildren<THEOplayerViewProps>) {\n const { config, children } = props;\n const player = useRef<THEOplayer.ChromelessPlayer | null>(null);\n const adapter = useRef<THEOplayerWebAdapter | null>(null);\n const container = useRef<null | HTMLDivElement>(null);\n\n useEffect(() => {\n // Create player inside container.\n if (container.current) {\n const chromeless = config?.chromeless === true || config?.chromeless === undefined;\n const updatedConfig = {...config, allowNativeFullscreen: true};\n if (chromeless) {\n player.current = new THEOplayer.ChromelessPlayer(container.current, updatedConfig);\n } else {\n player.current = new THEOplayer.Player(container.current, {\n ...updatedConfig,\n ui: {\n fluid: true,\n }\n } as THEOplayer.PlayerConfiguration);\n }\n\n // Adapt native player to react-native player.\n adapter.current = new THEOplayerWebAdapter(player.current, config);\n\n // Expose players for easy access\n // @ts-ignore\n window.player = adapter.current;\n\n // @ts-ignore\n window.nativePlayer = player;\n\n // Notify the player is ready\n props.onPlayerReady?.(adapter.current);\n }\n\n // Clean-up\n return () => {\n // Notify the player will be destroyed.\n const { onPlayerDestroy } = props;\n if (adapter?.current && onPlayerDestroy) {\n onPlayerDestroy(adapter?.current);\n }\n adapter?.current?.dispatchEvent(new BaseEvent(PlayerEventType.DESTROY));\n adapter?.current?.destroy();\n player?.current?.destroy();\n };\n }, [container]);\n\n const chromeless = config?.chromeless === undefined || config?.chromeless === true;\n return (\n <>\n <div\n ref={container}\n style={styles.container}\n className={chromeless ? 'theoplayer-container' : 'theoplayer-container video-js theoplayer-skin'}\n />\n {children}\n </>\n );\n}\n\nconst styles = {\n // by default stretch the video to cover the container.\n // Override using the 'theoplayer-container' class.\n container: {\n display: 'flex',\n position: 'relative',\n width: '100%',\n height: '100%',\n maxHeight: '100vh',\n maxWidth: '100vw',\n aspectRatio: '16 / 9',\n } as React.CSSProperties,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AAA0D,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAP,wBAAAW,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,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xB,SAAS,CAAC,CAAC;EAEf,MAAMI,UAAU,GAAG,CAAAT,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAES,UAAU,MAAKC,SAAS,IAAI,CAAAV,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAES,UAAU,MAAK,IAAI;EAClF,oBACExC,MAAA,CAAAc,OAAA,CAAA+C,aAAA,CAAA7D,MAAA,CAAAc,OAAA,CAAAgD,QAAA,qBACE9D,MAAA,CAAAc,OAAA,CAAA+C,aAAA;IACEE,GAAG,EAAE3B,SAAU;IACf4B,KAAK,EAAEC,MAAM,CAAC7B,SAAU;IACxB8B,SAAS,EAAE1B,UAAU,GAAG,sBAAsB,GAAG;EAAgD,EACjG,EACDR,QAAQ,CACR;AAEP;AAEA,MAAMiC,MAAM,GAAG;EACb;EACA;EACA7B,SAAS,EAAE;IACT+B,OAAO,EAAE,MAAM;IACfC,QAAQ,EAAE,UAAU;IACpBC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,SAAS,EAAE,OAAO;IAClBC,QAAQ,EAAE,OAAO;IACjBC,WAAW,EAAE;EACf;AACF,CAAC"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","THEOplayer","_THEOplayerWebAdapter","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","THEOplayerView","props","config","children","player","useRef","adapter","container","useEffect","current","_props$onPlayerReady","chromeless","undefined","updatedConfig","allowNativeFullscreen","ChromelessPlayer","Player","ui","fluid","THEOplayerWebAdapter","window","nativePlayer","onPlayerReady","_adapter$current","onPlayerDestroy","destroy","createElement","Fragment","ref","style","styles","className","display","position","width","height","maxHeight","maxWidth","aspectRatio"],"sources":["THEOplayerView.web.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport type { THEOplayerViewProps } from 'react-native-theoplayer';\nimport * as THEOplayer from 'theoplayer';\nimport { THEOplayerWebAdapter } from './adapter/THEOplayerWebAdapter';\n\nexport function THEOplayerView(props: React.PropsWithChildren<THEOplayerViewProps>) {\n const { config, children } = props;\n const player = useRef<THEOplayer.ChromelessPlayer | null>(null);\n const adapter = useRef<THEOplayerWebAdapter | null>(null);\n const container = useRef<null | HTMLDivElement>(null);\n\n useEffect(() => {\n // Create player inside container.\n if (container.current) {\n const chromeless = config?.chromeless === true || config?.chromeless === undefined;\n const updatedConfig = { ...config, allowNativeFullscreen: true };\n if (chromeless) {\n player.current = new THEOplayer.ChromelessPlayer(container.current, updatedConfig);\n } else {\n player.current = new THEOplayer.Player(container.current, {\n ...updatedConfig,\n ui: {\n fluid: true,\n },\n } as THEOplayer.PlayerConfiguration);\n }\n\n // Adapt native player to react-native player.\n adapter.current = new THEOplayerWebAdapter(player.current, config);\n\n // Expose players for easy access\n // @ts-ignore\n window.player = adapter.current;\n\n // @ts-ignore\n window.nativePlayer = player;\n\n // Notify the player is ready\n props.onPlayerReady?.(adapter.current);\n }\n\n // Clean-up\n return () => {\n // Notify the player will be destroyed.\n const { onPlayerDestroy } = props;\n if (adapter?.current && onPlayerDestroy) {\n onPlayerDestroy(adapter?.current);\n }\n adapter?.current?.destroy();\n };\n }, [container]);\n\n const chromeless = config?.chromeless === undefined || config?.chromeless === true;\n return (\n <>\n <div\n ref={container}\n style={styles.container}\n className={chromeless ? 'theoplayer-container' : 'theoplayer-container video-js theoplayer-skin'}\n />\n {children}\n </>\n );\n}\n\nconst styles = {\n // by default stretch the video to cover the container.\n // Override using the 'theoplayer-container' class.\n container: {\n display: 'flex',\n position: 'relative',\n width: '100%',\n height: '100%',\n maxHeight: '100vh',\n maxWidth: '100vw',\n aspectRatio: '16 / 9',\n } as React.CSSProperties,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAF,uBAAA,CAAAC,OAAA;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QAAEC;MAAgB,CAAC,GAAGvB,KAAK;MACjC,IAAIK,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEG,OAAO,IAAIe,eAAe,EAAE;QACvCA,eAAe,CAAClB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEG,OAAO,CAAC;MACnC;MACAH,OAAO,aAAPA,OAAO,wBAAAiB,gBAAA,GAAPjB,OAAO,CAAEG,OAAO,cAAAc,gBAAA,uBAAhBA,gBAAA,CAAkBE,OAAO,EAAE;IAC7B,CAAC;EACH,CAAC,EAAE,CAAClB,SAAS,CAAC,CAAC;EAEf,MAAMI,UAAU,GAAG,CAAAT,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAES,UAAU,MAAKC,SAAS,IAAI,CAAAV,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAES,UAAU,MAAK,IAAI;EAClF,oBACEtC,MAAA,CAAAY,OAAA,CAAAyC,aAAA,CAAArD,MAAA,CAAAY,OAAA,CAAA0C,QAAA,qBACEtD,MAAA,CAAAY,OAAA,CAAAyC,aAAA;IACEE,GAAG,EAAErB,SAAU;IACfsB,KAAK,EAAEC,MAAM,CAACvB,SAAU;IACxBwB,SAAS,EAAEpB,UAAU,GAAG,sBAAsB,GAAG;EAAgD,EACjG,EACDR,QAAQ,CACR;AAEP;AAEA,MAAM2B,MAAM,GAAG;EACb;EACA;EACAvB,SAAS,EAAE;IACTyB,OAAO,EAAE,MAAM;IACfC,QAAQ,EAAE,UAAU;IACpBC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,SAAS,EAAE,OAAO;IAClBC,QAAQ,EAAE,OAAO;IACjBC,WAAW,EAAE;EACf;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["NativePlayerState.ts"],"sourcesContent":["import type { MediaTrack, PreloadType, PresentationMode, SourceDescription, TextTrack, TimeRange } from 'react-native-theoplayer';\nimport type { BackgroundAudioConfiguration } from '../../api/backgroundAudio/BackgroundAudioConfiguration';\nimport type { PiPConfiguration } from 'react-native-theoplayer';\n\nexport interface NativePlayerState {\n source: SourceDescription | undefined;\n autoplay: boolean;\n paused: boolean;\n seekable: TimeRange[];\n buffered: TimeRange[];\n pipConfig: PiPConfiguration;\n backgroundAudioConfig: BackgroundAudioConfiguration;\n presentationMode: PresentationMode;\n muted: boolean;\n seeking: boolean;\n volume: number;\n currentTime: number;\n duration: number;\n playbackRate: number;\n preload: PreloadType;\n audioTracks: MediaTrack[];\n videoTracks: MediaTrack[];\n textTracks: TextTrack[];\n targetVideoQuality: number | number[] | undefined;\n selectedVideoTrack: number | undefined;\n selectedAudioTrack: number | undefined;\n selectedTextTrack: number | undefined;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["NativePlayerState.ts"],"sourcesContent":["import type { MediaTrack, PreloadType, PresentationMode, SourceDescription, TextTrack, TimeRange } from 'react-native-theoplayer';\nimport type { BackgroundAudioConfiguration } from '../../api/backgroundAudio/BackgroundAudioConfiguration';\nimport type { PiPConfiguration } from 'react-native-theoplayer';\nimport type { AspectRatio } from 'react-native-theoplayer';\n\nexport interface NativePlayerState {\n source: SourceDescription | undefined;\n autoplay: boolean;\n paused: boolean;\n seekable: TimeRange[];\n buffered: TimeRange[];\n pipConfig: PiPConfiguration;\n backgroundAudioConfig: BackgroundAudioConfiguration;\n presentationMode: PresentationMode;\n muted: boolean;\n seeking: boolean;\n volume: number;\n currentTime: number;\n duration: number;\n playbackRate: number;\n preload: PreloadType;\n aspectRatio: AspectRatio;\n audioTracks: MediaTrack[];\n videoTracks: MediaTrack[];\n textTracks: TextTrack[];\n targetVideoQuality: number | number[] | undefined;\n selectedVideoTrack: number | undefined;\n selectedAudioTrack: number | undefined;\n selectedTextTrack: number | undefined;\n}\n"],"mappings":""}
@@ -34,6 +34,7 @@ const defaultPlayerState = {
34
34
  duration: NaN,
35
35
  playbackRate: 1,
36
36
  preload: 'none',
37
+ aspectRatio: _reactNativeTheoplayer.AspectRatio.FIT,
37
38
  audioTracks: [],
38
39
  videoTracks: [],
39
40
  textTracks: [],
@@ -372,6 +373,13 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
372
373
  this._state.volume = volume;
373
374
  _reactNative.NativeModules.PlayerModule.setVolume(this._view.nativeHandle, volume);
374
375
  }
376
+ get aspectRatio() {
377
+ return this._state.aspectRatio;
378
+ }
379
+ set aspectRatio(ratio) {
380
+ this._state.aspectRatio = ratio;
381
+ _reactNative.NativeModules.PlayerModule.setAspectRatio(this._view.nativeHandle, ratio);
382
+ }
375
383
  pause() {
376
384
  this._state.paused = true;
377
385
  _reactNative.NativeModules.PlayerModule.setPaused(this._view.nativeHandle, true);