react-native-theoplayer 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,7 +5,22 @@ 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 2.1.0]
8
+ ## [2.2.0] - 23-04-12
9
+
10
+ ### Fixed
11
+
12
+ - Fixed an issue on Android and iOS where error codes were not correctly formatted.
13
+
14
+ ### Added
15
+
16
+ - Added `RetryConfiguration` on `PlayerConfiguration` for Web and Android.
17
+
18
+ ### Changed
19
+
20
+ - Set minimum THEOplayer dependency version to 5.0.1 for Web, iOS and Android.
21
+ - Set `MediaPlaybackService` disabled by default on Android.
22
+
23
+ ## [2.1.0] - 23-04-09
9
24
 
10
25
  ### Fixed
11
26
 
@@ -105,7 +105,9 @@ dependencies {
105
105
  implementation "com.theoplayer.theoplayer-sdk-android:ads-wrapper:4.8.0"
106
106
  implementation "androidx.appcompat:appcompat:1.4.+"
107
107
 
108
- def theoplayer_sdk_version = safeExtGet('THEOplayer_sdk', '+')
108
+ // The minimum supported version is 5.0.1
109
+ def theoplayer_sdk_version = safeExtGet('THEOplayer_sdk', '[5.0.1,)')
110
+
109
111
  // def theoplayer_mediasession_version = safeExtGet('THEOplayer_mediasession', theoplayer_sdk_version)
110
112
  def theoplayer_mediasession_version = "4.12.0-local"
111
113
  def enabledV4 = theoplayer_sdk_version.toString().startsWith("4.")
@@ -32,6 +32,7 @@
32
32
  android:name="com.theoplayer.audio.MediaPlaybackService"
33
33
  android:description="@string/background_playback_service_description"
34
34
  android:exported="false"
35
+ android:enabled="false"
35
36
  android:foregroundServiceType="mediaPlayback">
36
37
  <intent-filter>
37
38
  <action android:name="android.media.browse.MediaBrowserService" />
@@ -10,6 +10,7 @@ import com.theoplayer.android.api.ads.GoogleImaConfiguration
10
10
  import com.theoplayer.android.api.cast.CastStrategy
11
11
  import com.google.android.gms.cast.framework.CastContext
12
12
  import com.theoplayer.android.api.pip.PipConfiguration
13
+ import com.theoplayer.android.api.player.NetworkConfiguration
13
14
 
14
15
  private const val TAG = "PlayerConfigAdapter"
15
16
  private const val PROP_ADS_CONFIGURATION = "ads"
@@ -24,6 +25,10 @@ private const val PROP_CAST_CONFIGURATION = "cast"
24
25
  private const val PROP_CAST_STRATEGY = "strategy"
25
26
  private const val PROP_CHROMECAST_CONFIG = "chromecast"
26
27
  private const val PROP_CHROMECAST_APPID = "appID"
28
+ private const val PROP_RETRY_CONFIG = "retryConfiguration"
29
+ private const val PROP_RETRY_MAX_RETRIES = "maxRetries"
30
+ private const val PROP_RETRY_MIN_BACKOFF = "minimumBackoff"
31
+ private const val PROP_RETRY_MAX_BACKOFF = "maximumBackoff"
27
32
 
28
33
  object PlayerConfigAdapter {
29
34
 
@@ -45,6 +50,12 @@ object PlayerConfigAdapter {
45
50
  if (configProps.hasKey(PROP_CHROMELESS)) {
46
51
  configBuilder.chromeless(configProps.getBoolean(PROP_CHROMELESS))
47
52
  }
53
+ if (configProps.hasKey(PROP_RETRY_CONFIG)) {
54
+ val networkConfig = networkConfigurationFromProps(configProps.getMap(PROP_RETRY_CONFIG))
55
+ if (networkConfig != null) {
56
+ configBuilder.networkConfiguration(networkConfig)
57
+ }
58
+ }
48
59
  applyCastConfigurationFromProps(configBuilder, configProps.getMap(PROP_CAST_CONFIGURATION))
49
60
  configBuilder.pipConfiguration(PipConfiguration.Builder().build())
50
61
  }
@@ -72,6 +83,23 @@ object PlayerConfigAdapter {
72
83
  return builder.build()
73
84
  }
74
85
 
86
+ private fun networkConfigurationFromProps(configProps: ReadableMap?): NetworkConfiguration? {
87
+ if (configProps == null) {
88
+ return null
89
+ }
90
+ val builder = NetworkConfiguration.Builder()
91
+ if (configProps.hasKey(PROP_RETRY_MAX_RETRIES)) {
92
+ builder.maxRetries(configProps.getInt(PROP_RETRY_MAX_RETRIES))
93
+ }
94
+ if (configProps.hasKey(PROP_RETRY_MIN_BACKOFF)) {
95
+ builder.minimumBackOff(configProps.getDouble(PROP_RETRY_MIN_BACKOFF).toLong())
96
+ }
97
+ if (configProps.hasKey(PROP_RETRY_MAX_BACKOFF)) {
98
+ builder.maximumBackOff(configProps.getDouble(PROP_RETRY_MAX_BACKOFF).toLong())
99
+ }
100
+ return builder.build()
101
+ }
102
+
75
103
  private fun applyCastConfigurationFromProps(
76
104
  configBuilder: THEOplayerConfig.Builder,
77
105
  castConfig: ReadableMap?
@@ -249,7 +249,7 @@ class PlayerEventEmitter internal constructor(
249
249
  }
250
250
 
251
251
  fun emitError(exception: THEOplayerException) {
252
- emitError(exception.code.name, exception.message)
252
+ emitError(exception.code.id.toString(), exception.message)
253
253
  }
254
254
 
255
255
  fun emitPresentationModeChange(
@@ -239,7 +239,7 @@ class THEOplayerRCTMainEventHandler {
239
239
  if let forwardedErrorEvent = self?.onNativeError,
240
240
  let errorObject = event.errorObject
241
241
  {
242
- let errorCodeString = String(describing: errorObject.code)
242
+ let errorCodeString = String(errorObject.code.rawValue)
243
243
  let errorCodeMessage = errorObject.message
244
244
  forwardedErrorEvent(
245
245
  [
@@ -124,9 +124,9 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
124
124
  @objc(setPipConfig:pipConfig:)
125
125
  func setPipConfig(_ node: NSNumber, pipConfig: NSDictionary) -> Void {
126
126
  DispatchQueue.main.async {
127
- let newPipConfig: PipConfig = self.parsePipConfig(configDict: pipConfig)
128
127
  if let theView = self.bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView {
129
- theView.pipConfig = newPipConfig
128
+ let pipConfig = self.parsePipConfig(configDict: pipConfig)
129
+ theView.pipConfig = pipConfig
130
130
  }
131
131
  }
132
132
  return
@@ -134,7 +134,6 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
134
134
 
135
135
  private func parsePipConfig(configDict: NSDictionary) -> PipConfig {
136
136
  var pipConfig = PipConfig()
137
- pipConfig.retainPresentationModeOnSourceChange = configDict["retainPresentationModeOnSourceChange"] as? Bool ?? false
138
137
  pipConfig.canStartPictureInPictureAutomaticallyFromInline = configDict["startsAutomatically"] as? Bool ?? false
139
138
  return pipConfig
140
139
  }
@@ -15,10 +15,15 @@ public class THEOplayerRCTView: UIView {
15
15
  var nowPlayingManager: THEOplayerRCTNowPlayingManager
16
16
  var remoteCommandsManager: THEOplayerRCTRemoteCommandsManager
17
17
  var pipControlsManager: THEOplayerRCTPipControlsManager
18
+ var presentationModeContext = THEOplayerRCTPresentationModeContext()
18
19
  var adsConfig = AdsConfig()
19
20
  var castConfig = CastConfig()
20
- var pipConfig = PipConfig()
21
- var presentationModeContext = THEOplayerRCTPresentationModeContext()
21
+
22
+ var pipConfig = PipConfig() {
23
+ didSet {
24
+ self.pipControlsManager.setPipConfig(pipConfig)
25
+ }
26
+ }
22
27
  var backgroundAudioConfig = BackgroundAudioConfig() {
23
28
  didSet {
24
29
  self.remoteCommandsManager.setBackGroundAudioConfig(backgroundAudioConfig)
@@ -8,18 +8,9 @@ import MediaPlayer
8
8
  class THEOplayerRCTPipControlsManager: NSObject {
9
9
  // MARK: Members
10
10
  private weak var player: THEOplayer?
11
- private var _nativePictureInPictureController: Any?
12
11
  private var isLive: Bool = false
13
12
  private var inAd: Bool = false
14
-
15
- @available(tvOS 14.0, *)
16
- private weak var nativePictureInPictureController: AVPictureInPictureController? {
17
- get {
18
- return _nativePictureInPictureController as? AVPictureInPictureController
19
- } set {
20
- _nativePictureInPictureController = newValue
21
- }
22
- }
13
+ private var pipConfig = PipConfig()
23
14
 
24
15
  // MARK: player Listeners
25
16
  private var durationChangeListener: EventListener?
@@ -43,11 +34,13 @@ class THEOplayerRCTPipControlsManager: NSObject {
43
34
  self.attachListeners()
44
35
  }
45
36
 
46
- @available(tvOS 14.0, *)
47
- func setNativePictureInPictureController(_ nativePictureInPictureController: AVPictureInPictureController?) {
48
- self.nativePictureInPictureController = nativePictureInPictureController;
49
- if self.nativePictureInPictureController != nil,
50
- let player = self.player,
37
+ func setPipConfig(_ newPipConfig: PipConfig) {
38
+ self.pipConfig = newPipConfig
39
+ self.updatePipControls()
40
+ }
41
+
42
+ func willStartPip() {
43
+ if let player = self.player,
51
44
  let duration = player.duration {
52
45
  self.isLive = duration.isInfinite
53
46
  #if (GOOGLE_IMA || GOOGLE_DAI) || canImport(THEOplayerGoogleIMAIntegration)
@@ -60,16 +53,32 @@ class THEOplayerRCTPipControlsManager: NSObject {
60
53
  #endif
61
54
  }
62
55
  }
63
-
64
- @available(tvOS 14.0, *)
56
+
65
57
  private func updatePipControls() {
66
- if let controller = self.nativePictureInPictureController {
67
- if #available(iOS 14.0, *) {
68
- controller.requiresLinearPlayback = self.isLive || self.inAd
69
- if DEBUG_PIPCONTROLS { print("[NATIVE] Pip controls updated for \(self.isLive ? "LIVE" : "VOD") (\(self.inAd ? "AD IS PLAYING" : "NO AD PLAYING")).") }
70
- }
58
+ if let player = self.player,
59
+ let pip = player.pip {
60
+ pip.configure(configuration: self.newPipConfiguration())
61
+ if DEBUG_PIPCONTROLS { print("[NATIVE] Pip controls updated for \(self.isLive ? "LIVE" : "VOD") (\(self.inAd ? "AD IS PLAYING" : "NO AD PLAYING")). (requiresLinearPlayback = \(self.isLive || self.inAd), canStartPictureInPictureAutomaticallyFromInline = \(self.pipConfig.canStartPictureInPictureAutomaticallyFromInline))") }
71
62
  }
72
63
  }
64
+
65
+ #if os(iOS)
66
+
67
+ func newPipConfiguration() -> PiPConfiguration {
68
+ return PiPConfiguration(retainPresentationModeOnSourceChange: false,
69
+ nativePictureInPicture: true,
70
+ canStartPictureInPictureAutomaticallyFromInline: self.pipConfig.canStartPictureInPictureAutomaticallyFromInline,
71
+ requiresLinearPlayback: self.isLive || self.inAd)
72
+ }
73
+
74
+ #elseif os(tvOS)
75
+
76
+ func newPipConfiguration() -> PiPConfiguration {
77
+ return PiPConfiguration(retainPresentationModeOnSourceChange: false,
78
+ requiresLinearPlayback: self.isLive || self.inAd)
79
+ }
80
+
81
+ #endif
73
82
 
74
83
  private func attachListeners() {
75
84
  guard let player = self.player else {
@@ -80,9 +89,7 @@ class THEOplayerRCTPipControlsManager: NSObject {
80
89
  self.durationChangeListener = player.addEventListener(type: PlayerEventTypes.DURATION_CHANGE) { [weak self] event in
81
90
  if let duration = event.duration {
82
91
  self?.isLive = duration.isInfinite
83
- if #available(iOS 14.0, tvOS 14.0, *) {
84
- self?.updatePipControls()
85
- }
92
+ self?.updatePipControls()
86
93
  }
87
94
  }
88
95
 
@@ -90,9 +97,7 @@ class THEOplayerRCTPipControlsManager: NSObject {
90
97
  self.sourceChangeListener = player.addEventListener(type: PlayerEventTypes.SOURCE_CHANGE) { [weak self] event in
91
98
  self?.isLive = false
92
99
  self?.inAd = false
93
- if #available(iOS 14.0, tvOS 14.0, *) {
94
- self?.updatePipControls()
95
- }
100
+ self?.updatePipControls()
96
101
  }
97
102
 
98
103
  #if (GOOGLE_IMA || GOOGLE_DAI) || canImport(THEOplayerGoogleIMAIntegration)
@@ -5,25 +5,25 @@ import AVKit
5
5
  import THEOplayerSDK
6
6
 
7
7
  struct PipConfig {
8
- var retainPresentationModeOnSourceChange: Bool = false // external config
9
- var canStartPictureInPictureAutomaticallyFromInline: Bool = false // external config
8
+ var canStartPictureInPictureAutomaticallyFromInline: Bool = false
10
9
  }
11
10
 
12
-
13
11
  extension THEOplayerRCTView: AVPictureInPictureControllerDelegate {
14
12
 
15
13
  #if os(iOS)
16
14
 
17
- func playerPipConfiguration() -> PiPConfiguration? {
18
- return PiPConfiguration(retainPresentationModeOnSourceChange: self.pipConfig.retainPresentationModeOnSourceChange,
15
+ func playerPipConfiguration() -> PiPConfiguration {
16
+ return PiPConfiguration(retainPresentationModeOnSourceChange: false,
19
17
  nativePictureInPicture: true,
20
- canStartPictureInPictureAutomaticallyFromInline: self.pipConfig.canStartPictureInPictureAutomaticallyFromInline)
18
+ canStartPictureInPictureAutomaticallyFromInline: self.pipConfig.canStartPictureInPictureAutomaticallyFromInline,
19
+ requiresLinearPlayback: false)
21
20
  }
22
21
 
23
22
  #elseif os(tvOS)
24
23
 
25
- func playerPipConfiguration() -> PiPConfiguration? {
26
- return PiPConfiguration(retainPresentationModeOnSourceChange: self.pipConfig.retainPresentationModeOnSourceChange)
24
+ func playerPipConfiguration() -> PiPConfiguration {
25
+ return PiPConfiguration(retainPresentationModeOnSourceChange: false,
26
+ requiresLinearPlayback: false)
27
27
  }
28
28
 
29
29
  #endif
@@ -41,12 +41,7 @@ extension THEOplayerRCTView: AVPictureInPictureControllerDelegate {
41
41
  @available(tvOS 14.0, *)
42
42
  public func pictureInPictureControllerWillStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
43
43
  self.presentationModeContext.pipContext = .PIP_CLOSED
44
- self.pipControlsManager.setNativePictureInPictureController(pictureInPictureController)
45
- }
46
-
47
- @available(tvOS 14.0, *)
48
- public func pictureInPictureControllerWillStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
49
- self.pipControlsManager.setNativePictureInPictureController(nil)
44
+ self.pipControlsManager.willStartPip()
50
45
  }
51
46
 
52
47
  @available(tvOS 14.0, *)
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["PlayerConfiguration.ts"],"sourcesContent":["import type { AdsConfiguration } from '../ads/AdsConfiguration';\nimport type { CastConfiguration } from '../cast/CastConfiguration';\nimport type { MediaControlConfiguration } from '../media/MediaControlConfiguration';\n\nexport interface PlayerConfiguration {\n /**\n * The directory in which the THEOplayer library worker files are located.\n * These worker files are THEOplayer.transmux.*\n *\n * @remarks\n * <br/> - This parameter is required when using a HLS source and has no default.\n *\n * @example\n * `'/lib/theoplayer/'`\n */\n libraryLocation?: string;\n\n /**\n * The muted autoplay policy for web.\n *\n * @remarks\n * <br/> - The muted autoplay policy is impacted by this property and {@link SourceConfiguration.mutedAutoplay}.\n *\n * @defaultValue `'none'`.\n */\n mutedAutoplay?: MutedAutoplayConfiguration;\n\n /**\n * The ads configuration for the player.\n */\n ads?: AdsConfiguration;\n\n /**\n * The cast configuration for the player.\n */\n cast?: CastConfiguration;\n\n /**\n * The configuration of media controls and media sessions across platforms.\n */\n mediaControl?: MediaControlConfiguration;\n\n /**\n * The license for the player\n */\n readonly license?: string;\n\n /**\n * The url to fetch the license for the player\n */\n readonly licenseUrl?: string;\n\n /**\n * Sets whether the native player is chromeless (without UI).\n */\n readonly chromeless?: boolean;\n}\n\n/**\n * The muted autoplay policy of a player for web.\n * <br/> - `'none'`: Disallow muted autoplay. If the player is requested to autoplay while unmuted, and the platform does not support unmuted autoplay, the player will not start playback.\n * <br/> - `'all'`: Allow muted autoplay. If the player is requested to autoplay while unmuted, and the platform supports muted autoplay, the player will start muted playback.\n * <br/> - `'content'`: Allow muted autoplay only for the main content. Disallow muted autoplay for e.g. advertisements. (Not yet supported.)\n *\n * @public\n */\nexport type MutedAutoplayConfiguration = 'none' | 'all' | 'content';\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["PlayerConfiguration.ts"],"sourcesContent":["import type { AdsConfiguration } from '../ads/AdsConfiguration';\nimport type { CastConfiguration } from '../cast/CastConfiguration';\nimport type { MediaControlConfiguration } from '../media/MediaControlConfiguration';\nimport type { RetryConfiguration } from '../utils/RetryConfiguration';\n\nexport interface PlayerConfiguration {\n /**\n * The directory in which the THEOplayer library worker files are located.\n * These worker files are THEOplayer.transmux.*\n *\n * @remarks\n * <br/> - This parameter is required when using a HLS source and has no default.\n *\n * @example\n * `'/lib/theoplayer/'`\n */\n libraryLocation?: string;\n\n /**\n * The muted autoplay policy for web.\n *\n * @remarks\n * <br/> - The muted autoplay policy is impacted by this property and {@link SourceConfiguration.mutedAutoplay}.\n *\n * @defaultValue `'none'`.\n */\n mutedAutoplay?: MutedAutoplayConfiguration;\n\n /**\n * The ads configuration for the player.\n */\n ads?: AdsConfiguration;\n\n /**\n * The cast configuration for the player.\n */\n cast?: CastConfiguration;\n\n /**\n * The configuration of media controls and media sessions across platforms.\n */\n mediaControl?: MediaControlConfiguration;\n\n /**\n * The license for the player\n */\n readonly license?: string;\n\n /**\n * The url to fetch the license for the player\n */\n readonly licenseUrl?: string;\n\n /**\n * Sets whether the native player is chromeless (without UI).\n */\n readonly chromeless?: boolean;\n\n /**\n * The retry configuration for the player.\n *\n * @remarks\n * <br/> - This parameter only applies to Web and Android platforms.\n */\n readonly retryConfiguration?: RetryConfiguration;\n}\n\n/**\n * The muted autoplay policy of a player for web.\n * <br/> - `'none'`: Disallow muted autoplay. If the player is requested to autoplay while unmuted, and the platform does not support unmuted autoplay, the player will not start playback.\n * <br/> - `'all'`: Allow muted autoplay. If the player is requested to autoplay while unmuted, and the platform supports muted autoplay, the player will start muted playback.\n * <br/> - `'content'`: Allow muted autoplay only for the main content. Disallow muted autoplay for e.g. advertisements. (Not yet supported.)\n *\n * @public\n */\nexport type MutedAutoplayConfiguration = 'none' | 'all' | 'content';\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=RetryConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["RetryConfiguration.ts"],"sourcesContent":["/**\n * Object containing values used for the player's retry mechanisms.\n */\nexport interface RetryConfiguration {\n /**\n * The maximum amount of retries before the player throws a fatal error.\n * Defaults to `Infinity`.\n */\n readonly maxRetries?: number;\n\n /**\n * The initial delay in milliseconds before a retry request occurs.\n * Exponential backoff will be applied on this value.\n * Defaults to `200`.\n */\n readonly minimumBackoff?: number;\n\n /**\n * The maximum amount of delay in milliseconds between retry requests.\n * Defaults to `30000`.\n */\n readonly maximumBackoff?: number;\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["PlayerConfiguration.ts"],"sourcesContent":["import type { AdsConfiguration } from '../ads/AdsConfiguration';\nimport type { CastConfiguration } from '../cast/CastConfiguration';\nimport type { MediaControlConfiguration } from '../media/MediaControlConfiguration';\n\nexport interface PlayerConfiguration {\n /**\n * The directory in which the THEOplayer library worker files are located.\n * These worker files are THEOplayer.transmux.*\n *\n * @remarks\n * <br/> - This parameter is required when using a HLS source and has no default.\n *\n * @example\n * `'/lib/theoplayer/'`\n */\n libraryLocation?: string;\n\n /**\n * The muted autoplay policy for web.\n *\n * @remarks\n * <br/> - The muted autoplay policy is impacted by this property and {@link SourceConfiguration.mutedAutoplay}.\n *\n * @defaultValue `'none'`.\n */\n mutedAutoplay?: MutedAutoplayConfiguration;\n\n /**\n * The ads configuration for the player.\n */\n ads?: AdsConfiguration;\n\n /**\n * The cast configuration for the player.\n */\n cast?: CastConfiguration;\n\n /**\n * The configuration of media controls and media sessions across platforms.\n */\n mediaControl?: MediaControlConfiguration;\n\n /**\n * The license for the player\n */\n readonly license?: string;\n\n /**\n * The url to fetch the license for the player\n */\n readonly licenseUrl?: string;\n\n /**\n * Sets whether the native player is chromeless (without UI).\n */\n readonly chromeless?: boolean;\n}\n\n/**\n * The muted autoplay policy of a player for web.\n * <br/> - `'none'`: Disallow muted autoplay. If the player is requested to autoplay while unmuted, and the platform does not support unmuted autoplay, the player will not start playback.\n * <br/> - `'all'`: Allow muted autoplay. If the player is requested to autoplay while unmuted, and the platform supports muted autoplay, the player will start muted playback.\n * <br/> - `'content'`: Allow muted autoplay only for the main content. Disallow muted autoplay for e.g. advertisements. (Not yet supported.)\n *\n * @public\n */\nexport type MutedAutoplayConfiguration = 'none' | 'all' | 'content';\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["PlayerConfiguration.ts"],"sourcesContent":["import type { AdsConfiguration } from '../ads/AdsConfiguration';\nimport type { CastConfiguration } from '../cast/CastConfiguration';\nimport type { MediaControlConfiguration } from '../media/MediaControlConfiguration';\nimport type { RetryConfiguration } from '../utils/RetryConfiguration';\n\nexport interface PlayerConfiguration {\n /**\n * The directory in which the THEOplayer library worker files are located.\n * These worker files are THEOplayer.transmux.*\n *\n * @remarks\n * <br/> - This parameter is required when using a HLS source and has no default.\n *\n * @example\n * `'/lib/theoplayer/'`\n */\n libraryLocation?: string;\n\n /**\n * The muted autoplay policy for web.\n *\n * @remarks\n * <br/> - The muted autoplay policy is impacted by this property and {@link SourceConfiguration.mutedAutoplay}.\n *\n * @defaultValue `'none'`.\n */\n mutedAutoplay?: MutedAutoplayConfiguration;\n\n /**\n * The ads configuration for the player.\n */\n ads?: AdsConfiguration;\n\n /**\n * The cast configuration for the player.\n */\n cast?: CastConfiguration;\n\n /**\n * The configuration of media controls and media sessions across platforms.\n */\n mediaControl?: MediaControlConfiguration;\n\n /**\n * The license for the player\n */\n readonly license?: string;\n\n /**\n * The url to fetch the license for the player\n */\n readonly licenseUrl?: string;\n\n /**\n * Sets whether the native player is chromeless (without UI).\n */\n readonly chromeless?: boolean;\n\n /**\n * The retry configuration for the player.\n *\n * @remarks\n * <br/> - This parameter only applies to Web and Android platforms.\n */\n readonly retryConfiguration?: RetryConfiguration;\n}\n\n/**\n * The muted autoplay policy of a player for web.\n * <br/> - `'none'`: Disallow muted autoplay. If the player is requested to autoplay while unmuted, and the platform does not support unmuted autoplay, the player will not start playback.\n * <br/> - `'all'`: Allow muted autoplay. If the player is requested to autoplay while unmuted, and the platform supports muted autoplay, the player will start muted playback.\n * <br/> - `'content'`: Allow muted autoplay only for the main content. Disallow muted autoplay for e.g. advertisements. (Not yet supported.)\n *\n * @public\n */\nexport type MutedAutoplayConfiguration = 'none' | 'all' | 'content';\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=RetryConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["RetryConfiguration.ts"],"sourcesContent":["/**\n * Object containing values used for the player's retry mechanisms.\n */\nexport interface RetryConfiguration {\n /**\n * The maximum amount of retries before the player throws a fatal error.\n * Defaults to `Infinity`.\n */\n readonly maxRetries?: number;\n\n /**\n * The initial delay in milliseconds before a retry request occurs.\n * Exponential backoff will be applied on this value.\n * Defaults to `200`.\n */\n readonly minimumBackoff?: number;\n\n /**\n * The maximum amount of delay in milliseconds between retry requests.\n * Defaults to `30000`.\n */\n readonly maximumBackoff?: number;\n}\n"],"mappings":""}
@@ -1,6 +1,7 @@
1
1
  import type { AdsConfiguration } from '../ads/AdsConfiguration';
2
2
  import type { CastConfiguration } from '../cast/CastConfiguration';
3
3
  import type { MediaControlConfiguration } from '../media/MediaControlConfiguration';
4
+ import type { RetryConfiguration } from '../utils/RetryConfiguration';
4
5
  export interface PlayerConfiguration {
5
6
  /**
6
7
  * The directory in which the THEOplayer library worker files are located.
@@ -46,6 +47,13 @@ export interface PlayerConfiguration {
46
47
  * Sets whether the native player is chromeless (without UI).
47
48
  */
48
49
  readonly chromeless?: boolean;
50
+ /**
51
+ * The retry configuration for the player.
52
+ *
53
+ * @remarks
54
+ * <br/> - This parameter only applies to Web and Android platforms.
55
+ */
56
+ readonly retryConfiguration?: RetryConfiguration;
49
57
  }
50
58
  /**
51
59
  * The muted autoplay policy of a player for web.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Object containing values used for the player's retry mechanisms.
3
+ */
4
+ export interface RetryConfiguration {
5
+ /**
6
+ * The maximum amount of retries before the player throws a fatal error.
7
+ * Defaults to `Infinity`.
8
+ */
9
+ readonly maxRetries?: number;
10
+ /**
11
+ * The initial delay in milliseconds before a retry request occurs.
12
+ * Exponential backoff will be applied on this value.
13
+ * Defaults to `200`.
14
+ */
15
+ readonly minimumBackoff?: number;
16
+ /**
17
+ * The maximum amount of delay in milliseconds between retry requests.
18
+ * Defaults to `30000`.
19
+ */
20
+ readonly maximumBackoff?: number;
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-theoplayer",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "A THEOplayer video component for react-native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -116,7 +116,7 @@
116
116
  "react-native-svg": "^13.8.0",
117
117
  "react-native-svg-web": "^1.0.0",
118
118
  "react-native-url-polyfill": "^1.3.0",
119
- "theoplayer": "^4.6.0",
119
+ "theoplayer": ">=5.0.1",
120
120
  "url-polyfill": "^1.1.12"
121
121
  }
122
122
  }
@@ -2,7 +2,7 @@ require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
  theoconfigpath = File.join(__dir__ + "/../../", "react-native-theoplayer.json")
5
- if File.exists?(theoconfigpath)
5
+ if File.exist?(theoconfigpath)
6
6
  theoconfig = JSON.parse(File.read(theoconfigpath))
7
7
  theofeatures = theoconfig["ios"]["features"]
8
8
  else
@@ -36,7 +36,7 @@ Pod::Spec.new do |s|
36
36
  }
37
37
  else
38
38
  puts "Using THEOplayer-core SDK"
39
- s.dependency "THEOplayerSDK-core"
39
+ s.dependency "THEOplayerSDK-core", "~> 5.0.1"
40
40
  if theofeatures.include?("GOOGLE_IMA")
41
41
  puts "Adding THEOplayer-Integration-GoogleIMA"
42
42
  s.dependency "THEOplayer-Integration-GoogleIMA"
@@ -1,6 +1,7 @@
1
1
  import type { AdsConfiguration } from '../ads/AdsConfiguration';
2
2
  import type { CastConfiguration } from '../cast/CastConfiguration';
3
3
  import type { MediaControlConfiguration } from '../media/MediaControlConfiguration';
4
+ import type { RetryConfiguration } from '../utils/RetryConfiguration';
4
5
 
5
6
  export interface PlayerConfiguration {
6
7
  /**
@@ -54,6 +55,14 @@ export interface PlayerConfiguration {
54
55
  * Sets whether the native player is chromeless (without UI).
55
56
  */
56
57
  readonly chromeless?: boolean;
58
+
59
+ /**
60
+ * The retry configuration for the player.
61
+ *
62
+ * @remarks
63
+ * <br/> - This parameter only applies to Web and Android platforms.
64
+ */
65
+ readonly retryConfiguration?: RetryConfiguration;
57
66
  }
58
67
 
59
68
  /**
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Object containing values used for the player's retry mechanisms.
3
+ */
4
+ export interface RetryConfiguration {
5
+ /**
6
+ * The maximum amount of retries before the player throws a fatal error.
7
+ * Defaults to `Infinity`.
8
+ */
9
+ readonly maxRetries?: number;
10
+
11
+ /**
12
+ * The initial delay in milliseconds before a retry request occurs.
13
+ * Exponential backoff will be applied on this value.
14
+ * Defaults to `200`.
15
+ */
16
+ readonly minimumBackoff?: number;
17
+
18
+ /**
19
+ * The maximum amount of delay in milliseconds between retry requests.
20
+ * Defaults to `30000`.
21
+ */
22
+ readonly maximumBackoff?: number;
23
+ }