react-native-theoplayer 2.9.0 → 2.11.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 +34 -1
- package/README.md +11 -9
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +9 -4
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt +15 -7
- package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +11 -0
- package/android/src/main/java/com/theoplayer/presentation/PipUtils.kt +18 -11
- package/android/src/main/java/com/theoplayer/track/TextTrackStyleAdapter.kt +79 -0
- package/android/src/main/java/com/theoplayer/util/ViewResolver.kt +6 -0
- package/ios/THEOplayerRCTBridge.m +3 -0
- package/ios/THEOplayerRCTPlayerAPI.swift +52 -0
- package/ios/THEOplayerRCTTypeUtils.swift +15 -0
- package/ios/THEOplayerRCTView.swift +8 -1
- package/ios/ads/THEOplayerRCTAdsAPI+DAI.swift +1 -1
- package/ios/ads/THEOplayerRCTSourceDescriptionBuilder+Ads.swift +1 -1
- package/ios/ads/THEOplayerRCTView+AdsConfig.swift +1 -1
- package/ios/backgroundAudio/THEOplayerRCTNowPlayingManager.swift +3 -3
- package/lib/commonjs/api/player/PlayerVersion.js +2 -0
- package/lib/commonjs/api/player/PlayerVersion.js.map +1 -0
- package/lib/commonjs/api/player/THEOplayer.js.map +1 -1
- package/lib/commonjs/api/player/barrel.js +11 -0
- package/lib/commonjs/api/player/barrel.js.map +1 -1
- package/lib/commonjs/api/track/TextTrackStyle.js +29 -0
- package/lib/commonjs/api/track/TextTrackStyle.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.js +2 -3
- package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +10 -3
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js +9 -0
- package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/native/NativePlayerEvent.js.map +1 -1
- package/lib/commonjs/internal/adapter/track/NamedColors.json +143 -0
- package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js +118 -22
- package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/web/WebMediaSession.js +1 -1
- package/lib/commonjs/internal/adapter/web/WebMediaSession.js.map +1 -1
- package/lib/module/api/player/PlayerVersion.js +2 -0
- package/lib/module/api/player/PlayerVersion.js.map +1 -0
- package/lib/module/api/player/THEOplayer.js.map +1 -1
- package/lib/module/api/player/barrel.js +1 -0
- package/lib/module/api/player/barrel.js.map +1 -1
- package/lib/module/api/track/TextTrackStyle.js +23 -0
- package/lib/module/api/track/TextTrackStyle.js.map +1 -1
- package/lib/module/internal/THEOplayerView.js +2 -3
- package/lib/module/internal/THEOplayerView.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerAdapter.js +10 -3
- package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerWebAdapter.js +7 -0
- package/lib/module/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
- package/lib/module/internal/adapter/event/native/NativePlayerEvent.js.map +1 -1
- package/lib/module/internal/adapter/track/NamedColors.json +143 -0
- package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js +117 -22
- package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
- package/lib/module/internal/adapter/web/WebMediaSession.js +1 -1
- package/lib/module/internal/adapter/web/WebMediaSession.js.map +1 -1
- package/lib/typescript/api/player/PlayerVersion.d.ts +14 -0
- package/lib/typescript/api/player/THEOplayer.d.ts +5 -0
- package/lib/typescript/api/player/barrel.d.ts +1 -0
- package/lib/typescript/api/track/TextTrackStyle.d.ts +43 -5
- package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts +4 -2
- package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts +3 -2
- package/lib/typescript/internal/adapter/event/native/NativePlayerEvent.d.ts +2 -1
- package/lib/typescript/internal/adapter/track/TextTrackStyleAdapter.d.ts +26 -8
- package/package.json +1 -1
- package/react-native-theoplayer.podspec +1 -1
- package/src/api/player/PlayerVersion.ts +15 -0
- package/src/api/player/THEOplayer.ts +6 -0
- package/src/api/player/barrel.ts +1 -0
- package/src/api/track/TextTrackStyle.ts +45 -5
- package/src/internal/THEOplayerView.tsx +2 -4
- package/src/internal/adapter/THEOplayerAdapter.ts +12 -3
- package/src/internal/adapter/THEOplayerWebAdapter.ts +9 -1
- package/src/internal/adapter/event/native/NativePlayerEvent.ts +11 -1
- package/src/internal/adapter/track/NamedColors.json +143 -0
- package/src/internal/adapter/track/TextTrackStyleAdapter.ts +132 -21
- package/src/internal/adapter/web/WebMediaSession.ts +1 -1
- package/android/src/main/java/com/theoplayer/media/CustomMediaButtonReceiver.kt +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.
|
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.11.0] - 23-08-10
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added DAI support through iOS Native pipeline, using new THEOplayerGoogleIMAIntegration functionality
|
|
13
|
+
- Added `TextTrackStyle` API for iOS and Android.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Fixed an issue on Android where the player would sometimes crash when requesting the current active video track.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Switched to 'displayIconUri' in sourceDescription.metadata as primary field for artwork selection in NowplayingInfo/MediaSession, 'poster' in sourceDescription is now the fallback.
|
|
22
|
+
- Removed the play/pause icon in the PiP window on Android while playing an ad.
|
|
23
|
+
|
|
24
|
+
## [2.10.0] - 23-07-25
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Fixed an issue on Android where the media button receiver would not accept button events in case multiple receivers are registered.
|
|
29
|
+
- Fixed an issue on Android where `react-native-theoplayer` would not build when depending on Android player SDK v5.6.0.
|
|
30
|
+
- Fixed an issue on Android where a `pause` event would not be dispatched when putting the app to the background during play-out of an ad, while background playback is enabled. The ad would also restart when bringing the app back to the foreground.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Removed restrictions on media session playback actions for AndroidTV.
|
|
35
|
+
- Upgraded `react-native` version of the example app to `react-native-tvos@0.71.12-0`.
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- Added a `version` property to `THEOplayer` for querying the `player` version (e.g., `'5.5.0'`) and `playerSuite` (e.g., `'2023.3.0'`) versions.
|
|
40
|
+
|
|
8
41
|
## [2.9.0] - 23-06-16
|
|
9
42
|
|
|
10
43
|
### Changed
|
package/README.md
CHANGED
|
@@ -55,14 +55,15 @@ React Native works to speed up the way of working with THEOplayer React Native S
|
|
|
55
55
|
The `react-native-theoplayer` package can be combined with any number of connectors to provide extra
|
|
56
56
|
functionality. Currently, the following connectors are available:
|
|
57
57
|
|
|
58
|
-
| Package name
|
|
59
|
-
|
|
60
|
-
| [`@theoplayer/react-native-analytics-adobe`](https://github.com/THEOplayer/react-native-theoplayer-analytics)
|
|
61
|
-
| [`@theoplayer/react-native-analytics-comscore`](https://github.com/THEOplayer/react-native-theoplayer-analytics)
|
|
62
|
-
| [`@theoplayer/react-native-analytics-conviva`](https://github.com/THEOplayer/react-native-theoplayer-analytics)
|
|
63
|
-
| [`@theoplayer/react-native-analytics-nielsen`](https://github.com/THEOplayer/react-native-theoplayer-analytics)
|
|
64
|
-
| [`@theoplayer/react-native-drm`](https://github.com/THEOplayer/react-native-theoplayer-drm)
|
|
65
|
-
| [`@theoplayer/react-native-ui`](https://github.com/THEOplayer/react-native-theoplayer-ui)
|
|
58
|
+
| Package name | Purpose | Registry |
|
|
59
|
+
|---------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
60
|
+
| [`@theoplayer/react-native-analytics-adobe`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Adobe analytics connector | [](https://www.npmjs.com/package/@theoplayer/react-native-analytics-adobe) |
|
|
61
|
+
| [`@theoplayer/react-native-analytics-comscore`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Comscore analytics connector | [](https://www.npmjs.com/package/@theoplayer/react-native-analytics-comscore) |
|
|
62
|
+
| [`@theoplayer/react-native-analytics-conviva`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Conviva analytics connector | [](https://www.npmjs.com/package/@theoplayer/react-native-analytics-conviva) |
|
|
63
|
+
| [`@theoplayer/react-native-analytics-nielsen`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Nielsen analytics connector | [](https://www.npmjs.com/package/@theoplayer/react-native-analytics-nielsen) |
|
|
64
|
+
| [`@theoplayer/react-native-drm`](https://github.com/THEOplayer/react-native-theoplayer-drm) | Content protection (DRM) connectors | [](https://www.npmjs.com/package/@theoplayer/react-native-drm) |
|
|
65
|
+
| [`@theoplayer/react-native-ui`](https://github.com/THEOplayer/react-native-theoplayer-ui) | React Native user interface | [](https://www.npmjs.com/package/@theoplayer/react-native-ui) |
|
|
66
|
+
| [`@theoplayer/react-native-connector-template`](https://github.com/THEOplayer/react-native-theoplayer-connector-template) | A template for `react-native-theoplayer` connectors. | [](https://www.npmjs.com/package/@theoplayer/react-native-connector-template) |
|
|
66
67
|
|
|
67
68
|
## Getting Started
|
|
68
69
|
|
|
@@ -86,6 +87,7 @@ and discussed in the next section. Finally, an overview of features, limitations
|
|
|
86
87
|
- [Casting with Chromecast and Airplay](./doc/cast.md)
|
|
87
88
|
- [Custom iOS framework](./doc/custom-ios-framework.md)
|
|
88
89
|
- [Digital Rights Management (DRM)](./doc/drm.md)
|
|
89
|
-
- [Picture-in-Picture (PiP)](./doc/pip.md)
|
|
90
90
|
- [Migrating to `react-native-theoplayer` v2.x](./doc/migrating_v2.md)
|
|
91
|
+
- [Picture-in-Picture (PiP)](./doc/pip.md)
|
|
92
|
+
- [Styling subtitles and closed captions](./doc/texttrackstyles.md)
|
|
91
93
|
- [Limitations and known issues](./doc/limitations.md)
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
</intent-filter>
|
|
41
41
|
</service>
|
|
42
42
|
|
|
43
|
-
<receiver android:name="
|
|
43
|
+
<receiver android:name="androidx.media.session.MediaButtonReceiver"
|
|
44
44
|
android:exported="false">
|
|
45
45
|
<intent-filter>
|
|
46
46
|
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
|
@@ -6,9 +6,11 @@ import androidx.annotation.StringDef
|
|
|
6
6
|
import com.facebook.react.bridge.Arguments
|
|
7
7
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
8
|
import com.facebook.react.bridge.WritableMap
|
|
9
|
+
import com.facebook.react.bridge.WritableNativeMap
|
|
9
10
|
import com.facebook.react.uimanager.events.ReactEventEmitter
|
|
10
11
|
import com.theoplayer.ads.AdEventAdapter
|
|
11
12
|
import com.theoplayer.ads.AdEventAdapter.AdEventEmitter
|
|
13
|
+
import com.theoplayer.android.api.THEOplayerGlobal
|
|
12
14
|
import com.theoplayer.android.api.error.THEOplayerException
|
|
13
15
|
import com.theoplayer.android.api.event.EventListener
|
|
14
16
|
import com.theoplayer.android.api.event.EventType
|
|
@@ -76,6 +78,8 @@ private const val EVENT_VOLUMECHANGE = "onNativeVolumeChange"
|
|
|
76
78
|
|
|
77
79
|
private const val EVENT_PROP_TYPE = "type"
|
|
78
80
|
private const val EVENT_PROP_STATE = "state"
|
|
81
|
+
private const val EVENT_PROP_VERSION = "version"
|
|
82
|
+
private const val EVENT_PROP_SUITE_VERSION = "playerSuiteVersion"
|
|
79
83
|
|
|
80
84
|
@Suppress("UNCHECKED_CAST")
|
|
81
85
|
class PlayerEventEmitter internal constructor(
|
|
@@ -273,15 +277,12 @@ class PlayerEventEmitter internal constructor(
|
|
|
273
277
|
.source(player.source)
|
|
274
278
|
.currentTime(player.currentTime)
|
|
275
279
|
.currentProgramDateTime(player.currentProgramDateTime)
|
|
276
|
-
// .presentationMode()
|
|
277
280
|
.paused(player.isPaused)
|
|
278
281
|
.playbackRate(player.playbackRate)
|
|
279
282
|
.duration(player.duration)
|
|
280
283
|
.volume(player.volume, player.isMuted)
|
|
281
284
|
.seekable(player.seekable)
|
|
282
285
|
.buffered(player.buffered)
|
|
283
|
-
// .error(player.error)
|
|
284
|
-
// .readyState(player.readyState)
|
|
285
286
|
.textTracks(player.textTracks)
|
|
286
287
|
.audioTracks(player.audioTracks)
|
|
287
288
|
.videoTracks(player.videoTracks)
|
|
@@ -290,6 +291,10 @@ class PlayerEventEmitter internal constructor(
|
|
|
290
291
|
.selectedVideoTrack(getSelectedVideoTrack(player))
|
|
291
292
|
.build()
|
|
292
293
|
)
|
|
294
|
+
payload.putMap(EVENT_PROP_VERSION, WritableNativeMap().apply {
|
|
295
|
+
putString(EVENT_PROP_VERSION, THEOplayerGlobal.getVersion())
|
|
296
|
+
putString(EVENT_PROP_SUITE_VERSION, THEOplayerGlobal.getPlayerSuiteVersion())
|
|
297
|
+
})
|
|
293
298
|
|
|
294
299
|
// Notify the player is ready
|
|
295
300
|
receiveEvent(EVENT_PLAYER_READY, payload)
|
|
@@ -489,7 +494,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
489
494
|
}
|
|
490
495
|
|
|
491
496
|
private fun <T : Quality?> activeTrack(tracks: MediaTrackList<T>?): MediaTrack<T>? {
|
|
492
|
-
return tracks?.
|
|
497
|
+
return tracks?.firstOrNull { track ->
|
|
493
498
|
track.isEnabled
|
|
494
499
|
}
|
|
495
500
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
package com.theoplayer
|
|
2
2
|
|
|
3
|
+
import android.app.UiModeManager
|
|
3
4
|
import android.content.ComponentName
|
|
4
5
|
import android.content.Context
|
|
5
6
|
import android.content.Intent
|
|
6
7
|
import android.content.ServiceConnection
|
|
7
8
|
import android.content.pm.PackageManager
|
|
9
|
+
import android.content.res.Configuration
|
|
8
10
|
import android.os.Handler
|
|
9
11
|
import android.os.IBinder
|
|
10
12
|
import android.os.Looper
|
|
@@ -59,6 +61,10 @@ class ReactTHEOplayerContext private constructor(
|
|
|
59
61
|
val player: Player
|
|
60
62
|
get() = playerView.player
|
|
61
63
|
|
|
64
|
+
private val uiModeManager by lazy {
|
|
65
|
+
reactContext.getSystemService(Context.UI_MODE_SERVICE) as? UiModeManager
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
var daiIntegration: GoogleDaiIntegration? = null
|
|
63
69
|
var imaIntegration: GoogleImaIntegration? = null
|
|
64
70
|
var castIntegration: CastIntegration? = null
|
|
@@ -66,6 +72,8 @@ class ReactTHEOplayerContext private constructor(
|
|
|
66
72
|
|
|
67
73
|
private val isBackgroundAudioEnabled: Boolean
|
|
68
74
|
get() = backgroundAudioConfig.enabled
|
|
75
|
+
private val isTV: Boolean
|
|
76
|
+
get() = uiModeManager?.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION
|
|
69
77
|
|
|
70
78
|
companion object {
|
|
71
79
|
fun create(
|
|
@@ -112,6 +120,8 @@ class ReactTHEOplayerContext private constructor(
|
|
|
112
120
|
config: BackgroundAudioConfig,
|
|
113
121
|
prevConfig: BackgroundAudioConfig?
|
|
114
122
|
) {
|
|
123
|
+
playerView.settings.setAllowBackgroundPlayback(config.enabled)
|
|
124
|
+
|
|
115
125
|
if (prevConfig?.enabled == config.enabled) {
|
|
116
126
|
// No changes
|
|
117
127
|
return
|
|
@@ -136,7 +146,7 @@ class ReactTHEOplayerContext private constructor(
|
|
|
136
146
|
// Reduce allowed set of remote control playback actions for ads & live streams.
|
|
137
147
|
val isLive = player.duration.isInfinite()
|
|
138
148
|
val isInAd = player.ads.isPlaying
|
|
139
|
-
mediaSessionConnector?.enabledPlaybackActions = if (isInAd || isLive) {
|
|
149
|
+
mediaSessionConnector?.enabledPlaybackActions = if (isInAd || isLive && !isTV) {
|
|
140
150
|
0
|
|
141
151
|
} else {
|
|
142
152
|
ALLOWED_PLAYBACK_ACTIONS
|
|
@@ -312,9 +322,9 @@ class ReactTHEOplayerContext private constructor(
|
|
|
312
322
|
fun onHostPause() {
|
|
313
323
|
// Keep current playing state when going to background
|
|
314
324
|
wasPlayingOnHostPause = !player.isPaused
|
|
315
|
-
|
|
325
|
+
playerView.onPause()
|
|
316
326
|
if (!isBackgroundAudioEnabled) {
|
|
317
|
-
|
|
327
|
+
mediaSessionConnector?.setActive(false)
|
|
318
328
|
}
|
|
319
329
|
}
|
|
320
330
|
|
|
@@ -322,10 +332,8 @@ class ReactTHEOplayerContext private constructor(
|
|
|
322
332
|
* The host activity is resumed.
|
|
323
333
|
*/
|
|
324
334
|
fun onHostResume() {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
playerView.onResume()
|
|
328
|
-
}
|
|
335
|
+
mediaSessionConnector?.setActive(true)
|
|
336
|
+
playerView.onResume()
|
|
329
337
|
}
|
|
330
338
|
|
|
331
339
|
fun destroy() {
|
|
@@ -12,11 +12,13 @@ import com.theoplayer.android.api.player.track.texttrack.TextTrackMode
|
|
|
12
12
|
import com.theoplayer.audio.BackgroundAudioConfigAdapter
|
|
13
13
|
import com.theoplayer.presentation.PipConfigAdapter
|
|
14
14
|
import com.theoplayer.track.QualityListFilter
|
|
15
|
+
import com.theoplayer.track.TextTrackStyleAdapter
|
|
15
16
|
import com.theoplayer.track.emptyQualityList
|
|
16
17
|
import com.theoplayer.util.ViewResolver
|
|
17
18
|
|
|
18
19
|
private const val TAG = "PlayerModule"
|
|
19
20
|
|
|
21
|
+
@Suppress("unused")
|
|
20
22
|
class PlayerModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
|
|
21
23
|
private val viewResolver: ViewResolver
|
|
22
24
|
|
|
@@ -187,4 +189,13 @@ class PlayerModule(context: ReactApplicationContext) : ReactContextBaseJavaModul
|
|
|
187
189
|
})
|
|
188
190
|
}
|
|
189
191
|
}
|
|
192
|
+
|
|
193
|
+
@ReactMethod
|
|
194
|
+
fun setTextTrackStyle(tag: Int, style: ReadableMap?) {
|
|
195
|
+
viewResolver.resolveViewByTag(tag) { view: ReactTHEOplayerView? ->
|
|
196
|
+
view?.player?.let { player ->
|
|
197
|
+
TextTrackStyleAdapter.applyTextTrackStyle(player.textTrackStyle, style)
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
190
201
|
}
|
|
@@ -35,6 +35,7 @@ private const val ACTION_RWD = ACTION_PLAY + 2
|
|
|
35
35
|
private const val ACTION_FFD = ACTION_PLAY + 3
|
|
36
36
|
private const val ACTION_IGNORE = ACTION_PLAY + 999
|
|
37
37
|
private const val SKIP_TIME = 15
|
|
38
|
+
private const val NO_ICON = -1
|
|
38
39
|
|
|
39
40
|
private val PIP_ASPECT_RATIO_DEFAULT = Rational(16, 9)
|
|
40
41
|
private val PIP_ASPECT_RATIO_MIN = Rational(100, 239)
|
|
@@ -46,8 +47,8 @@ class PipUtils(
|
|
|
46
47
|
) {
|
|
47
48
|
|
|
48
49
|
private var enabled: Boolean = false
|
|
49
|
-
private var onPlayerAction: EventListener<PlayerEvent
|
|
50
|
-
private var onAdAction: EventListener<GoogleImaAdEvent
|
|
50
|
+
private var onPlayerAction: EventListener<PlayerEvent<*>>
|
|
51
|
+
private var onAdAction: EventListener<GoogleImaAdEvent>
|
|
51
52
|
private val playerEvents = listOf(PlayerEventTypes.PLAY, PlayerEventTypes.PAUSE)
|
|
52
53
|
private var adEvents = listOf<GoogleImaAdEventType>()
|
|
53
54
|
private val broadcastReceiver: BroadcastReceiver = buildBroadcastReceiver()
|
|
@@ -125,21 +126,24 @@ class PipUtils(
|
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
// Play/pause
|
|
128
|
-
// Always add this button, but send an ACTION_IGNORE if disabled.
|
|
129
|
+
// Always add this button, but send an ACTION_IGNORE and make invisible if disabled.
|
|
130
|
+
// If no RemoteActions are added, MediaSession takes over the UI.
|
|
129
131
|
add(
|
|
130
132
|
if (paused) {
|
|
131
133
|
buildRemoteAction(
|
|
132
|
-
|
|
134
|
+
ACTION_PLAY,
|
|
133
135
|
R.drawable.ic_play,
|
|
134
136
|
R.string.play_pip,
|
|
135
|
-
R.string.play_desc_pip
|
|
137
|
+
R.string.play_desc_pip,
|
|
138
|
+
enablePlayPause
|
|
136
139
|
)
|
|
137
140
|
} else {
|
|
138
141
|
buildRemoteAction(
|
|
139
|
-
|
|
142
|
+
ACTION_PAUSE,
|
|
140
143
|
R.drawable.ic_pause,
|
|
141
144
|
R.string.pause_pip,
|
|
142
|
-
R.string.pause_desc_pip
|
|
145
|
+
R.string.pause_desc_pip,
|
|
146
|
+
enablePlayPause
|
|
143
147
|
)
|
|
144
148
|
}
|
|
145
149
|
)
|
|
@@ -235,12 +239,15 @@ class PipUtils(
|
|
|
235
239
|
requestId: Int,
|
|
236
240
|
iconId: Int,
|
|
237
241
|
titleId: Int,
|
|
238
|
-
descId: Int
|
|
242
|
+
descId: Int,
|
|
243
|
+
enabled: Boolean = true
|
|
239
244
|
): RemoteAction {
|
|
240
|
-
|
|
245
|
+
// Ignore the action if it is disabled
|
|
246
|
+
val requestCode = if (enabled) requestId else ACTION_IGNORE
|
|
247
|
+
val intent = Intent(ACTION_MEDIA_CONTROL).putExtra(EXTRA_ACTION, requestCode)
|
|
241
248
|
val pendingIntent =
|
|
242
|
-
PendingIntent.getBroadcast(reactContext,
|
|
243
|
-
val icon: Icon = Icon.createWithResource(reactContext, iconId)
|
|
249
|
+
PendingIntent.getBroadcast(reactContext, requestCode, intent, PendingIntent.FLAG_IMMUTABLE)
|
|
250
|
+
val icon: Icon = Icon.createWithResource(reactContext, if (enabled) iconId else NO_ICON)
|
|
244
251
|
val title = reactContext.getString(titleId)
|
|
245
252
|
val desc = reactContext.getString(descId)
|
|
246
253
|
return RemoteAction(icon, title, desc, pendingIntent)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
package com.theoplayer.track
|
|
2
|
+
|
|
3
|
+
import android.graphics.Color
|
|
4
|
+
import com.facebook.react.bridge.ReadableMap
|
|
5
|
+
import com.theoplayer.android.api.player.track.texttrack.TextTrackStyle
|
|
6
|
+
|
|
7
|
+
private val PROP_BACKGROUND_COLOR = "backgroundColor"
|
|
8
|
+
private val PROP_EDGE_STYLE = "edgeStyle"
|
|
9
|
+
private val PROP_FONT_COLOR = "fontColor"
|
|
10
|
+
private val PROP_FONT_FAMILY = "fontFamily"
|
|
11
|
+
private val PROP_FONT_SIZE = "fontSize"
|
|
12
|
+
private val PROP_WINDOW_COLOR = "windowColor"
|
|
13
|
+
private val PROP_MARGIN_LEFT = "marginLeft"
|
|
14
|
+
private val PROP_MARGIN_TOP = "marginTop"
|
|
15
|
+
private val PROP_COLOR_R = "r"
|
|
16
|
+
private val PROP_COLOR_G = "g"
|
|
17
|
+
private val PROP_COLOR_B = "b"
|
|
18
|
+
private val PROP_COLOR_A = "a"
|
|
19
|
+
|
|
20
|
+
object TextTrackStyleAdapter {
|
|
21
|
+
|
|
22
|
+
fun applyTextTrackStyle(style: TextTrackStyle, props: ReadableMap?) {
|
|
23
|
+
if (props == null) {
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
if (props.hasKey(PROP_BACKGROUND_COLOR)) {
|
|
27
|
+
style.backgroundColor =
|
|
28
|
+
colorFromBridgeColor(props.getMap(PROP_BACKGROUND_COLOR)) ?: Color.BLACK
|
|
29
|
+
}
|
|
30
|
+
if (props.hasKey(PROP_EDGE_STYLE)) {
|
|
31
|
+
style.edgeType = edgeStyleFromProps(props.getString(PROP_EDGE_STYLE))
|
|
32
|
+
}
|
|
33
|
+
if (props.hasKey(PROP_FONT_COLOR)) {
|
|
34
|
+
style.fontColor = colorFromBridgeColor(props.getMap(PROP_FONT_COLOR)) ?: Color.WHITE
|
|
35
|
+
}
|
|
36
|
+
if (props.hasKey(PROP_FONT_FAMILY)) {
|
|
37
|
+
val family = props.getString(PROP_FONT_FAMILY)
|
|
38
|
+
if (family != null) {
|
|
39
|
+
style.setFont(family, TextTrackStyle.FontStyle.NORMAL)
|
|
40
|
+
} else {
|
|
41
|
+
style.setFont(TextTrackStyle.FontFamily.DEFAULT, TextTrackStyle.FontStyle.NORMAL)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (props.hasKey(PROP_FONT_SIZE)) {
|
|
45
|
+
style.fontSize = props.getInt(PROP_FONT_SIZE)
|
|
46
|
+
}
|
|
47
|
+
if (props.hasKey(PROP_WINDOW_COLOR)) {
|
|
48
|
+
style.windowColor = colorFromBridgeColor(props.getMap(PROP_WINDOW_COLOR)) ?: Color.TRANSPARENT
|
|
49
|
+
}
|
|
50
|
+
if (props.hasKey(PROP_MARGIN_TOP)) {
|
|
51
|
+
style.marginTop = props.getInt(PROP_MARGIN_TOP)
|
|
52
|
+
}
|
|
53
|
+
if (props.hasKey(PROP_MARGIN_LEFT)) {
|
|
54
|
+
style.marginLeft = props.getInt(PROP_MARGIN_LEFT)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private fun edgeStyleFromProps(style: String?): TextTrackStyle.EdgeType {
|
|
59
|
+
return when (style) {
|
|
60
|
+
"dropshadow" -> TextTrackStyle.EdgeType.EDGE_TYPE_DROP_SHADOW
|
|
61
|
+
"raised" -> TextTrackStyle.EdgeType.EDGE_TYPE_RAISED
|
|
62
|
+
"depressed" -> TextTrackStyle.EdgeType.EDGE_TYPE_DEPRESSED
|
|
63
|
+
"uniform" -> TextTrackStyle.EdgeType.EDGE_TYPE_OUTLINE
|
|
64
|
+
else -> TextTrackStyle.EdgeType.EDGE_TYPE_NONE
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private fun colorFromBridgeColor(color: ReadableMap?): Int? {
|
|
69
|
+
if (color == null) {
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
72
|
+
return Color.argb(
|
|
73
|
+
color.getInt(PROP_COLOR_A),
|
|
74
|
+
color.getInt(PROP_COLOR_R),
|
|
75
|
+
color.getInt(PROP_COLOR_G),
|
|
76
|
+
color.getInt(PROP_COLOR_B),
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -6,11 +6,16 @@ import com.facebook.react.uimanager.UIManagerModule
|
|
|
6
6
|
import com.theoplayer.ReactTHEOplayerView
|
|
7
7
|
|
|
8
8
|
private const val TAG = "ViewResolver"
|
|
9
|
+
private const val INVALID_TAG = -1
|
|
9
10
|
|
|
10
11
|
class ViewResolver(private val reactContext: ReactApplicationContext) {
|
|
11
12
|
private var uiManager: UIManagerModule? = null
|
|
12
13
|
|
|
13
14
|
fun resolveViewByTag(tag: Int, onResolved: (view: ReactTHEOplayerView?) -> Unit) {
|
|
15
|
+
if (tag == INVALID_TAG) {
|
|
16
|
+
// Don't bother trying to resolve an invalid tag.
|
|
17
|
+
onResolved(null)
|
|
18
|
+
}
|
|
14
19
|
if (uiManager == null) {
|
|
15
20
|
uiManager = reactContext.getNativeModule(UIManagerModule::class.java)
|
|
16
21
|
}
|
|
@@ -20,6 +25,7 @@ class ViewResolver(private val reactContext: ReactApplicationContext) {
|
|
|
20
25
|
} catch (ignore: Exception) {
|
|
21
26
|
// The ReactTHEOplayerView instance could not be resolved: log but do not forward exception.
|
|
22
27
|
Log.w(TAG, "Failed to resolve ReactTHEOplayerView tag $tag")
|
|
28
|
+
onResolved(null)
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
}
|
|
@@ -108,6 +108,9 @@ RCT_EXTERN_METHOD(setTargetVideoQuality:(nonnull NSNumber *)node
|
|
|
108
108
|
RCT_EXTERN_METHOD(setPreload:(nonnull NSNumber *)node
|
|
109
109
|
type:(nonnull NSString *)type)
|
|
110
110
|
|
|
111
|
+
RCT_EXTERN_METHOD(setTextTrackStyle:(nonnull NSNumber *)node
|
|
112
|
+
textTrackStyle:(NSDictionary)textTrackStyle)
|
|
113
|
+
|
|
111
114
|
@end
|
|
112
115
|
|
|
113
116
|
// ----------------------------------------------------------------------------
|
|
@@ -10,6 +10,18 @@ let ERROR_MESSAGE_PLAYER_ABR_UNSUPPORTED_FEATURE: String = "Setting an ABRconfig
|
|
|
10
10
|
let ERROR_MESSAGE_PLAYER_QUALITY_UNSUPPORTED_FEATURE: String = "Setting a target video quality is not supported on iOS/tvOS."
|
|
11
11
|
let ERROR_MESSAGE_PLAYER_FULLSCREEN_UNSUPPORTED_FEATURE: String = "Fullscreen presentationmode should be implemented on the RN level for iOS/tvOS."
|
|
12
12
|
|
|
13
|
+
let TTS_PROP_BACKGROUND_COLOR = "backgroundColor"
|
|
14
|
+
let TTS_PROP_EDGE_STYLE = "edgeStyle"
|
|
15
|
+
let TTS_PROP_FONT_COLOR = "fontColor"
|
|
16
|
+
let TTS_PROP_FONT_FAMILY = "fontFamily"
|
|
17
|
+
let TTS_PROP_FONT_SIZE = "fontSize"
|
|
18
|
+
let TTS_PROP_MARGIN_LEFT = "marginLeft"
|
|
19
|
+
let TTS_PROP_MARGIN_TOP = "marginTop"
|
|
20
|
+
let TTS_PROP_COLOR_R = "r"
|
|
21
|
+
let TTS_PROP_COLOR_G = "g"
|
|
22
|
+
let TTS_PROP_COLOR_B = "b"
|
|
23
|
+
let TTS_PROP_COLOR_A = "a"
|
|
24
|
+
|
|
13
25
|
@objc(THEOplayerRCTPlayerAPI)
|
|
14
26
|
class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
15
27
|
@objc var bridge: RCTBridge!
|
|
@@ -251,4 +263,44 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
251
263
|
}
|
|
252
264
|
}
|
|
253
265
|
|
|
266
|
+
@objc(setTextTrackStyle:textTrackStyle:)
|
|
267
|
+
func setTextTrackStyle(_ node: NSNumber, textTrackStyle: NSDictionary) -> Void {
|
|
268
|
+
DispatchQueue.main.async {
|
|
269
|
+
if let theView = self.bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView,
|
|
270
|
+
let player = theView.player {
|
|
271
|
+
if let bgColorMap = textTrackStyle[TTS_PROP_BACKGROUND_COLOR] as? [String:Any],
|
|
272
|
+
let r = bgColorMap[TTS_PROP_COLOR_R] as? Int,
|
|
273
|
+
let g = bgColorMap[TTS_PROP_COLOR_G] as? Int,
|
|
274
|
+
let b = bgColorMap[TTS_PROP_COLOR_B] as? Int,
|
|
275
|
+
let a = bgColorMap[TTS_PROP_COLOR_A] as? Int {
|
|
276
|
+
let bgColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: CGFloat(a)/255.0)
|
|
277
|
+
player.textTrackStyle?.backgroundColor = [TextTrackStyleRuleColor(bgColor)]
|
|
278
|
+
}
|
|
279
|
+
if let fontColorMap = textTrackStyle[TTS_PROP_FONT_COLOR] as? [String:Any],
|
|
280
|
+
let r = fontColorMap[TTS_PROP_COLOR_R] as? Int,
|
|
281
|
+
let g = fontColorMap[TTS_PROP_COLOR_G] as? Int,
|
|
282
|
+
let b = fontColorMap[TTS_PROP_COLOR_B] as? Int,
|
|
283
|
+
let a = fontColorMap[TTS_PROP_COLOR_A] as? Int {
|
|
284
|
+
let fontColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: CGFloat(a)/255.0)
|
|
285
|
+
player.textTrackStyle?.fontColor = [TextTrackStyleRuleColor(fontColor)]
|
|
286
|
+
}
|
|
287
|
+
if let edgeStyle = textTrackStyle[TTS_PROP_EDGE_STYLE] as? String {
|
|
288
|
+
player.textTrackStyle?.edgeStyle = [TextTrackStyleRuleString(THEOplayerRCTTypeUtils.textTrackEdgeStyleStringFromString(edgeStyle))]
|
|
289
|
+
}
|
|
290
|
+
if let fontFamily = textTrackStyle[TTS_PROP_FONT_FAMILY] as? String {
|
|
291
|
+
player.textTrackStyle?.fontFamily = [TextTrackStyleRuleString(fontFamily)]
|
|
292
|
+
}
|
|
293
|
+
if let fontSize = textTrackStyle[TTS_PROP_FONT_SIZE] as? Int {
|
|
294
|
+
player.textTrackStyle?.fontSize = [TextTrackStyleRuleNumber(fontSize)]
|
|
295
|
+
}
|
|
296
|
+
if let marginTop = textTrackStyle[TTS_PROP_MARGIN_TOP] as? Int {
|
|
297
|
+
player.textTrackStyle?.marginTop = [TextTrackStyleRuleNumber(marginTop)]
|
|
298
|
+
}
|
|
299
|
+
if let marginLeft = textTrackStyle[TTS_PROP_MARGIN_LEFT] as? Int {
|
|
300
|
+
player.textTrackStyle?.marginLeft = [TextTrackStyleRuleNumber(marginLeft)]
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
254
306
|
}
|
|
@@ -83,4 +83,19 @@ class THEOplayerRCTTypeUtils {
|
|
|
83
83
|
return "fit"
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
|
|
87
|
+
class func textTrackEdgeStyleStringFromString(_ style: String) -> String {
|
|
88
|
+
switch style {
|
|
89
|
+
case "dropshadow":
|
|
90
|
+
return TextTrackStyleEdgeStyle.dropShadow
|
|
91
|
+
case "raised":
|
|
92
|
+
return TextTrackStyleEdgeStyle.raised
|
|
93
|
+
case "depressed":
|
|
94
|
+
return TextTrackStyleEdgeStyle.depressed
|
|
95
|
+
case "uniform":
|
|
96
|
+
return TextTrackStyleEdgeStyle.uniform
|
|
97
|
+
default:
|
|
98
|
+
return TextTrackStyleEdgeStyle.none
|
|
99
|
+
}
|
|
100
|
+
}
|
|
86
101
|
}
|
|
@@ -87,8 +87,15 @@ public class THEOplayerRCTView: UIView {
|
|
|
87
87
|
|
|
88
88
|
private func notifyNativePlayerReady() {
|
|
89
89
|
DispatchQueue.main.async {
|
|
90
|
+
let versionString = THEOplayer.version
|
|
91
|
+
let suiteVersionString = THEOplayer.playerSuiteVersion
|
|
90
92
|
if let forwardedNativeReady = self.onNativePlayerReady {
|
|
91
|
-
forwardedNativeReady([
|
|
93
|
+
forwardedNativeReady([
|
|
94
|
+
"version": [
|
|
95
|
+
"version" : versionString,
|
|
96
|
+
"playerSuiteVersion": suiteVersionString
|
|
97
|
+
],
|
|
98
|
+
])
|
|
92
99
|
}
|
|
93
100
|
}
|
|
94
101
|
}
|
|
@@ -11,7 +11,7 @@ let ERROR_MESSAGE_DAI_GET_SNAPBACK_UNDEFINED = "Undefined dai snapback"
|
|
|
11
11
|
|
|
12
12
|
extension THEOplayerRCTAdsAPI {
|
|
13
13
|
|
|
14
|
-
#if GOOGLE_DAI
|
|
14
|
+
#if GOOGLE_DAI || canImport(THEOplayerGoogleIMAIntegration)
|
|
15
15
|
@objc(daiSnapback:resolver:rejecter:)
|
|
16
16
|
func daiSnapback(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
17
17
|
DispatchQueue.main.async {
|
|
@@ -77,7 +77,7 @@ extension THEOplayerRCTSourceDescriptionBuilder {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
static func buildDAITypedSource(_ typedSourceData: [String:Any], contentProtection: MultiplatformDRMConfiguration?) -> TypedSource? {
|
|
80
|
-
#if GOOGLE_DAI
|
|
80
|
+
#if GOOGLE_DAI || canImport(THEOplayerGoogleIMAIntegration)
|
|
81
81
|
// check for alternative Google DAI SSAI
|
|
82
82
|
if let ssaiData = typedSourceData[SD_PROP_SSAI] as? [String:Any] {
|
|
83
83
|
if let integration = ssaiData[SD_PROP_INTEGRATION] as? String,
|
|
@@ -72,7 +72,7 @@ extension THEOplayerRCTView {
|
|
|
72
72
|
|
|
73
73
|
func parseAdsConfig(configDict: NSDictionary) {}
|
|
74
74
|
|
|
75
|
-
#if GOOGLE_IMA || canImport(THEOplayerGoogleIMAIntegration)
|
|
75
|
+
#if (GOOGLE_IMA || GOOGLE_DAI) || canImport(THEOplayerGoogleIMAIntegration)
|
|
76
76
|
func playerAdsConfiguration() -> AdsConfiguration? { return AdsConfiguration() }
|
|
77
77
|
#else
|
|
78
78
|
func playerAdsConfiguration() -> AdsConfiguration? { return nil }
|
|
@@ -79,13 +79,13 @@ class THEOplayerRCTNowPlayingManager {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
private func getArtWorkUrlStringFromSourceDescription(_ sourceDescription: SourceDescription) -> String? {
|
|
82
|
-
if let posterUrlString = sourceDescription.poster?.absoluteString {
|
|
83
|
-
return posterUrlString
|
|
84
|
-
}
|
|
85
82
|
if let metadata = sourceDescription.metadata,
|
|
86
83
|
let displayIconUrlString = metadata.metadataKeys?["displayIconUri"] as? String {
|
|
87
84
|
return displayIconUrlString
|
|
88
85
|
}
|
|
86
|
+
if let posterUrlString = sourceDescription.poster?.absoluteString {
|
|
87
|
+
return posterUrlString
|
|
88
|
+
}
|
|
89
89
|
|
|
90
90
|
return nil
|
|
91
91
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["PlayerVersion.ts"],"sourcesContent":["export interface PlayerVersion {\n /**\n * The version of the THEOplayer SDK.\n *\n * @public\n */\n readonly version: string;\n\n /**\n * The player suite version of the THEOplayer SDK.\n *\n * @public\n */\n readonly playerSuiteVersion: string;\n}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
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":";;;;;;
|
|
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';\nimport type { PlayerVersion } from './PlayerVersion';\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 * The player version.\n */\n readonly version: PlayerVersion;\n\n /**\n * Native player handle.\n */\n readonly nativeHandle: NativeHandleType;\n}\n"],"mappings":";;;;;;AAiBA;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"}
|
|
@@ -25,4 +25,15 @@ Object.keys(_PlayerEventMap).forEach(function (key) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
+
var _PlayerVersion = require("./PlayerVersion");
|
|
29
|
+
Object.keys(_PlayerVersion).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _PlayerVersion[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _PlayerVersion[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
28
39
|
//# sourceMappingURL=barrel.js.map
|