bitmovin-player-react-native 0.9.2 → 0.10.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/RNBitmovinPlayer.podspec +1 -1
- package/android/build.gradle +1 -2
- package/android/src/main/java/com/bitmovin/player/reactnative/AnalyticsModule.kt +43 -11
- package/android/src/main/java/com/bitmovin/player/reactnative/OfflineModule.kt +279 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/PlayerModule.kt +37 -1
- package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerViewPackage.kt +1 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/converter/JsonConverter.kt +123 -35
- package/android/src/main/java/com/bitmovin/player/reactnative/offline/OfflineContentManagerBridge.kt +216 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/offline/OfflineDownloadRequest.kt +7 -0
- package/ios/DrmModule.swift +5 -5
- package/ios/OfflineContentManagerBridge.swift +141 -0
- package/ios/OfflineModule.m +19 -0
- package/ios/OfflineModule.swift +465 -0
- package/ios/PlayerModule.m +2 -0
- package/ios/PlayerModule.swift +40 -7
- package/ios/RCTConvert+BitmovinPlayer.swift +135 -1
- package/ios/RNBitmovinPlayer.h +1 -0
- package/lib/index.d.mts +382 -2
- package/lib/index.d.ts +382 -2
- package/lib/index.js +233 -0
- package/lib/index.mjs +231 -0
- package/package.json +1 -1
- package/src/adaptationConfig.ts +10 -0
- package/src/index.ts +2 -0
- package/src/offline/index.ts +7 -0
- package/src/offline/offlineContentConfig.ts +18 -0
- package/src/offline/offlineContentManager.ts +216 -0
- package/src/offline/offlineContentManagerListener.ts +187 -0
- package/src/offline/offlineContentOptions.ts +29 -0
- package/src/offline/offlineDownloadRequest.ts +20 -0
- package/src/offline/offlineSourceOptions.ts +11 -0
- package/src/offline/offlineState.ts +22 -0
- package/src/player.ts +30 -0
- package/src/source.ts +38 -0
|
@@ -6,7 +6,7 @@ extension RCTConvert {
|
|
|
6
6
|
/**
|
|
7
7
|
Utility method to instantiate a `PlayerConfig` from a JS object.
|
|
8
8
|
- Parameter json: JS object
|
|
9
|
-
- Returns: The produced `
|
|
9
|
+
- Returns: The produced `PlayerConfig` object
|
|
10
10
|
*/
|
|
11
11
|
static func playerConfig(_ json: Any?) -> PlayerConfig? {
|
|
12
12
|
let playerConfig = PlayerConfig()
|
|
@@ -28,6 +28,9 @@ extension RCTConvert {
|
|
|
28
28
|
if let advertisingConfig = RCTConvert.advertisingConfig(json["advertisingConfig"]) {
|
|
29
29
|
playerConfig.advertisingConfig = advertisingConfig
|
|
30
30
|
}
|
|
31
|
+
if let adaptationConfig = RCTConvert.adaptationConfig(json["adaptationConfig"]) {
|
|
32
|
+
playerConfig.adaptationConfig = adaptationConfig
|
|
33
|
+
}
|
|
31
34
|
return playerConfig
|
|
32
35
|
}
|
|
33
36
|
|
|
@@ -255,8 +258,42 @@ extension RCTConvert {
|
|
|
255
258
|
if let metadata = json["metadata"] as? [String: String] {
|
|
256
259
|
sourceConfig.metadata = metadata
|
|
257
260
|
}
|
|
261
|
+
if let options = json["options"] as? [String: Any] {
|
|
262
|
+
sourceConfig.options = RCTConvert.sourceOptions(options)
|
|
263
|
+
}
|
|
258
264
|
return sourceConfig
|
|
259
265
|
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
Utility method to instantiate a `SourceOptions` from a JS object.
|
|
269
|
+
- Parameter json: JS object
|
|
270
|
+
- Returns: The produced `SourceOptions` object
|
|
271
|
+
*/
|
|
272
|
+
static func sourceOptions(_ json: Any?) -> SourceOptions {
|
|
273
|
+
let sourceOptions = SourceOptions()
|
|
274
|
+
guard let json = json as? [String: Any?] else {
|
|
275
|
+
return sourceOptions
|
|
276
|
+
}
|
|
277
|
+
if let startOffset = json["startOffset"] as? NSNumber {
|
|
278
|
+
sourceOptions.startOffset = startOffset.doubleValue
|
|
279
|
+
}
|
|
280
|
+
sourceOptions.startOffsetTimelineReference = RCTConvert.timelineReferencePoint(json["startOffsetTimelineReference"])
|
|
281
|
+
return sourceOptions
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
Utility method to instantiate a `TimelineReferencePoint` from a JS object.
|
|
286
|
+
- Parameter json: JS object
|
|
287
|
+
- Returns: The produced `TimelineReferencePoint` value
|
|
288
|
+
*/
|
|
289
|
+
static func timelineReferencePoint(_ json: Any?) -> TimelineReferencePoint {
|
|
290
|
+
guard let stringValue = json as? String else { return .auto }
|
|
291
|
+
switch stringValue {
|
|
292
|
+
case "start": return .start
|
|
293
|
+
case "end": return .end
|
|
294
|
+
default: return .auto
|
|
295
|
+
}
|
|
296
|
+
}
|
|
260
297
|
|
|
261
298
|
/**
|
|
262
299
|
Utility method to get a `SourceType` from a JS object.
|
|
@@ -438,6 +475,24 @@ extension RCTConvert {
|
|
|
438
475
|
]
|
|
439
476
|
}
|
|
440
477
|
|
|
478
|
+
/**
|
|
479
|
+
Utility method to get a json dictionary value from a `ThumbnailTrack` object.
|
|
480
|
+
- Parameter thumbnailTrack: The `ThumbnailTrack` to convert to json format.
|
|
481
|
+
- Returns: The generated json dictionary.
|
|
482
|
+
*/
|
|
483
|
+
static func toJson(thumbnailTrack: ThumbnailTrack?) -> [AnyHashable: Any]? {
|
|
484
|
+
guard let thumbnailTrack = thumbnailTrack else {
|
|
485
|
+
return nil
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return [
|
|
489
|
+
"url": thumbnailTrack.url?.absoluteString,
|
|
490
|
+
"label": thumbnailTrack.label,
|
|
491
|
+
"isDefault": thumbnailTrack.isDefaultTrack,
|
|
492
|
+
"identifier": thumbnailTrack.identifier
|
|
493
|
+
]
|
|
494
|
+
}
|
|
495
|
+
|
|
441
496
|
/**
|
|
442
497
|
Utility method to compute a JS value from an `AdItem` object.
|
|
443
498
|
- Parameter adItem: `AdItem` object to be converted.
|
|
@@ -572,6 +627,7 @@ extension RCTConvert {
|
|
|
572
627
|
"minBitrate": adData.minBitrate
|
|
573
628
|
]
|
|
574
629
|
}
|
|
630
|
+
|
|
575
631
|
/**
|
|
576
632
|
Utility method to get a `BitmovinAnalyticsConfig` value from a JS object.
|
|
577
633
|
- Parameter json: JS object.
|
|
@@ -798,4 +854,82 @@ extension RCTConvert {
|
|
|
798
854
|
default: return nil
|
|
799
855
|
}
|
|
800
856
|
}
|
|
857
|
+
|
|
858
|
+
#if os(iOS)
|
|
859
|
+
/**
|
|
860
|
+
Utility method to compute a JS value from an `OfflineState` object.
|
|
861
|
+
- Parameter offlineState `OfflineState` object to be converted.
|
|
862
|
+
- Returns: The produced JS object.
|
|
863
|
+
*/
|
|
864
|
+
static func toJson(offlineState: OfflineState?) -> String {
|
|
865
|
+
var notDownloaded = "NotDownloaded"
|
|
866
|
+
guard let offlineState = offlineState else {
|
|
867
|
+
return notDownloaded
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
switch offlineState {
|
|
871
|
+
case .downloading: return "Downloading"
|
|
872
|
+
case .downloaded: return "Downloaded"
|
|
873
|
+
case .suspended: return "Suspended"
|
|
874
|
+
default: return notDownloaded
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
Utility method to compute a JS value from an `OfflineTextTrack` object.
|
|
880
|
+
- Parameter offlineTrack `OfflineTextTrack` object to be converted.
|
|
881
|
+
- Returns: The produced JS object.
|
|
882
|
+
*/
|
|
883
|
+
static func toJson(offlineTrack: OfflineTextTrack) -> [String: Any?] {
|
|
884
|
+
return [
|
|
885
|
+
"id": offlineTrack.label,
|
|
886
|
+
"language": offlineTrack.language,
|
|
887
|
+
]
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
Utility method to compute a JS value from an `OfflineAudioTrack` object.
|
|
892
|
+
- Parameter offlineTrack `OfflineAudioTrack` object to be converted.
|
|
893
|
+
- Returns: The produced JS object.
|
|
894
|
+
*/
|
|
895
|
+
static func toJson(offlineTrack: OfflineAudioTrack) -> [String: Any?] {
|
|
896
|
+
return [
|
|
897
|
+
"id": offlineTrack.label,
|
|
898
|
+
"language": offlineTrack.language,
|
|
899
|
+
]
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
Utility method to compute a JS value from an `OfflineTrackSelection` object.
|
|
904
|
+
- Parameter offlineTracks `OfflineTrackSelection` object to be converted.
|
|
905
|
+
- Returns: The produced JS object.
|
|
906
|
+
*/
|
|
907
|
+
static func toJson(offlineTracks: OfflineTrackSelection?) -> [String: Any?]? {
|
|
908
|
+
guard let offlineTracks = offlineTracks else {
|
|
909
|
+
return nil
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
return [
|
|
913
|
+
"textOptions": offlineTracks.textTracks.compactMap { RCTConvert.toJson(offlineTrack: $0) },
|
|
914
|
+
"audioOptions": offlineTracks.audioTracks.compactMap { RCTConvert.toJson(offlineTrack: $0) }
|
|
915
|
+
]
|
|
916
|
+
}
|
|
917
|
+
#endif
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
Utility method to instantiate a `AdaptationConfig` from a JS object.
|
|
921
|
+
- Parameter json: JS object
|
|
922
|
+
- Returns: The produced `AdaptationConfig` object
|
|
923
|
+
*/
|
|
924
|
+
static func adaptationConfig(_ json: Any?) -> AdaptationConfig? {
|
|
925
|
+
guard let json = json as? [String: Any?] else {
|
|
926
|
+
return nil
|
|
927
|
+
}
|
|
928
|
+
let adaptationConfig = AdaptationConfig()
|
|
929
|
+
if let maxSelectableBitrate = json["maxSelectableBitrate"] as? NSNumber {
|
|
930
|
+
adaptationConfig.maxSelectableBitrate = maxSelectableBitrate.uintValue
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
return adaptationConfig
|
|
934
|
+
}
|
|
801
935
|
}
|
package/ios/RNBitmovinPlayer.h
CHANGED
package/lib/index.d.mts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import { ViewStyle } from 'react-native';
|
|
1
|
+
import { EmitterSubscription, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configures the adaptation logic.
|
|
5
|
+
*/
|
|
6
|
+
interface AdaptationConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The upper bitrate boundary in bits per second for approximate network bandwidth consumption of the played source.
|
|
9
|
+
* Can be set to `undefined` for no limitation.
|
|
10
|
+
*/
|
|
11
|
+
maxSelectableBitrate?: number;
|
|
12
|
+
}
|
|
2
13
|
|
|
3
14
|
/**
|
|
4
15
|
* Quartiles that can be reached during an ad playback.
|
|
@@ -1496,6 +1507,38 @@ declare enum LoadingState {
|
|
|
1496
1507
|
*/
|
|
1497
1508
|
LOADED = 2
|
|
1498
1509
|
}
|
|
1510
|
+
/**
|
|
1511
|
+
* Types of SourceOptions.
|
|
1512
|
+
*/
|
|
1513
|
+
interface SourceOptions {
|
|
1514
|
+
/**
|
|
1515
|
+
* The position where the stream should be started.
|
|
1516
|
+
* Number can be positive or negative depending on the used `TimelineReferencePoint`.
|
|
1517
|
+
* Invalid numbers will be corrected according to the stream boundaries.
|
|
1518
|
+
* For VOD this is applied at the time the stream is loaded, for LIVE when playback starts.
|
|
1519
|
+
*/
|
|
1520
|
+
startOffset?: number;
|
|
1521
|
+
/**
|
|
1522
|
+
* Sets the Timeline reference point to calculate the startOffset from.
|
|
1523
|
+
* Default for live: `TimelineReferencePoint.END`.
|
|
1524
|
+
* Default for VOD: `TimelineReferencePoint.START`.
|
|
1525
|
+
*/
|
|
1526
|
+
startOffsetTimelineReference?: TimelineReferencePoint;
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
Timeline reference point to calculate SourceOptions.startOffset from.
|
|
1530
|
+
Default for live: TimelineReferencePoint.EBD Default for VOD: TimelineReferencePoint.START.
|
|
1531
|
+
*/
|
|
1532
|
+
declare enum TimelineReferencePoint {
|
|
1533
|
+
/**
|
|
1534
|
+
* Relative offset will be calculated from the beginning of the stream or DVR window.
|
|
1535
|
+
*/
|
|
1536
|
+
START = "start",
|
|
1537
|
+
/**
|
|
1538
|
+
* Relative offset will be calculated from the end of the stream or the live edge in case of a live stream with DVR window.
|
|
1539
|
+
*/
|
|
1540
|
+
END = "end"
|
|
1541
|
+
}
|
|
1499
1542
|
/**
|
|
1500
1543
|
* Represents a source configuration that be loaded into a player instance.
|
|
1501
1544
|
*/
|
|
@@ -1537,6 +1580,10 @@ interface SourceConfig extends NativeInstanceConfig {
|
|
|
1537
1580
|
* The optional custom metadata. Also sent to the cast receiver when loading the Source.
|
|
1538
1581
|
*/
|
|
1539
1582
|
metadata?: Record<string, string>;
|
|
1583
|
+
/**
|
|
1584
|
+
* The `SourceOptions` for this configuration.
|
|
1585
|
+
*/
|
|
1586
|
+
options?: SourceOptions;
|
|
1540
1587
|
}
|
|
1541
1588
|
/**
|
|
1542
1589
|
* Represents audio and video content that can be loaded into a player.
|
|
@@ -1865,6 +1912,324 @@ interface TweaksConfig {
|
|
|
1865
1912
|
useFiletypeExtractorFallbackForHls?: boolean;
|
|
1866
1913
|
}
|
|
1867
1914
|
|
|
1915
|
+
/**
|
|
1916
|
+
* Contains the state an OfflineContentManager can have.
|
|
1917
|
+
* @platform Android, iOS
|
|
1918
|
+
*/
|
|
1919
|
+
declare enum OfflineState {
|
|
1920
|
+
/**
|
|
1921
|
+
* The offline content is downloaded and ready for offline playback.
|
|
1922
|
+
*/
|
|
1923
|
+
Downloaded = "Downloaded",
|
|
1924
|
+
/**
|
|
1925
|
+
* The offline content is currently downloading.
|
|
1926
|
+
*/
|
|
1927
|
+
Downloading = "Downloading",
|
|
1928
|
+
/**
|
|
1929
|
+
* The download of the offline content is suspended, and is only partly downloaded yet.
|
|
1930
|
+
*/
|
|
1931
|
+
Suspended = "Suspended",
|
|
1932
|
+
/**
|
|
1933
|
+
* The offline content is not downloaded. However, some data may be still cached.
|
|
1934
|
+
*/
|
|
1935
|
+
NotDownloaded = "NotDownloaded"
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* Represents the configuration to start a download.
|
|
1940
|
+
* @platform Android, iOS
|
|
1941
|
+
*/
|
|
1942
|
+
interface OfflineDownloadRequest {
|
|
1943
|
+
/**
|
|
1944
|
+
* Minimum video bitrate to download. The nearest higher available bitrate will be selected.
|
|
1945
|
+
*/
|
|
1946
|
+
minimumBitrate?: number;
|
|
1947
|
+
/**
|
|
1948
|
+
* Audio tracks with IDs to download.
|
|
1949
|
+
*/
|
|
1950
|
+
audioOptionIds?: string[];
|
|
1951
|
+
/**
|
|
1952
|
+
* Text tracks with IDs to download.
|
|
1953
|
+
*/
|
|
1954
|
+
textOptionIds?: string[];
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
/**
|
|
1958
|
+
* Object used to configure a new `OfflineContentManager` instance.
|
|
1959
|
+
* @platform Android, iOS
|
|
1960
|
+
*/
|
|
1961
|
+
interface OfflineContentConfig extends NativeInstanceConfig {
|
|
1962
|
+
/**
|
|
1963
|
+
* An identifier for this source that is unique within the location and must never change.
|
|
1964
|
+
* The root folder will contain a folder based on this id.
|
|
1965
|
+
*/
|
|
1966
|
+
identifier: string;
|
|
1967
|
+
/**
|
|
1968
|
+
* The `SourceConfig` used to download the offline resources.
|
|
1969
|
+
*/
|
|
1970
|
+
sourceConfig: SourceConfig;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
/**
|
|
1974
|
+
* Object used configure how the native offline managers create and get offline source configurations
|
|
1975
|
+
* @platform Android, iOS
|
|
1976
|
+
*/
|
|
1977
|
+
interface OfflineSourceOptions {
|
|
1978
|
+
/**
|
|
1979
|
+
* Whether or not the player should restrict playback only to audio, video and subtitle tracks which are stored offline on the device. This has to be set to true if the device has no network access.
|
|
1980
|
+
* @platform iOS
|
|
1981
|
+
*/
|
|
1982
|
+
restrictedToAssetCache?: boolean;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
/**
|
|
1986
|
+
* Superclass of entries which can be selected to download for offline playback
|
|
1987
|
+
* @platform Android, iOS
|
|
1988
|
+
*/
|
|
1989
|
+
interface OfflineContentOptionEntry {
|
|
1990
|
+
/**
|
|
1991
|
+
* The ID of the option.
|
|
1992
|
+
*/
|
|
1993
|
+
id: string;
|
|
1994
|
+
/**
|
|
1995
|
+
* The language of the option.
|
|
1996
|
+
*/
|
|
1997
|
+
language?: string;
|
|
1998
|
+
}
|
|
1999
|
+
/**
|
|
2000
|
+
* Represents the downloadable options provided via the `onOptionsAvailable` callback on `OfflineContentManagerListener`
|
|
2001
|
+
* @platform Android, iOS
|
|
2002
|
+
*/
|
|
2003
|
+
interface OfflineContentOptions {
|
|
2004
|
+
/**
|
|
2005
|
+
* Represents the audio options available for download
|
|
2006
|
+
*/
|
|
2007
|
+
audioOptions: OfflineContentOptionEntry[];
|
|
2008
|
+
/**
|
|
2009
|
+
* Represents the text options available for download
|
|
2010
|
+
*/
|
|
2011
|
+
textOptions: OfflineContentOptionEntry[];
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
/**
|
|
2015
|
+
* Enum to hold the `eventType` on the `BitmovinNativeOfflineEventData`
|
|
2016
|
+
* @platform Android, iOS
|
|
2017
|
+
*/
|
|
2018
|
+
declare enum OfflineEventType {
|
|
2019
|
+
onCompleted = "onCompleted",
|
|
2020
|
+
onError = "onError",
|
|
2021
|
+
onProgress = "onProgress",
|
|
2022
|
+
onOptionsAvailable = "onOptionsAvailable",
|
|
2023
|
+
onDrmLicenseUpdated = "onDrmLicenseUpdated",
|
|
2024
|
+
onDrmLicenseExpired = "onDrmLicenseExpired",
|
|
2025
|
+
onSuspended = "onSuspended",
|
|
2026
|
+
onResumed = "onResumed",
|
|
2027
|
+
onCanceled = "onCanceled"
|
|
2028
|
+
}
|
|
2029
|
+
/**
|
|
2030
|
+
* The base interface for all offline events.
|
|
2031
|
+
* @platform Android, iOS
|
|
2032
|
+
*/
|
|
2033
|
+
interface OfflineEvent<T extends OfflineEventType> {
|
|
2034
|
+
/**
|
|
2035
|
+
* The native id associated with the `OfflineContentManager` emitting this event
|
|
2036
|
+
*/
|
|
2037
|
+
nativeId: string;
|
|
2038
|
+
/**
|
|
2039
|
+
* The supplied id representing the source associated with the `OfflineContentManager` emitting this event.
|
|
2040
|
+
*/
|
|
2041
|
+
identifier: string;
|
|
2042
|
+
/**
|
|
2043
|
+
* The `OfflineEventType` that correlates to which native `OfflineContentManagerListener` method was called.
|
|
2044
|
+
*/
|
|
2045
|
+
eventType: T;
|
|
2046
|
+
/**
|
|
2047
|
+
* The current offline download state
|
|
2048
|
+
*/
|
|
2049
|
+
state: OfflineState;
|
|
2050
|
+
}
|
|
2051
|
+
/**
|
|
2052
|
+
* Emitted when the download process has completed.
|
|
2053
|
+
* @platform Android, iOS
|
|
2054
|
+
*/
|
|
2055
|
+
interface OnCompletedEvent extends OfflineEvent<OfflineEventType.onCompleted> {
|
|
2056
|
+
/**
|
|
2057
|
+
* The options that are available to download
|
|
2058
|
+
*/
|
|
2059
|
+
options?: OfflineContentOptions;
|
|
2060
|
+
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Emitted when an error has occurred.
|
|
2063
|
+
* @platform Android, iOS
|
|
2064
|
+
*/
|
|
2065
|
+
interface OnErrorEvent extends OfflineEvent<OfflineEventType.onError> {
|
|
2066
|
+
/**
|
|
2067
|
+
* The error code of the process error
|
|
2068
|
+
*/
|
|
2069
|
+
code?: number;
|
|
2070
|
+
/**
|
|
2071
|
+
* The error message of the process error
|
|
2072
|
+
*/
|
|
2073
|
+
message?: string;
|
|
2074
|
+
}
|
|
2075
|
+
/**
|
|
2076
|
+
* Emitted when there is a progress change for the process call.
|
|
2077
|
+
* @platform Android, iOS
|
|
2078
|
+
*/
|
|
2079
|
+
interface OnProgressEvent extends OfflineEvent<OfflineEventType.onProgress> {
|
|
2080
|
+
/**
|
|
2081
|
+
* The progress for the current process
|
|
2082
|
+
*/
|
|
2083
|
+
progress: number;
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Emitted when the `OfflineContentOptions` is available after a `OfflineContentManager.getOptions` call.
|
|
2087
|
+
* @platform Android, iOS
|
|
2088
|
+
*/
|
|
2089
|
+
interface OnOptionsAvailableEvent extends OfflineEvent<OfflineEventType.onOptionsAvailable> {
|
|
2090
|
+
/**
|
|
2091
|
+
* The options that are available to download
|
|
2092
|
+
*/
|
|
2093
|
+
options?: OfflineContentOptions;
|
|
2094
|
+
}
|
|
2095
|
+
/**
|
|
2096
|
+
* Emitted when the DRM license was updated.
|
|
2097
|
+
* @platform Android, iOS
|
|
2098
|
+
*/
|
|
2099
|
+
interface OnDrmLicenseUpdatedEvent extends OfflineEvent<OfflineEventType.onDrmLicenseUpdated> {
|
|
2100
|
+
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Emitted when the DRM license has expired.
|
|
2103
|
+
* @platform iOS
|
|
2104
|
+
*/
|
|
2105
|
+
interface OnDrmLicenseExpiredEvent extends OfflineEvent<OfflineEventType.onDrmLicenseExpired> {
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* Emitted when all active actions have been suspended.
|
|
2109
|
+
* @platform Android, iOS
|
|
2110
|
+
*/
|
|
2111
|
+
interface OnSuspendedEvent extends OfflineEvent<OfflineEventType.onSuspended> {
|
|
2112
|
+
}
|
|
2113
|
+
/**
|
|
2114
|
+
* Emitted when all actions have been resumed.
|
|
2115
|
+
* @platform Android, iOS
|
|
2116
|
+
*/
|
|
2117
|
+
interface OnResumedEvent extends OfflineEvent<OfflineEventType.onResumed> {
|
|
2118
|
+
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Emitted when the download of the media content was canceled by the user and all partially downloaded content has been deleted from disk.
|
|
2121
|
+
* @platform Android, iOS
|
|
2122
|
+
*/
|
|
2123
|
+
interface OnCanceledEvent extends OfflineEvent<OfflineEventType.onCanceled> {
|
|
2124
|
+
}
|
|
2125
|
+
/**
|
|
2126
|
+
* The type aggregation for all possible native offline events received from the `DeviceEventEmitter`
|
|
2127
|
+
* @platform Android, iOS
|
|
2128
|
+
*/
|
|
2129
|
+
declare type BitmovinNativeOfflineEventData = OnCompletedEvent | OnOptionsAvailableEvent | OnProgressEvent | OnErrorEvent | OnDrmLicenseUpdatedEvent | OnDrmLicenseExpiredEvent | OnSuspendedEvent | OnResumedEvent | OnCanceledEvent;
|
|
2130
|
+
/**
|
|
2131
|
+
* The listener that can be passed to the `OfflineContentManager` to receive callbacks for different events.
|
|
2132
|
+
* @platform Android, iOS
|
|
2133
|
+
*/
|
|
2134
|
+
interface OfflineContentManagerListener {
|
|
2135
|
+
onCompleted?: (e: OnCompletedEvent) => void;
|
|
2136
|
+
onError?: (e: OnErrorEvent) => void;
|
|
2137
|
+
onProgress?: (e: OnProgressEvent) => void;
|
|
2138
|
+
onOptionsAvailable?: (e: OnOptionsAvailableEvent) => void;
|
|
2139
|
+
onDrmLicenseUpdated?: (e: OnDrmLicenseUpdatedEvent) => void;
|
|
2140
|
+
onDrmLicenseExpired?: (e: OnDrmLicenseExpiredEvent) => void;
|
|
2141
|
+
onSuspended?: (e: OnSuspendedEvent) => void;
|
|
2142
|
+
onResumed?: (e: OnResumedEvent) => void;
|
|
2143
|
+
onCanceled?: (e: OnCanceledEvent) => void;
|
|
2144
|
+
}
|
|
2145
|
+
declare const handleBitmovinNativeOfflineEvent: (data: BitmovinNativeOfflineEventData, listeners: Set<OfflineContentManagerListener>) => void;
|
|
2146
|
+
|
|
2147
|
+
/**
|
|
2148
|
+
* Provides the means to download and store sources locally that can be played back with a Player
|
|
2149
|
+
* without an active network connection. An OfflineContentManager instance can be created via
|
|
2150
|
+
* the constructor and will be idle until initialized.
|
|
2151
|
+
*
|
|
2152
|
+
* @platform Android, iOS
|
|
2153
|
+
*/
|
|
2154
|
+
declare class OfflineContentManager extends NativeInstance<OfflineContentConfig> {
|
|
2155
|
+
isInitialized: boolean;
|
|
2156
|
+
isDestroyed: boolean;
|
|
2157
|
+
eventSubscription?: EmitterSubscription;
|
|
2158
|
+
listeners: Set<OfflineContentManagerListener>;
|
|
2159
|
+
drm?: Drm;
|
|
2160
|
+
constructor(config: OfflineContentConfig);
|
|
2161
|
+
/**
|
|
2162
|
+
* Allocates the native `OfflineManager` instance and its resources natively.
|
|
2163
|
+
* Registers the `DeviceEventEmitter` listener to receive data from the native `OfflineContentManagerListener` callbacks
|
|
2164
|
+
*/
|
|
2165
|
+
initialize: () => Promise<void>;
|
|
2166
|
+
/**
|
|
2167
|
+
* Adds a listener to the receive data from the native `OfflineContentManagerListener` callbacks
|
|
2168
|
+
* Returns a function that removes this listener from the `OfflineContentManager` that registered it.
|
|
2169
|
+
*/
|
|
2170
|
+
addListener: (listener: OfflineContentManagerListener) => (() => void);
|
|
2171
|
+
/**
|
|
2172
|
+
* Destroys the native `OfflineManager` and releases all of its allocated resources.
|
|
2173
|
+
*/
|
|
2174
|
+
destroy: () => Promise<void>;
|
|
2175
|
+
/**
|
|
2176
|
+
* Gets the current state of the `OfflineContentManager`
|
|
2177
|
+
*/
|
|
2178
|
+
state: () => Promise<OfflineState>;
|
|
2179
|
+
/**
|
|
2180
|
+
* Loads the current `OfflineContentOptions`.
|
|
2181
|
+
* When the options are loaded the data will be passed to the `OfflineContentManagerListener.onOptionsAvailable`.
|
|
2182
|
+
*/
|
|
2183
|
+
getOptions: () => Promise<void>;
|
|
2184
|
+
/**
|
|
2185
|
+
* Enqueues downloads according to the `OfflineDownloadRequest`.
|
|
2186
|
+
* The promise will reject in the event of null or invalid request parameters.
|
|
2187
|
+
* The promise will reject when calling this method when download has already started or is completed.
|
|
2188
|
+
* The promise will resolve when the download has been queued. The download will is not finished when the promise resolves.
|
|
2189
|
+
*/
|
|
2190
|
+
download: (request: OfflineDownloadRequest) => Promise<void>;
|
|
2191
|
+
/**
|
|
2192
|
+
* Resumes all suspended actions.
|
|
2193
|
+
*/
|
|
2194
|
+
resume: () => Promise<void>;
|
|
2195
|
+
/**
|
|
2196
|
+
* Suspends all active actions.
|
|
2197
|
+
*/
|
|
2198
|
+
suspend: () => Promise<void>;
|
|
2199
|
+
/**
|
|
2200
|
+
* Cancels and deletes the active download.
|
|
2201
|
+
*/
|
|
2202
|
+
cancelDownload: () => Promise<void>;
|
|
2203
|
+
/**
|
|
2204
|
+
* Resolves how many bytes of storage are used by the offline content.
|
|
2205
|
+
*/
|
|
2206
|
+
usedStorage: () => Promise<number>;
|
|
2207
|
+
/**
|
|
2208
|
+
* Deletes everything related to the related content ID.
|
|
2209
|
+
*/
|
|
2210
|
+
deleteAll: () => Promise<void>;
|
|
2211
|
+
/**
|
|
2212
|
+
* Downloads the offline license.
|
|
2213
|
+
* When finished successfully, data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.
|
|
2214
|
+
* Errors are transmitted to the `OfflineContentManagerListener.onError`.
|
|
2215
|
+
*/
|
|
2216
|
+
downloadLicense: () => Promise<void>;
|
|
2217
|
+
/**
|
|
2218
|
+
* Releases the currently held offline license.
|
|
2219
|
+
* When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.
|
|
2220
|
+
* Errors are transmitted to the `OfflineContentManagerListener.onError`.
|
|
2221
|
+
*
|
|
2222
|
+
* @platform Android
|
|
2223
|
+
*/
|
|
2224
|
+
releaseLicense: () => Promise<void>;
|
|
2225
|
+
/**
|
|
2226
|
+
* Renews the already downloaded DRM license.
|
|
2227
|
+
* When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.
|
|
2228
|
+
* Errors are transmitted to the `OfflineContentManagerListener.onError`.
|
|
2229
|
+
*/
|
|
2230
|
+
renewOfflineLicense: () => Promise<void>;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
1868
2233
|
/**
|
|
1869
2234
|
* Object used to configure a new `Player` instance.
|
|
1870
2235
|
*/
|
|
@@ -1908,6 +2273,10 @@ interface PlayerConfig extends NativeInstanceConfig {
|
|
|
1908
2273
|
* Configures analytics functionality.
|
|
1909
2274
|
*/
|
|
1910
2275
|
analyticsConfig?: AnalyticsConfig;
|
|
2276
|
+
/**
|
|
2277
|
+
* Configures adaptation logic.
|
|
2278
|
+
*/
|
|
2279
|
+
adaptationConfig?: AdaptationConfig;
|
|
1911
2280
|
}
|
|
1912
2281
|
/**
|
|
1913
2282
|
* Configures the playback behaviour of the player.
|
|
@@ -2023,6 +2392,10 @@ declare class Player extends NativeInstance<PlayerConfig> {
|
|
|
2023
2392
|
* Loads a new `Source` from `sourceConfig` into the player.
|
|
2024
2393
|
*/
|
|
2025
2394
|
load: (sourceConfig: SourceConfig) => void;
|
|
2395
|
+
/**
|
|
2396
|
+
* Loads the downloaded content from `OfflineContentManager` into the player.
|
|
2397
|
+
*/
|
|
2398
|
+
loadOfflineContent: (offlineContentManager: OfflineContentManager, options?: OfflineSourceOptions) => void;
|
|
2026
2399
|
/**
|
|
2027
2400
|
* Loads the given `Source` into the player.
|
|
2028
2401
|
*/
|
|
@@ -2163,6 +2536,13 @@ declare class Player extends NativeInstance<PlayerConfig> {
|
|
|
2163
2536
|
* `source` is not a live stream or no sources are loaded.
|
|
2164
2537
|
*/
|
|
2165
2538
|
getMaxTimeShift: () => Promise<number>;
|
|
2539
|
+
/**
|
|
2540
|
+
* Sets the upper bitrate boundary for video qualities. All qualities with a bitrate
|
|
2541
|
+
* that is higher than this threshold will not be eligible for automatic quality selection.
|
|
2542
|
+
*
|
|
2543
|
+
* Can be set to `undefined` for no limitation.
|
|
2544
|
+
*/
|
|
2545
|
+
setMaxSelectableBitrate: (bitrate: number | null) => void;
|
|
2166
2546
|
}
|
|
2167
2547
|
|
|
2168
2548
|
/**
|
|
@@ -2270,4 +2650,4 @@ declare function PlayerView({ style, player, fullscreenHandler, customMessageHan
|
|
|
2270
2650
|
*/
|
|
2271
2651
|
declare function usePlayer(config?: PlayerConfig): Player;
|
|
2272
2652
|
|
|
2273
|
-
export { Ad, AdBreak, AdBreakFinishedEvent, AdBreakStartedEvent, AdClickedEvent, AdConfig, AdData, AdErrorEvent, AdFinishedEvent, AdItem, AdManifestLoadEvent, AdManifestLoadedEvent, AdQuartile, AdQuartileEvent, AdScheduledEvent, AdSkippedEvent, AdSource, AdSourceType, AdStartedEvent, AdvertisingConfig, AnalyticsCollector, AnalyticsConfig, AudioAddedEvent, AudioChangedEvent, AudioRemovedEvent, AudioSession, AudioSessionCategory, BasePlayerViewProps, CdnProvider, CustomDataConfig, CustomMessageHandler, DestroyEvent, Drm, DrmConfig, ErrorEvent, Event, EventSource, FairplayConfig, FullscreenDisabledEvent, FullscreenEnabledEvent, FullscreenEnterEvent, FullscreenExitEvent, FullscreenHandler, LoadingState, MutedEvent, PausedEvent, PictureInPictureAvailabilityChangedEvent, PictureInPictureEnterEvent, PictureInPictureEnteredEvent, PictureInPictureExitEvent, PictureInPictureExitedEvent, PlayEvent, PlaybackConfig, PlaybackFinishedEvent, Player, PlayerActiveEvent, PlayerConfig, PlayerErrorEvent, PlayerView, PlayerViewProps, PlayerWarningEvent, PlayingEvent, ReadyEvent, ScalingMode, SeekEvent, SeekedEvent, SideLoadedSubtitleTrack, Source, SourceConfig, SourceErrorEvent, SourceLoadEvent, SourceLoadedEvent, SourceMetadata, SourceType, SourceUnloadedEvent, SourceWarningEvent, StallEndedEvent, StallStartedEvent, StyleConfig, SubtitleAddedEvent, SubtitleChangedEvent, SubtitleFormat, SubtitleRemovedEvent, SubtitleTrack, TimeChangedEvent, TimeShiftEvent, TimeShiftedEvent, UnmutedEvent, UserInterfaceType, VideoPlaybackQualityChangedEvent, WidevineConfig, usePlayer };
|
|
2653
|
+
export { Ad, AdBreak, AdBreakFinishedEvent, AdBreakStartedEvent, AdClickedEvent, AdConfig, AdData, AdErrorEvent, AdFinishedEvent, AdItem, AdManifestLoadEvent, AdManifestLoadedEvent, AdQuartile, AdQuartileEvent, AdScheduledEvent, AdSkippedEvent, AdSource, AdSourceType, AdStartedEvent, AdaptationConfig, AdvertisingConfig, AnalyticsCollector, AnalyticsConfig, AudioAddedEvent, AudioChangedEvent, AudioRemovedEvent, AudioSession, AudioSessionCategory, BasePlayerViewProps, BitmovinNativeOfflineEventData, CdnProvider, CustomDataConfig, CustomMessageHandler, DestroyEvent, Drm, DrmConfig, ErrorEvent, Event, EventSource, FairplayConfig, FullscreenDisabledEvent, FullscreenEnabledEvent, FullscreenEnterEvent, FullscreenExitEvent, FullscreenHandler, LoadingState, MutedEvent, OfflineContentConfig, OfflineContentManager, OfflineContentManagerListener, OfflineContentOptionEntry, OfflineContentOptions, OfflineDownloadRequest, OfflineEvent, OfflineEventType, OfflineSourceOptions, OfflineState, OnCanceledEvent, OnCompletedEvent, OnDrmLicenseExpiredEvent, OnDrmLicenseUpdatedEvent, OnErrorEvent, OnOptionsAvailableEvent, OnProgressEvent, OnResumedEvent, OnSuspendedEvent, PausedEvent, PictureInPictureAvailabilityChangedEvent, PictureInPictureEnterEvent, PictureInPictureEnteredEvent, PictureInPictureExitEvent, PictureInPictureExitedEvent, PlayEvent, PlaybackConfig, PlaybackFinishedEvent, Player, PlayerActiveEvent, PlayerConfig, PlayerErrorEvent, PlayerView, PlayerViewProps, PlayerWarningEvent, PlayingEvent, ReadyEvent, ScalingMode, SeekEvent, SeekedEvent, SideLoadedSubtitleTrack, Source, SourceConfig, SourceErrorEvent, SourceLoadEvent, SourceLoadedEvent, SourceMetadata, SourceOptions, SourceType, SourceUnloadedEvent, SourceWarningEvent, StallEndedEvent, StallStartedEvent, StyleConfig, SubtitleAddedEvent, SubtitleChangedEvent, SubtitleFormat, SubtitleRemovedEvent, SubtitleTrack, TimeChangedEvent, TimeShiftEvent, TimeShiftedEvent, TimelineReferencePoint, UnmutedEvent, UserInterfaceType, VideoPlaybackQualityChangedEvent, WidevineConfig, handleBitmovinNativeOfflineEvent, usePlayer };
|