bitmovin-player-react-native 1.9.0 → 1.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.
Files changed (79) hide show
  1. package/.eslintrc.js +11 -0
  2. package/CHANGELOG.md +25 -0
  3. package/android/build.gradle +2 -2
  4. package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerViewManager.kt +35 -1
  5. package/android/src/main/java/com/bitmovin/player/reactnative/converter/JsonConverter.kt +47 -28
  6. package/build/advertising.d.ts +3 -3
  7. package/build/advertising.js.map +1 -1
  8. package/build/components/PlayerView/events.d.ts +7 -1
  9. package/build/components/PlayerView/events.d.ts.map +1 -1
  10. package/build/components/PlayerView/events.js.map +1 -1
  11. package/build/components/PlayerView/index.d.ts.map +1 -1
  12. package/build/components/PlayerView/index.js +3 -3
  13. package/build/components/PlayerView/index.js.map +1 -1
  14. package/build/components/PlayerView/nativeEvents.d.ts +9 -1
  15. package/build/components/PlayerView/nativeEvents.d.ts.map +1 -1
  16. package/build/components/PlayerView/nativeEvents.js.map +1 -1
  17. package/build/drm/fairplayDrmApi.d.ts +21 -0
  18. package/build/drm/fairplayDrmApi.d.ts.map +1 -0
  19. package/build/drm/fairplayDrmApi.js +30 -0
  20. package/build/drm/fairplayDrmApi.js.map +1 -0
  21. package/build/drm/index.d.ts +9 -1
  22. package/build/drm/index.d.ts.map +1 -1
  23. package/build/drm/index.js +13 -0
  24. package/build/drm/index.js.map +1 -1
  25. package/build/events.d.ts +37 -3
  26. package/build/events.d.ts.map +1 -1
  27. package/build/events.js.map +1 -1
  28. package/build/metadata.d.ts.map +1 -1
  29. package/build/metadata.js.map +1 -1
  30. package/build/modules/SourceModule.d.ts +6 -0
  31. package/build/modules/SourceModule.d.ts.map +1 -1
  32. package/build/modules/SourceModule.js.map +1 -1
  33. package/build/network/index.js +4 -12
  34. package/build/network/index.js.map +1 -1
  35. package/build/offline/offlineContentManager.js +1 -1
  36. package/build/offline/offlineContentManager.js.map +1 -1
  37. package/build/offline/offlineContentManagerListener.d.ts.map +1 -1
  38. package/build/offline/offlineContentManagerListener.js.map +1 -1
  39. package/build/player.js +24 -24
  40. package/build/player.js.map +1 -1
  41. package/build/source.d.ts +6 -3
  42. package/build/source.d.ts.map +1 -1
  43. package/build/source.js +8 -5
  44. package/build/source.js.map +1 -1
  45. package/build/tweaksConfig.d.ts +8 -0
  46. package/build/tweaksConfig.d.ts.map +1 -1
  47. package/build/tweaksConfig.js.map +1 -1
  48. package/build/ui/custommessagehandlerbridge.d.ts.map +1 -1
  49. package/build/ui/custommessagehandlerbridge.js +4 -4
  50. package/build/ui/custommessagehandlerbridge.js.map +1 -1
  51. package/build/ui/fullscreenhandlerbridge.js +5 -5
  52. package/build/ui/fullscreenhandlerbridge.js.map +1 -1
  53. package/ios/Event+JSON.swift +20 -1
  54. package/ios/FairplayContentKeyRequestRegistry.swift +39 -0
  55. package/ios/NetworkModule.swift +1 -0
  56. package/ios/PlayerModule.swift +3 -3
  57. package/ios/RCTConvert+BitmovinPlayer.swift +1 -0
  58. package/ios/RNBitmovinPlayer.podspec +1 -1
  59. package/ios/RNPlayerView.swift +5 -0
  60. package/ios/RNPlayerViewManager.swift +2 -1
  61. package/ios/SourceModule.swift +24 -0
  62. package/package.json +2 -2
  63. package/src/advertising.ts +3 -3
  64. package/src/components/PlayerView/events.ts +7 -0
  65. package/src/components/PlayerView/index.tsx +3 -2
  66. package/src/components/PlayerView/nativeEvents.ts +9 -0
  67. package/src/drm/fairplayDrmApi.ts +36 -0
  68. package/src/drm/index.ts +14 -2
  69. package/src/events.ts +40 -3
  70. package/src/metadata.ts +2 -4
  71. package/src/modules/SourceModule.ts +10 -0
  72. package/src/network/index.ts +12 -12
  73. package/src/offline/offlineContentManager.ts +1 -1
  74. package/src/offline/offlineContentManagerListener.ts +3 -6
  75. package/src/player.ts +24 -24
  76. package/src/source.ts +9 -6
  77. package/src/tweaksConfig.ts +8 -0
  78. package/src/ui/custommessagehandlerbridge.ts +7 -4
  79. package/src/ui/fullscreenhandlerbridge.ts +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAmDX;AAnDD,WAAY,YAAY;IACtB;;;;;;;OAOG;IACH,2BAAW,CAAA;IACX;;;;;;;;;;OAUG;IACH,6BAAa,CAAA;IACb;;;;;;;OAOG;IACH,6BAAa,CAAA;IACb;;;;;;;OAOG;IACH,uCAAuB,CAAA;IACvB;;;;;;;;;OASG;IACH,oCAAoB,CAAA;AACtB,CAAC,EAnDW,YAAY,KAAZ,YAAY,QAmDvB;AA0iBD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAuB,EACvB,SAAY;IAEZ,OAAO,KAAK,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC;AACvE,CAAC","sourcesContent":["import { TimeRange, Seconds, Milliseconds } from './utils/temporal';\n\n/**\n * Enumerates all supported types of timed metadata entries.\n *\n * @see {@link MetadataEntry} for the full type narrowing documentation\n */\nexport enum MetadataType {\n /**\n * ID3 metadata embedded in the media stream.\n *\n * Used for timed ID3 tags such as text frames, comments, artwork,\n * chapters, private frames, and other ID3v2 structures.\n *\n * @see {@link Id3MetadataEntry}\n */\n ID3 = 'ID3',\n /**\n * Event Message metadata as defined in ISO/IEC 23009-1.\n *\n * Represents MP4 Event Message boxes (`emsg`) or DASH `EventStream`\n * events carrying an application- or spec-defined payload.\n *\n * @platform Android\n * @remarks This metadata type is never emitted on iOS or tvOS, as the native\n * player does not surface EMSG events on those platforms.\n * @see {@link EventMessageMetadataEntry}\n */\n EMSG = 'EMSG',\n /**\n * SCTE-35 signaling extracted from HLS `#EXT-X-SCTE35` tags.\n *\n * Typically used for ad insertion, blackout signaling, or other\n * broadcast-style cue messages.\n *\n * @see {@link ScteMetadataEntry}\n */\n SCTE = 'SCTE',\n /**\n * HLS `#EXT-X-DATERANGE` tags representing timed opportunities or annotations.\n *\n * Used for in-playlist markers such as interstitial opportunities,\n * blackout windows, content labels, or other time-bounded ranges.\n *\n * @see {@link DateRangeMetadataEntry}\n */\n DATERANGE = 'DATERANGE',\n /**\n * Sentinel type for unsupported metadata.\n *\n * This value indicates that the underlying native player reported timed metadata\n * at some point in the stream, but the React Native SDK does not yet map it to\n * one of the supported metadata entry types of ({@link ID3}, {@link SCTE},\n * {@link DATERANGE}, or {@link EMSG}).\n *\n * @see {@link UnsupportedMetadataEntry}\n */\n Unsupported = 'NONE',\n}\n\n/**\n * Raw data encoded as Base64 with no `data:...;base64,` prefix.\n *\n * Use this type whenever the value is just the Base64 string itself, not a full\n * data URI string.\n *\n * @example\n * // Correct format:\n * \"SGVsbG8gV29ybGQ=\"\n *\n * @example\n * // Incorrect (includes a data URI scheme — not allowed):\n * \"data:text/plain;base64,SGVsbG8gV29ybGQ=\"\n */\nexport type Base64Raw = string;\nexport type CueingOption = 'PRE' | 'POST' | 'ONCE';\n\ninterface BaseDateRangeMetadataEntry<TPlatform extends 'ios' | 'android'> {\n metadataType: MetadataType.DATERANGE;\n /**\n * Platform discriminator for TypeScript type narrowing.\n */\n platform: TPlatform;\n /**\n * The unique identifier for the date range.\n */\n id: string;\n /**\n * The class associated with the date range.\n */\n classLabel?: string;\n /**\n * The declared duration of the range in seconds.\n */\n duration?: Seconds;\n /**\n * All the attributes associated with the date range.\n *\n * @example \"X-ASSET-URI\": \"https://www.example.com\"\n */\n attributes: Record<string, string>;\n}\n\n/**\n * Represents in-playlist timed metadata from an HLS `#EXT-X-DATERANGE` tag.\n *\n * @platform Android\n */\nexport interface AndroidDateRangeMetadataEntry\n extends BaseDateRangeMetadataEntry<'android'> {\n /**\n * Time range of the entry relative to the beginning of the playback, in seconds.\n */\n relativeTimeRange: TimeRange<Seconds>;\n /**\n * The planned duration of the range in seconds.\n *\n * Used for live streams where the actual end time may not be known yet.\n */\n plannedDuration?: Seconds;\n /**\n * Indicates whether the date range ends at the start of the next date range\n * with the same {@link classLabel}.\n */\n endOnNext: boolean;\n}\n\n/**\n * Represents in-playlist timed metadata from an HLS `#EXT-X-DATERANGE` tag.\n *\n * @platform iOS, tvOS\n */\nexport interface IosDateRangeMetadataEntry\n extends BaseDateRangeMetadataEntry<'ios'> {\n /**\n * Time range of the entry relative to Unix Epoch, in seconds.\n *\n * If the metadata represents an instantaneous event, {@link TimeRange.end} should be equal\n * to {@link TimeRange.start}.\n * An omitted {@link TimeRange.end} indicates an open-ended range.\n */\n absoluteTimeRange: TimeRange<Seconds>;\n /**\n * The `CUE` attribute values from an `#EXT-X-DATERANGE` tag.\n *\n * Empty array if the attribute is not present.\n * `\"PRE\"` triggers before playback; `\"POST\"` triggers after completion; `\"ONCE\"` limits triggering to once.\n * When multiple values are provided, the first takes precedence (e.g., `\"PRE,POST\"` -> `\"PRE\"`).\n * `\"PRE\"` and `\"POST\"` are re-playable unless `\"ONCE\"` is included.\n *\n * @remarks Applies only to HLS Interstitial opportunities (pre-, mid-, post-roll).\n */\n cueingOptions: CueingOption[];\n}\n\n/**\n * Represents Event Message metadata according to ISO 23009-1.\n *\n * This is used for both MP4 Event Message boxes (`emsg`) and DASH EventStream events.\n *\n * @platform Android\n */\nexport interface EventMessageMetadataEntry {\n metadataType: MetadataType.EMSG;\n /** The instance identifier for this specific event occurrence. */\n id: number;\n /** The duration of the event in seconds. */\n duration?: Seconds;\n /**\n * Raw event message payload encoded as Base64 with no `data:...;base64,` prefix.\n */\n messageData: Base64Raw;\n /**\n * The message scheme URI identifying the event type.\n *\n * @example \"urn:mpeg:dash:event:callback:2014\"\n */\n schemeIdUri: string;\n /** The value for the event. */\n value: string;\n}\n\n/**\n * Typed representations of an iOS metadata value.\n *\n * Depending on the underlying value, one or more of these fields may be present;\n * others will be `undefined`.\n */\nexport interface IosMetadataValue {\n /**\n * A text representation of the value, if available.\n */\n stringValue?: string;\n /**\n * A numeric representation of the value, if available.\n */\n numberValue?: number;\n /**\n * A date/time representation of the value, formatted as an ISO 8601 string, if available.\n *\n * @example \"2025-12-02T00:00:00Z\"\n */\n dateValue?: string;\n /**\n * A binary representation of the value as Base64 data\n * with no `data:...;base64,` prefix, if available.\n *\n * @remarks Use this accessor to retrieve encapsulated artwork, thumbnails,\n * proprietary frames, or any encoded value.\n */\n dataValue?: Base64Raw;\n}\n\n/**\n * iOS representation of ID3 metadata items.\n *\n * @platform iOS, tvOS\n */\nexport interface IosId3Frame {\n metadataType: MetadataType.ID3;\n /**\n * Platform discriminator for TypeScript type narrowing.\n */\n platform: 'ios';\n /**\n * ID3 frame identifier.\n *\n * @example \"TXXX\"\n */\n id?: string;\n /**\n * String representation of the metadata value.\n *\n * The underlying value is first interpreted as the most appropriate type\n * (date, number, text, or binary data) and then converted to a string.\n * - Dates are formatted as ISO 8601 strings (e.g. \"2025-12-02T00:00:00Z\").\n * - Binary data is encoded as a Base64 with no `data:...;base64,` prefix.\n *\n * This will be `undefined` if the value cannot be interpreted.\n */\n value?: string;\n /**\n * Full typed representation of the underlying value as reported by iOS.\n */\n rawValue?: IosMetadataValue;\n /**\n * Time range of the entry relative to the beginning of the playback, in seconds.\n */\n relativeTimeRange?: TimeRange<Seconds>;\n /**\n * The duration of the metadata item in seconds.\n */\n duration?: Seconds;\n /**\n * The IETF BCP 47 language identifier of the metadata item.\n */\n extendedLanguageTag?: string;\n /**\n * Additional attributes attached to the metadata item.\n */\n extraAttributes?: Record<string, unknown>;\n}\n\n/**\n * Base interface for all Android ID3 frames.\n *\n * @platform Android\n */\ninterface AndroidId3FrameBase {\n metadataType: MetadataType.ID3;\n /**\n * Platform discriminator for TypeScript type narrowing.\n */\n platform: 'android';\n /**\n * ID3 frame identifier.\n *\n * @example \"TXXX\"\n */\n id: string;\n}\n\n/**\n * Stores text-based metadata.\n *\n * @platform Android\n */\nexport interface AndroidTextInformationFrame extends AndroidId3FrameBase {\n frameType: 'text';\n description?: string;\n value: string;\n}\n\n/**\n * Encapsulates an ID3 frame whose payload is treated as opaque binary data.\n *\n * @platform Android\n */\nexport interface AndroidBinaryFrame extends AndroidId3FrameBase {\n frameType: 'binary';\n /** Raw frame payload encoded as Base64 data with no `data:...;base64,` prefix. */\n data: Base64Raw;\n}\n\n/**\n * Encapsulates an attached picture.\n *\n * @platform Android\n */\nexport interface AndroidApicFrame extends AndroidId3FrameBase {\n frameType: 'apic';\n /**\n * MIME type of the embedded image as stored in the APIC frame.\n *\n * @example \"image/jpeg\"\n */\n mimeType: string;\n description?: string;\n /**\n * Picture type as defined by the ID3 specification.\n *\n * @example 3 // front cover\n */\n pictureType: number;\n /** Raw image data encoded as Base64 data with no `data:...;base64,` prefix. */\n pictureData: Base64Raw;\n}\n\n/**\n * Stores an external resource via URL.\n *\n * @platform Android\n */\nexport interface AndroidUrlLinkFrame extends AndroidId3FrameBase {\n frameType: 'url';\n description?: string;\n url: string;\n}\n\n/**\n * Stores user comments or notes.\n *\n * @platform Android\n */\nexport interface AndroidCommentFrame extends AndroidId3FrameBase {\n frameType: 'comment';\n language: string;\n description: string;\n /** The comment text. */\n text: string;\n}\n\n/**\n * Encapsulates owner-specific private data.\n *\n * The structure and semantics of the payload are defined solely by the `owner`\n * identifier and are opaque to generic parsers.\n *\n * @platform Android\n */\nexport interface AndroidPrivFrame extends AndroidId3FrameBase {\n frameType: 'priv';\n /**\n * Owner identifier string.\n *\n * Typically a reverse-DNS or application-specific identifier.\n *\n * @example \"com.example.app\"\n */\n owner: string;\n /**\n * Raw private payload encoded as Base64 data with no `data:...;base64,` prefix.\n *\n * Consumers should only attempt to interpret this data if they recognize\n * and understand the corresponding {@link owner} value.\n */\n privateData: Base64Raw;\n}\n\n/**\n * Encapsulates arbitrary binary objects with metadata.\n *\n * @platform Android\n */\nexport interface AndroidGeobFrame extends AndroidId3FrameBase {\n frameType: 'geob';\n /**\n * MIME type of the encapsulated object.\n *\n * @example \"application/octet-stream\"\n */\n mimeType: string;\n /** Original filename of the object. */\n filename: string;\n description: string;\n /**\n * Raw object encoded as Base64 data with no `data:...;base64,` prefix.\n */\n data: Base64Raw;\n}\n\n/**\n * Defines a content chapter.\n *\n * @platform Android\n */\nexport interface AndroidChapterFrame extends AndroidId3FrameBase {\n frameType: 'chapter';\n /** Identifier of the chapter element. */\n chapterId: string;\n /** Time range of the chapter in milliseconds. */\n timeRange: TimeRange<Milliseconds>;\n /** The byte offset of the start of the chapter, or `-1` if not set. */\n startOffset: number;\n /** The byte offset of the end of the chapter, or `-1` if not set. */\n endOffset: number;\n /**\n * Nested ID3 subframes associated with this chapter (e.g. title, URL, etc.).\n */\n subFrames: AndroidId3Frame[];\n}\n\n/**\n * Defines hierarchical chapter structure.\n *\n * @platform Android\n */\nexport interface AndroidChapterTocFrame extends AndroidId3FrameBase {\n frameType: 'chapterToc';\n /** Identifier of the table-of-contents element. */\n elementId: string;\n /** Whether this element is the root of the chapter tree. */\n isRoot: boolean;\n /** Whether the listed children are ordered. */\n isOrdered: boolean;\n /** IDs of child chapter or TOC elements. */\n children: string[];\n /**\n * Nested ID3 subframes associated with this TOC element.\n */\n subFrames: AndroidId3Frame[];\n}\n\n/**\n * Android representation of ID3 metadata items.\n *\n * This is a discriminated union of Android ID3 frame types. Use {@link isAndroidId3Frame}\n * for type-safe narrowing to specific frame types.\n *\n * @platform Android\n * @see {@link isAndroidId3Frame} for frame type narrowing\n */\nexport type AndroidId3Frame =\n | AndroidTextInformationFrame\n | AndroidBinaryFrame\n | AndroidApicFrame\n | AndroidUrlLinkFrame\n | AndroidCommentFrame\n | AndroidPrivFrame\n | AndroidGeobFrame\n | AndroidChapterFrame\n | AndroidChapterTocFrame;\n\n/**\n * Describes metadata associated with ID3 tags.\n *\n * This is a discriminated union over the `platform` field:\n *\n * - `\"ios\"`: {@link IosId3Frame}\n * - `\"android\"`: {@link AndroidId3Frame}\n *\n * Narrowing on `platform` gives you access to the platform-specific fields.\n */\nexport type Id3MetadataEntry = IosId3Frame | AndroidId3Frame;\n\n/**\n * Describes metadata associated with HLS `#EXT-X-SCTE35` tags.\n *\n * @remarks On iOS, {@link TweaksConfig.isNativeHlsParsingEnabled} must be enabled\n * to parse this type of metadata.\n */\nexport interface ScteMetadataEntry {\n metadataType: MetadataType.SCTE;\n /**\n * The attribute name/key from the SCTE-35 tag.\n */\n key: string;\n /**\n * The attribute value (nullable for key-only attributes).\n */\n value?: string;\n}\n\n/**\n * Metadata entry for unsupported metadata types.\n *\n * This type is emitted when the native player reports timed metadata that\n * this SDK cannot attach to one of the supported types:\n * - iOS: metadata that is not exposed as ID3, SCTE, or DATERANGE\n * - Android: metadata that is not exposed as ID3, SCTE, DATERANGE, or EMSG\n */\nexport interface UnsupportedMetadataEntry {\n metadataType: MetadataType.Unsupported;\n /** The platform that reported the unsupported metadata. */\n platform: 'ios' | 'android';\n}\n\n/**\n * Represents in-playlist timed metadata from an HLS `#EXT-X-DATERANGE` tag.\n *\n * This is a discriminated union over the `platform` field:\n *\n * - `\"ios\"`: {@link IosDateRangeMetadataEntry}\n * - `\"android\"`: {@link AndroidDateRangeMetadataEntry}\n *\n * Narrowing on `platform` gives you access to the platform-specific fields.\n */\nexport type DateRangeMetadataEntry =\n | IosDateRangeMetadataEntry\n | AndroidDateRangeMetadataEntry;\n\n/**\n * Union type representing all supported timed metadata entry kinds.\n *\n * This is a discriminated union over the `metadataType` field:\n *\n * - {@link MetadataType.ID3}: {@link Id3MetadataEntry}\n * - {@link MetadataType.DATERANGE}: {@link DateRangeMetadataEntry}\n * - {@link MetadataType.SCTE}: {@link ScteMetadataEntry}\n * - {@link MetadataType.EMSG}: {@link EventMessageMetadataEntry}\n * - {@link MetadataType.Unsupported}: {@link UnsupportedMetadataEntry}\n *\n * Branching on `metadataType` using an `if`/`switch` statement narrows the type and\n * gives access to entry-specific fields.\n *\n * @example\n * ```ts\n * function handleMetadata(entry: MetadataEntry) {\n * switch (entry.metadataType) {\n * case MetadataType.DATERANGE:\n * // `entry` is a DateRangeMetadataEntry\n * if (entry.platform === 'android') {\n * // `entry` is now an AndroidDateRangeMetadataEntry\n * console.log('End on next:', entry.endOnNext);\n * } else {\n * // `entry` is now an IosDateRangeMetadataEntry\n * console.log('Cueing options:', entry.cueingOptions);\n * }\n * break;\n *\n * case MetadataType.SCTE:\n * // `entry` is a ScteMetadataEntry\n * console.log('SCTE key:', entry.key, 'value:', entry.value);\n * break;\n *\n * case MetadataType.ID3:\n * // `entry` is an Id3MetadataEntry\n * if (entry.platform === 'android') {\n * // `entry` is now an AndroidId3Frame\n * console.log('Frame type:', entry.frameType);\n * // Further narrow down on the frame type\n * if (entry.frameType == 'apic') {\n * console.log('APIC frame mimeType: ', entry.mimeType)\n * }\n * } else {\n * // `entry` is now an IosId3Frame\n * console.log('Frame ID:', entry.id, 'Value:', entry.value);\n * }\n * // Or use isAndroidId3Frame to directly narrow to specific Android frame\n * if (isAndroidId3Frame(entry, 'text')) {\n * console.log('Text frame:', entry.value);\n * }\n * break;\n *\n * case MetadataType.EMSG:\n * // `entry` is an EventMessageMetadataEntry (Android only)\n * console.log('EMSG data:', entry.messageData);\n * break;\n *\n * case MetadataType.Unsupported:\n * // `entry` is an UnsupportedMetadataEntry\n * console.warn('Unsupported metadata encountered from: ', entry.platform)\n * break;\n * }\n * }\n * ```\n */\nexport type MetadataEntry =\n | DateRangeMetadataEntry\n | EventMessageMetadataEntry\n | Id3MetadataEntry\n | ScteMetadataEntry\n | UnsupportedMetadataEntry;\n\n/**\n * A collection of timed metadata entries of the same type.\n *\n * All entries in the collection share the same `metadataType`.\n */\nexport interface MetadataCollection<T extends MetadataEntry> {\n /**\n * The playback time in seconds when this metadata should trigger, relative to the playback session.\n */\n startTime?: Seconds;\n /**\n * The metadata entries.\n *\n * The group is homogeneous: all entries share the same metadata type.\n */\n entries: T[];\n}\n\n/**\n * Type-safe narrowing helper for Android ID3 frame types.\n *\n * Android ID3 frames have 9 distinct frame types (text, binary, apic, url, comment,\n * priv, geob, chapter, chapterToc), each with different fields. This helper provides\n * type-safe access to frame-specific properties.\n *\n * @param entry - The ID3 metadata entry to check\n * @param frameType - The Android frame type to narrow to\n * @returns `true` if entry is an Android frame of the specified type\n *\n * @see {@link MetadataEntry} for the full type narrowing documentation\n */\nexport function isAndroidId3Frame<T extends AndroidId3Frame['frameType']>(\n entry: Id3MetadataEntry,\n frameType: T\n): entry is Extract<AndroidId3Frame, { frameType: T }> {\n return entry.platform === 'android' && entry.frameType === frameType;\n}\n"]}
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAmDX;AAnDD,WAAY,YAAY;IACtB;;;;;;;OAOG;IACH,2BAAW,CAAA;IACX;;;;;;;;;;OAUG;IACH,6BAAa,CAAA;IACb;;;;;;;OAOG;IACH,6BAAa,CAAA;IACb;;;;;;;OAOG;IACH,uCAAuB,CAAA;IACvB;;;;;;;;;OASG;IACH,oCAAoB,CAAA;AACtB,CAAC,EAnDW,YAAY,KAAZ,YAAY,QAmDvB;AAwiBD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAuB,EACvB,SAAY;IAEZ,OAAO,KAAK,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC;AACvE,CAAC","sourcesContent":["import { TimeRange, Seconds, Milliseconds } from './utils/temporal';\n\n/**\n * Enumerates all supported types of timed metadata entries.\n *\n * @see {@link MetadataEntry} for the full type narrowing documentation\n */\nexport enum MetadataType {\n /**\n * ID3 metadata embedded in the media stream.\n *\n * Used for timed ID3 tags such as text frames, comments, artwork,\n * chapters, private frames, and other ID3v2 structures.\n *\n * @see {@link Id3MetadataEntry}\n */\n ID3 = 'ID3',\n /**\n * Event Message metadata as defined in ISO/IEC 23009-1.\n *\n * Represents MP4 Event Message boxes (`emsg`) or DASH `EventStream`\n * events carrying an application- or spec-defined payload.\n *\n * @platform Android\n * @remarks This metadata type is never emitted on iOS or tvOS, as the native\n * player does not surface EMSG events on those platforms.\n * @see {@link EventMessageMetadataEntry}\n */\n EMSG = 'EMSG',\n /**\n * SCTE-35 signaling extracted from HLS `#EXT-X-SCTE35` tags.\n *\n * Typically used for ad insertion, blackout signaling, or other\n * broadcast-style cue messages.\n *\n * @see {@link ScteMetadataEntry}\n */\n SCTE = 'SCTE',\n /**\n * HLS `#EXT-X-DATERANGE` tags representing timed opportunities or annotations.\n *\n * Used for in-playlist markers such as interstitial opportunities,\n * blackout windows, content labels, or other time-bounded ranges.\n *\n * @see {@link DateRangeMetadataEntry}\n */\n DATERANGE = 'DATERANGE',\n /**\n * Sentinel type for unsupported metadata.\n *\n * This value indicates that the underlying native player reported timed metadata\n * at some point in the stream, but the React Native SDK does not yet map it to\n * one of the supported metadata entry types of ({@link ID3}, {@link SCTE},\n * {@link DATERANGE}, or {@link EMSG}).\n *\n * @see {@link UnsupportedMetadataEntry}\n */\n Unsupported = 'NONE',\n}\n\n/**\n * Raw data encoded as Base64 with no `data:...;base64,` prefix.\n *\n * Use this type whenever the value is just the Base64 string itself, not a full\n * data URI string.\n *\n * @example\n * // Correct format:\n * \"SGVsbG8gV29ybGQ=\"\n *\n * @example\n * // Incorrect (includes a data URI scheme — not allowed):\n * \"data:text/plain;base64,SGVsbG8gV29ybGQ=\"\n */\nexport type Base64Raw = string;\nexport type CueingOption = 'PRE' | 'POST' | 'ONCE';\n\ninterface BaseDateRangeMetadataEntry<TPlatform extends 'ios' | 'android'> {\n metadataType: MetadataType.DATERANGE;\n /**\n * Platform discriminator for TypeScript type narrowing.\n */\n platform: TPlatform;\n /**\n * The unique identifier for the date range.\n */\n id: string;\n /**\n * The class associated with the date range.\n */\n classLabel?: string;\n /**\n * The declared duration of the range in seconds.\n */\n duration?: Seconds;\n /**\n * All the attributes associated with the date range.\n *\n * @example \"X-ASSET-URI\": \"https://www.example.com\"\n */\n attributes: Record<string, string>;\n}\n\n/**\n * Represents in-playlist timed metadata from an HLS `#EXT-X-DATERANGE` tag.\n *\n * @platform Android\n */\nexport interface AndroidDateRangeMetadataEntry extends BaseDateRangeMetadataEntry<'android'> {\n /**\n * Time range of the entry relative to the beginning of the playback, in seconds.\n */\n relativeTimeRange: TimeRange<Seconds>;\n /**\n * The planned duration of the range in seconds.\n *\n * Used for live streams where the actual end time may not be known yet.\n */\n plannedDuration?: Seconds;\n /**\n * Indicates whether the date range ends at the start of the next date range\n * with the same {@link classLabel}.\n */\n endOnNext: boolean;\n}\n\n/**\n * Represents in-playlist timed metadata from an HLS `#EXT-X-DATERANGE` tag.\n *\n * @platform iOS, tvOS\n */\nexport interface IosDateRangeMetadataEntry extends BaseDateRangeMetadataEntry<'ios'> {\n /**\n * Time range of the entry relative to Unix Epoch, in seconds.\n *\n * If the metadata represents an instantaneous event, {@link TimeRange.end} should be equal\n * to {@link TimeRange.start}.\n * An omitted {@link TimeRange.end} indicates an open-ended range.\n */\n absoluteTimeRange: TimeRange<Seconds>;\n /**\n * The `CUE` attribute values from an `#EXT-X-DATERANGE` tag.\n *\n * Empty array if the attribute is not present.\n * `\"PRE\"` triggers before playback; `\"POST\"` triggers after completion; `\"ONCE\"` limits triggering to once.\n * When multiple values are provided, the first takes precedence (e.g., `\"PRE,POST\"` -> `\"PRE\"`).\n * `\"PRE\"` and `\"POST\"` are re-playable unless `\"ONCE\"` is included.\n *\n * @remarks Applies only to HLS Interstitial opportunities (pre-, mid-, post-roll).\n */\n cueingOptions: CueingOption[];\n}\n\n/**\n * Represents Event Message metadata according to ISO 23009-1.\n *\n * This is used for both MP4 Event Message boxes (`emsg`) and DASH EventStream events.\n *\n * @platform Android\n */\nexport interface EventMessageMetadataEntry {\n metadataType: MetadataType.EMSG;\n /** The instance identifier for this specific event occurrence. */\n id: number;\n /** The duration of the event in seconds. */\n duration?: Seconds;\n /**\n * Raw event message payload encoded as Base64 with no `data:...;base64,` prefix.\n */\n messageData: Base64Raw;\n /**\n * The message scheme URI identifying the event type.\n *\n * @example \"urn:mpeg:dash:event:callback:2014\"\n */\n schemeIdUri: string;\n /** The value for the event. */\n value: string;\n}\n\n/**\n * Typed representations of an iOS metadata value.\n *\n * Depending on the underlying value, one or more of these fields may be present;\n * others will be `undefined`.\n */\nexport interface IosMetadataValue {\n /**\n * A text representation of the value, if available.\n */\n stringValue?: string;\n /**\n * A numeric representation of the value, if available.\n */\n numberValue?: number;\n /**\n * A date/time representation of the value, formatted as an ISO 8601 string, if available.\n *\n * @example \"2025-12-02T00:00:00Z\"\n */\n dateValue?: string;\n /**\n * A binary representation of the value as Base64 data\n * with no `data:...;base64,` prefix, if available.\n *\n * @remarks Use this accessor to retrieve encapsulated artwork, thumbnails,\n * proprietary frames, or any encoded value.\n */\n dataValue?: Base64Raw;\n}\n\n/**\n * iOS representation of ID3 metadata items.\n *\n * @platform iOS, tvOS\n */\nexport interface IosId3Frame {\n metadataType: MetadataType.ID3;\n /**\n * Platform discriminator for TypeScript type narrowing.\n */\n platform: 'ios';\n /**\n * ID3 frame identifier.\n *\n * @example \"TXXX\"\n */\n id?: string;\n /**\n * String representation of the metadata value.\n *\n * The underlying value is first interpreted as the most appropriate type\n * (date, number, text, or binary data) and then converted to a string.\n * - Dates are formatted as ISO 8601 strings (e.g. \"2025-12-02T00:00:00Z\").\n * - Binary data is encoded as a Base64 with no `data:...;base64,` prefix.\n *\n * This will be `undefined` if the value cannot be interpreted.\n */\n value?: string;\n /**\n * Full typed representation of the underlying value as reported by iOS.\n */\n rawValue?: IosMetadataValue;\n /**\n * Time range of the entry relative to the beginning of the playback, in seconds.\n */\n relativeTimeRange?: TimeRange<Seconds>;\n /**\n * The duration of the metadata item in seconds.\n */\n duration?: Seconds;\n /**\n * The IETF BCP 47 language identifier of the metadata item.\n */\n extendedLanguageTag?: string;\n /**\n * Additional attributes attached to the metadata item.\n */\n extraAttributes?: Record<string, unknown>;\n}\n\n/**\n * Base interface for all Android ID3 frames.\n *\n * @platform Android\n */\ninterface AndroidId3FrameBase {\n metadataType: MetadataType.ID3;\n /**\n * Platform discriminator for TypeScript type narrowing.\n */\n platform: 'android';\n /**\n * ID3 frame identifier.\n *\n * @example \"TXXX\"\n */\n id: string;\n}\n\n/**\n * Stores text-based metadata.\n *\n * @platform Android\n */\nexport interface AndroidTextInformationFrame extends AndroidId3FrameBase {\n frameType: 'text';\n description?: string;\n value: string;\n}\n\n/**\n * Encapsulates an ID3 frame whose payload is treated as opaque binary data.\n *\n * @platform Android\n */\nexport interface AndroidBinaryFrame extends AndroidId3FrameBase {\n frameType: 'binary';\n /** Raw frame payload encoded as Base64 data with no `data:...;base64,` prefix. */\n data: Base64Raw;\n}\n\n/**\n * Encapsulates an attached picture.\n *\n * @platform Android\n */\nexport interface AndroidApicFrame extends AndroidId3FrameBase {\n frameType: 'apic';\n /**\n * MIME type of the embedded image as stored in the APIC frame.\n *\n * @example \"image/jpeg\"\n */\n mimeType: string;\n description?: string;\n /**\n * Picture type as defined by the ID3 specification.\n *\n * @example 3 // front cover\n */\n pictureType: number;\n /** Raw image data encoded as Base64 data with no `data:...;base64,` prefix. */\n pictureData: Base64Raw;\n}\n\n/**\n * Stores an external resource via URL.\n *\n * @platform Android\n */\nexport interface AndroidUrlLinkFrame extends AndroidId3FrameBase {\n frameType: 'url';\n description?: string;\n url: string;\n}\n\n/**\n * Stores user comments or notes.\n *\n * @platform Android\n */\nexport interface AndroidCommentFrame extends AndroidId3FrameBase {\n frameType: 'comment';\n language: string;\n description: string;\n /** The comment text. */\n text: string;\n}\n\n/**\n * Encapsulates owner-specific private data.\n *\n * The structure and semantics of the payload are defined solely by the `owner`\n * identifier and are opaque to generic parsers.\n *\n * @platform Android\n */\nexport interface AndroidPrivFrame extends AndroidId3FrameBase {\n frameType: 'priv';\n /**\n * Owner identifier string.\n *\n * Typically a reverse-DNS or application-specific identifier.\n *\n * @example \"com.example.app\"\n */\n owner: string;\n /**\n * Raw private payload encoded as Base64 data with no `data:...;base64,` prefix.\n *\n * Consumers should only attempt to interpret this data if they recognize\n * and understand the corresponding {@link owner} value.\n */\n privateData: Base64Raw;\n}\n\n/**\n * Encapsulates arbitrary binary objects with metadata.\n *\n * @platform Android\n */\nexport interface AndroidGeobFrame extends AndroidId3FrameBase {\n frameType: 'geob';\n /**\n * MIME type of the encapsulated object.\n *\n * @example \"application/octet-stream\"\n */\n mimeType: string;\n /** Original filename of the object. */\n filename: string;\n description: string;\n /**\n * Raw object encoded as Base64 data with no `data:...;base64,` prefix.\n */\n data: Base64Raw;\n}\n\n/**\n * Defines a content chapter.\n *\n * @platform Android\n */\nexport interface AndroidChapterFrame extends AndroidId3FrameBase {\n frameType: 'chapter';\n /** Identifier of the chapter element. */\n chapterId: string;\n /** Time range of the chapter in milliseconds. */\n timeRange: TimeRange<Milliseconds>;\n /** The byte offset of the start of the chapter, or `-1` if not set. */\n startOffset: number;\n /** The byte offset of the end of the chapter, or `-1` if not set. */\n endOffset: number;\n /**\n * Nested ID3 subframes associated with this chapter (e.g. title, URL, etc.).\n */\n subFrames: AndroidId3Frame[];\n}\n\n/**\n * Defines hierarchical chapter structure.\n *\n * @platform Android\n */\nexport interface AndroidChapterTocFrame extends AndroidId3FrameBase {\n frameType: 'chapterToc';\n /** Identifier of the table-of-contents element. */\n elementId: string;\n /** Whether this element is the root of the chapter tree. */\n isRoot: boolean;\n /** Whether the listed children are ordered. */\n isOrdered: boolean;\n /** IDs of child chapter or TOC elements. */\n children: string[];\n /**\n * Nested ID3 subframes associated with this TOC element.\n */\n subFrames: AndroidId3Frame[];\n}\n\n/**\n * Android representation of ID3 metadata items.\n *\n * This is a discriminated union of Android ID3 frame types. Use {@link isAndroidId3Frame}\n * for type-safe narrowing to specific frame types.\n *\n * @platform Android\n * @see {@link isAndroidId3Frame} for frame type narrowing\n */\nexport type AndroidId3Frame =\n | AndroidTextInformationFrame\n | AndroidBinaryFrame\n | AndroidApicFrame\n | AndroidUrlLinkFrame\n | AndroidCommentFrame\n | AndroidPrivFrame\n | AndroidGeobFrame\n | AndroidChapterFrame\n | AndroidChapterTocFrame;\n\n/**\n * Describes metadata associated with ID3 tags.\n *\n * This is a discriminated union over the `platform` field:\n *\n * - `\"ios\"`: {@link IosId3Frame}\n * - `\"android\"`: {@link AndroidId3Frame}\n *\n * Narrowing on `platform` gives you access to the platform-specific fields.\n */\nexport type Id3MetadataEntry = IosId3Frame | AndroidId3Frame;\n\n/**\n * Describes metadata associated with HLS `#EXT-X-SCTE35` tags.\n *\n * @remarks On iOS, {@link TweaksConfig.isNativeHlsParsingEnabled} must be enabled\n * to parse this type of metadata.\n */\nexport interface ScteMetadataEntry {\n metadataType: MetadataType.SCTE;\n /**\n * The attribute name/key from the SCTE-35 tag.\n */\n key: string;\n /**\n * The attribute value (nullable for key-only attributes).\n */\n value?: string;\n}\n\n/**\n * Metadata entry for unsupported metadata types.\n *\n * This type is emitted when the native player reports timed metadata that\n * this SDK cannot attach to one of the supported types:\n * - iOS: metadata that is not exposed as ID3, SCTE, or DATERANGE\n * - Android: metadata that is not exposed as ID3, SCTE, DATERANGE, or EMSG\n */\nexport interface UnsupportedMetadataEntry {\n metadataType: MetadataType.Unsupported;\n /** The platform that reported the unsupported metadata. */\n platform: 'ios' | 'android';\n}\n\n/**\n * Represents in-playlist timed metadata from an HLS `#EXT-X-DATERANGE` tag.\n *\n * This is a discriminated union over the `platform` field:\n *\n * - `\"ios\"`: {@link IosDateRangeMetadataEntry}\n * - `\"android\"`: {@link AndroidDateRangeMetadataEntry}\n *\n * Narrowing on `platform` gives you access to the platform-specific fields.\n */\nexport type DateRangeMetadataEntry =\n | IosDateRangeMetadataEntry\n | AndroidDateRangeMetadataEntry;\n\n/**\n * Union type representing all supported timed metadata entry kinds.\n *\n * This is a discriminated union over the `metadataType` field:\n *\n * - {@link MetadataType.ID3}: {@link Id3MetadataEntry}\n * - {@link MetadataType.DATERANGE}: {@link DateRangeMetadataEntry}\n * - {@link MetadataType.SCTE}: {@link ScteMetadataEntry}\n * - {@link MetadataType.EMSG}: {@link EventMessageMetadataEntry}\n * - {@link MetadataType.Unsupported}: {@link UnsupportedMetadataEntry}\n *\n * Branching on `metadataType` using an `if`/`switch` statement narrows the type and\n * gives access to entry-specific fields.\n *\n * @example\n * ```ts\n * function handleMetadata(entry: MetadataEntry) {\n * switch (entry.metadataType) {\n * case MetadataType.DATERANGE:\n * // `entry` is a DateRangeMetadataEntry\n * if (entry.platform === 'android') {\n * // `entry` is now an AndroidDateRangeMetadataEntry\n * console.log('End on next:', entry.endOnNext);\n * } else {\n * // `entry` is now an IosDateRangeMetadataEntry\n * console.log('Cueing options:', entry.cueingOptions);\n * }\n * break;\n *\n * case MetadataType.SCTE:\n * // `entry` is a ScteMetadataEntry\n * console.log('SCTE key:', entry.key, 'value:', entry.value);\n * break;\n *\n * case MetadataType.ID3:\n * // `entry` is an Id3MetadataEntry\n * if (entry.platform === 'android') {\n * // `entry` is now an AndroidId3Frame\n * console.log('Frame type:', entry.frameType);\n * // Further narrow down on the frame type\n * if (entry.frameType == 'apic') {\n * console.log('APIC frame mimeType: ', entry.mimeType)\n * }\n * } else {\n * // `entry` is now an IosId3Frame\n * console.log('Frame ID:', entry.id, 'Value:', entry.value);\n * }\n * // Or use isAndroidId3Frame to directly narrow to specific Android frame\n * if (isAndroidId3Frame(entry, 'text')) {\n * console.log('Text frame:', entry.value);\n * }\n * break;\n *\n * case MetadataType.EMSG:\n * // `entry` is an EventMessageMetadataEntry (Android only)\n * console.log('EMSG data:', entry.messageData);\n * break;\n *\n * case MetadataType.Unsupported:\n * // `entry` is an UnsupportedMetadataEntry\n * console.warn('Unsupported metadata encountered from: ', entry.platform)\n * break;\n * }\n * }\n * ```\n */\nexport type MetadataEntry =\n | DateRangeMetadataEntry\n | EventMessageMetadataEntry\n | Id3MetadataEntry\n | ScteMetadataEntry\n | UnsupportedMetadataEntry;\n\n/**\n * A collection of timed metadata entries of the same type.\n *\n * All entries in the collection share the same `metadataType`.\n */\nexport interface MetadataCollection<T extends MetadataEntry> {\n /**\n * The playback time in seconds when this metadata should trigger, relative to the playback session.\n */\n startTime?: Seconds;\n /**\n * The metadata entries.\n *\n * The group is homogeneous: all entries share the same metadata type.\n */\n entries: T[];\n}\n\n/**\n * Type-safe narrowing helper for Android ID3 frame types.\n *\n * Android ID3 frames have 9 distinct frame types (text, binary, apic, url, comment,\n * priv, geob, chapter, chapterToc), each with different fields. This helper provides\n * type-safe access to frame-specific properties.\n *\n * @param entry - The ID3 metadata entry to check\n * @param frameType - The Android frame type to narrow to\n * @returns `true` if entry is an Android frame of the specified type\n *\n * @see {@link MetadataEntry} for the full type narrowing documentation\n */\nexport function isAndroidId3Frame<T extends AndroidId3Frame['frameType']>(\n entry: Id3MetadataEntry,\n frameType: T\n): entry is Extract<AndroidId3Frame, { frameType: T }> {\n return entry.platform === 'android' && entry.frameType === frameType;\n}\n"]}
@@ -45,6 +45,12 @@ declare class SourceModule extends NativeModule<SourceModuleEvents> {
45
45
  * Returns a thumbnail for the specified playback time.
46
46
  */
47
47
  getThumbnail(nativeId: string, time: number): Promise<Thumbnail | null>;
48
+ /**
49
+ * Renews an expiring FairPlay license for the given content key request.
50
+ *
51
+ * @platform iOS, tvOS
52
+ */
53
+ drmFairplayRenewExpiringLicense(nativeId: string, skdUri: string): Promise<void>;
48
54
  }
49
55
  declare const _default: SourceModule;
50
56
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"SourceModule.d.ts","sourceRoot":"","sources":["../../src/modules/SourceModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAErD,OAAO,OAAO,YAAa,SAAQ,YAAY,CAAC,kBAAkB,CAAC;IACjE;;OAEG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,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,CAAC;IAClD;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAE5D;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAElE;;OAEG;IACH,WAAW,CACT,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GACnC,OAAO,CAAC,IAAI,CAAC;IAEhB;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAEvE;;;;OAIG;IACH,+BAA+B,CAC7B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;CACjB;;AAED,wBAAiE"}
@@ -1 +1 @@
1
- {"version":3,"file":"SourceModule.js","sourceRoot":"","sources":["../../src/modules/SourceModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAyEtE,eAAe,mBAAmB,CAAe,cAAc,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo-modules-core';\nimport { LoadingState, SourceRemoteControlConfig } from '../source';\nimport { Thumbnail } from '../thumbnail';\n\nexport type SourceModuleEvents = Record<string, any>;\n\ndeclare class SourceModule extends NativeModule<SourceModuleEvents> {\n /**\n * Checks if the source is attached to a player.\n */\n isAttachedToPlayer(nativeId: string): Promise<boolean | null>;\n\n /**\n * Checks if the source is currently active.\n */\n isActive(nativeId: string): Promise<boolean | null>;\n\n /**\n * Initializes a source with the given nativeId, optional DRM nativeId, configuration object,\n * and remote control object.\n */\n initializeWithConfig(\n nativeId: string,\n drmNativeId?: string,\n config?: Record<string, any>,\n remoteControl?: SourceRemoteControlConfig\n ): Promise<void>;\n\n /**\n * Initializes a source with the given nativeId, optional DRM nativeId, configuration object,\n * remote control object, and analytics source metadata.\n */\n initializeWithAnalyticsConfig(\n nativeId: string,\n drmNativeId?: string,\n config?: Record<string, any>,\n remoteControl?: SourceRemoteControlConfig,\n analyticsSourceMetadata?: Record<string, any>\n ): Promise<void>;\n\n /**\n * Destroys the source with the given nativeId.\n */\n destroy(nativeId: string): Promise<void>;\n\n /**\n * Returns the native DRM config reference of the source with the given nativeId.\n */\n duration(nativeId: string): Promise<number | null>;\n /**\n * Returns the current loading state of the source with the given nativeId.\n */\n loadingState(nativeId: string): Promise<LoadingState | null>;\n\n /**\n * Returns the metadata of the source with the given nativeId.\n */\n getMetadata(nativeId: string): Promise<Record<string, any> | null>;\n\n /**\n * Sets the metadata of the source with the given nativeId.\n */\n setMetadata(\n nativeId: string,\n metadata: Record<string, any> | null\n ): Promise<void>;\n\n /**\n * Returns a thumbnail for the specified playback time.\n */\n getThumbnail(nativeId: string, time: number): Promise<Thumbnail | null>;\n}\n\nexport default requireNativeModule<SourceModule>('SourceModule');\n"]}
1
+ {"version":3,"file":"SourceModule.js","sourceRoot":"","sources":["../../src/modules/SourceModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAmFtE,eAAe,mBAAmB,CAAe,cAAc,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo-modules-core';\nimport { LoadingState, SourceRemoteControlConfig } from '../source';\nimport { Thumbnail } from '../thumbnail';\n\nexport type SourceModuleEvents = Record<string, any>;\n\ndeclare class SourceModule extends NativeModule<SourceModuleEvents> {\n /**\n * Checks if the source is attached to a player.\n */\n isAttachedToPlayer(nativeId: string): Promise<boolean | null>;\n\n /**\n * Checks if the source is currently active.\n */\n isActive(nativeId: string): Promise<boolean | null>;\n\n /**\n * Initializes a source with the given nativeId, optional DRM nativeId, configuration object,\n * and remote control object.\n */\n initializeWithConfig(\n nativeId: string,\n drmNativeId?: string,\n config?: Record<string, any>,\n remoteControl?: SourceRemoteControlConfig\n ): Promise<void>;\n\n /**\n * Initializes a source with the given nativeId, optional DRM nativeId, configuration object,\n * remote control object, and analytics source metadata.\n */\n initializeWithAnalyticsConfig(\n nativeId: string,\n drmNativeId?: string,\n config?: Record<string, any>,\n remoteControl?: SourceRemoteControlConfig,\n analyticsSourceMetadata?: Record<string, any>\n ): Promise<void>;\n\n /**\n * Destroys the source with the given nativeId.\n */\n destroy(nativeId: string): Promise<void>;\n\n /**\n * Returns the native DRM config reference of the source with the given nativeId.\n */\n duration(nativeId: string): Promise<number | null>;\n /**\n * Returns the current loading state of the source with the given nativeId.\n */\n loadingState(nativeId: string): Promise<LoadingState | null>;\n\n /**\n * Returns the metadata of the source with the given nativeId.\n */\n getMetadata(nativeId: string): Promise<Record<string, any> | null>;\n\n /**\n * Sets the metadata of the source with the given nativeId.\n */\n setMetadata(\n nativeId: string,\n metadata: Record<string, any> | null\n ): Promise<void>;\n\n /**\n * Returns a thumbnail for the specified playback time.\n */\n getThumbnail(nativeId: string, time: number): Promise<Thumbnail | null>;\n\n /**\n * Renews an expiring FairPlay license for the given content key request.\n *\n * @platform iOS, tvOS\n */\n drmFairplayRenewExpiringLicense(\n nativeId: string,\n skdUri: string\n ): Promise<void>;\n}\n\nexport default requireNativeModule<SourceModule>('SourceModule');\n"]}
@@ -71,12 +71,8 @@ export class Network extends NativeInstance {
71
71
  onPreprocessHttpRequest = (requestId, type, request) => {
72
72
  this.config
73
73
  ?.preprocessHttpRequest?.(type, request)
74
- .then((resultRequest) => {
75
- NetworkModule.setPreprocessedHttpRequest(requestId, resultRequest);
76
- })
77
- .catch(() => {
78
- NetworkModule.setPreprocessedHttpRequest(requestId, request);
79
- });
74
+ .then((resultRequest) => NetworkModule.setPreprocessedHttpRequest(requestId, resultRequest))
75
+ .catch(() => NetworkModule.setPreprocessedHttpRequest(requestId, request));
80
76
  };
81
77
  /**
82
78
  * Applies the user-defined `preprocessHttpResponse` function to native's `type` and `response` data and store
@@ -91,12 +87,8 @@ export class Network extends NativeInstance {
91
87
  onPreprocessHttpResponse = (responseId, type, response) => {
92
88
  this.config
93
89
  ?.preprocessHttpResponse?.(type, response)
94
- .then((resultResponse) => {
95
- NetworkModule.setPreprocessedHttpResponse(responseId, resultResponse);
96
- })
97
- .catch(() => {
98
- NetworkModule.setPreprocessedHttpResponse(responseId, response);
99
- });
90
+ .then((resultResponse) => NetworkModule.setPreprocessedHttpResponse(responseId, resultResponse))
91
+ .catch(() => NetworkModule.setPreprocessedHttpResponse(responseId, response));
100
92
  };
101
93
  }
102
94
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/network/index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,eAAe,GAIhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,eAAe,EAA4C,CAAC;AAErE;;;GAGG;AACH,MAAM,OAAO,OAAQ,SAAQ,cAA6B;IACxD;;OAEG;IACH,aAAa,GAAG,KAAK,CAAC;IACtB;;OAEG;IACH,WAAW,GAAG,KAAK,CAAC;IAEZ,mCAAmC,CAAqB;IACxD,oCAAoC,CAAqB;IAEjE;;OAEG;IACH,UAAU,GAAG,KAAK,IAAI,EAAE;QACtB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC3D,iEAAiE;YACjE,IAAI,CAAC,mCAAmC,GAAG,aAAa,CAAC,WAAW,CAClE,yBAAyB,EACzB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;gBACzC,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,IAAI,EAAE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AAI,CAAC;QAC1B,CAAC;IACH,CAAC,CAAC;IAEF;;;;;;;;;OASG;IACK,uBAAuB,GAAG,CAChC,SAAiB,EACjB,IAAqB,EACrB,OAAoB,EACpB,EAAE;QACF,IAAI,CAAC,MAAM;YACT,EAAE,qBAAqB,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC;aACvC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE;YACtB,aAAa,CAAC,0BAA0B,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACrE,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,aAAa,CAAC,0BAA0B,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF;;;;;;;;;OASG;IACK,wBAAwB,GAAG,CACjC,UAAkB,EAClB,IAAqB,EACrB,QAAsB,EACtB,EAAE;QACF,IAAI,CAAC,MAAM;YACT,EAAE,sBAAsB,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC;aACzC,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE;YACvB,aAAa,CAAC,2BAA2B,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACxE,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,aAAa,CAAC,2BAA2B,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;CACH","sourcesContent":["import { EventSubscription } from 'expo-modules-core';\nimport NativeInstance from '../nativeInstance';\nimport NetworkModule from './networkModule';\nimport {\n HttpRequestType,\n HttpRequest,\n HttpResponse,\n NetworkConfig,\n} from './networkConfig';\n\nexport { HttpRequestType, HttpRequest, HttpResponse, NetworkConfig };\n\n/**\n * Represents a native Network configuration object.\n * @internal\n */\nexport class Network extends NativeInstance<NetworkConfig> {\n /**\n * Whether this object's native instance has been created.\n */\n isInitialized = false;\n /**\n * Whether this object's native instance has been disposed.\n */\n isDestroyed = false;\n\n private onPreprocessHttpRequestSubscription?: EventSubscription;\n private onPreprocessHttpResponseSubscription?: EventSubscription;\n\n /**\n * Allocates the Network config instance and its resources natively.\n */\n initialize = async () => {\n if (!this.isInitialized) {\n console.log('Initializing Network config:', this.nativeId);\n // Set up event listeners for HTTP request/response preprocessing\n this.onPreprocessHttpRequestSubscription = NetworkModule.addListener(\n 'onPreprocessHttpRequest',\n ({ nativeId, requestId, type, request }) => {\n console.log(`Received HTTP Request [${type}]:`, request);\n if (nativeId !== this.nativeId) {\n return;\n }\n this.onPreprocessHttpRequest(requestId, type, request);\n }\n );\n\n this.onPreprocessHttpResponseSubscription = NetworkModule.addListener(\n 'onPreprocessHttpResponse',\n ({ nativeId, responseId, type, response }) => {\n console.log(`Received HTTP Response [${type}]:`, response);\n if (nativeId !== this.nativeId) {\n return;\n }\n this.onPreprocessHttpResponse(responseId, type, response);\n }\n );\n\n // Create native configuration object using Expo module\n if (this.config) {\n await NetworkModule.initializeWithConfig(this.nativeId, this.config);\n }\n this.isInitialized = true;\n }\n };\n\n /**\n * Destroys the native Network config and releases all of its allocated resources.\n */\n destroy = async () => {\n if (!this.isDestroyed) {\n await NetworkModule.destroy(this.nativeId);\n this.onPreprocessHttpRequestSubscription?.remove();\n this.onPreprocessHttpResponseSubscription?.remove();\n this.onPreprocessHttpRequestSubscription = undefined;\n this.onPreprocessHttpResponseSubscription = undefined;\n this.isDestroyed = true;\n }\n };\n\n /**\n * Applies the user-defined `preprocessHttpRequest` function to native's `type` and `request` data and store\n * the result back in `NetworkModule`.\n *\n * Called from native code when `NetworkConfig.preprocessHttpRequest` is dispatched.\n *\n * @param requestId Passed through to identify the completion handler of the request on native.\n * @param type Type of the request to be made.\n * @param request The HTTP request to process.\n */\n private onPreprocessHttpRequest = (\n requestId: string,\n type: HttpRequestType,\n request: HttpRequest\n ) => {\n this.config\n ?.preprocessHttpRequest?.(type, request)\n .then((resultRequest) => {\n NetworkModule.setPreprocessedHttpRequest(requestId, resultRequest);\n })\n .catch(() => {\n NetworkModule.setPreprocessedHttpRequest(requestId, request);\n });\n };\n\n /**\n * Applies the user-defined `preprocessHttpResponse` function to native's `type` and `response` data and store\n * the result back in `NetworkModule`.\n *\n * Called from native code when `NetworkConfig.preprocessHttpResponse` is dispatched.\n *\n * @param responseId Passed through to identify the completion handler of the response on native.\n * @param type Type of the request to be made.\n * @param response The HTTP response to process.\n */\n private onPreprocessHttpResponse = (\n responseId: string,\n type: HttpRequestType,\n response: HttpResponse\n ) => {\n this.config\n ?.preprocessHttpResponse?.(type, response)\n .then((resultResponse) => {\n NetworkModule.setPreprocessedHttpResponse(responseId, resultResponse);\n })\n .catch(() => {\n NetworkModule.setPreprocessedHttpResponse(responseId, response);\n });\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/network/index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,eAAe,GAIhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,eAAe,EAA4C,CAAC;AAErE;;;GAGG;AACH,MAAM,OAAO,OAAQ,SAAQ,cAA6B;IACxD;;OAEG;IACH,aAAa,GAAG,KAAK,CAAC;IACtB;;OAEG;IACH,WAAW,GAAG,KAAK,CAAC;IAEZ,mCAAmC,CAAqB;IACxD,oCAAoC,CAAqB;IAEjE;;OAEG;IACH,UAAU,GAAG,KAAK,IAAI,EAAE;QACtB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC3D,iEAAiE;YACjE,IAAI,CAAC,mCAAmC,GAAG,aAAa,CAAC,WAAW,CAClE,yBAAyB,EACzB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;gBACzC,OAAO,CAAC,GA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AC;YACtD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC1B,CAAC;IACH,CAAC,CAAC;IAEF;;;;;;;;;OASG;IACK,uBAAuB,GAAG,CAChC,SAAiB,EACjB,IAAqB,EACrB,OAAoB,EACpB,EAAE;QACF,IAAI,CAAC,MAAM;YACT,EAAE,qBAAqB,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC;aACvC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE,CACtB,aAAa,CAAC,0BAA0B,CAAC,SAAS,EAAE,aAAa,CAAC,CACnE;aACA,KAAK,CAAC,GAAG,EAAE,CACV,aAAa,CAAC,0BAA0B,CAAC,SAAS,EAAE,OAAO,CAAC,CAC7D,CAAC;IACN,CAAC,CAAC;IAEF;;;;;;;;;OASG;IACK,wBAAwB,GAAG,CACjC,UAAkB,EAClB,IAAqB,EACrB,QAAsB,EACtB,EAAE;QACF,IAAI,CAAC,MAAM;YACT,EAAE,sBAAsB,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC;aACzC,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE,CACvB,aAAa,CAAC,2BAA2B,CAAC,UAAU,EAAE,cAAc,CAAC,CACtE;aACA,KAAK,CAAC,GAAG,EAAE,CACV,aAAa,CAAC,2BAA2B,CAAC,UAAU,EAAE,QAAQ,CAAC,CAChE,CAAC;IACN,CAAC,CAAC;CACH","sourcesContent":["import { EventSubscription } from 'expo-modules-core';\nimport NativeInstance from '../nativeInstance';\nimport NetworkModule from './networkModule';\nimport {\n HttpRequestType,\n HttpRequest,\n HttpResponse,\n NetworkConfig,\n} from './networkConfig';\n\nexport { HttpRequestType, HttpRequest, HttpResponse, NetworkConfig };\n\n/**\n * Represents a native Network configuration object.\n * @internal\n */\nexport class Network extends NativeInstance<NetworkConfig> {\n /**\n * Whether this object's native instance has been created.\n */\n isInitialized = false;\n /**\n * Whether this object's native instance has been disposed.\n */\n isDestroyed = false;\n\n private onPreprocessHttpRequestSubscription?: EventSubscription;\n private onPreprocessHttpResponseSubscription?: EventSubscription;\n\n /**\n * Allocates the Network config instance and its resources natively.\n */\n initialize = async () => {\n if (!this.isInitialized) {\n console.log('Initializing Network config:', this.nativeId);\n // Set up event listeners for HTTP request/response preprocessing\n this.onPreprocessHttpRequestSubscription = NetworkModule.addListener(\n 'onPreprocessHttpRequest',\n ({ nativeId, requestId, type, request }) => {\n console.log(`Received HTTP Request [${type}]:`, request);\n if (nativeId !== this.nativeId) {\n return;\n }\n this.onPreprocessHttpRequest(requestId, type, request);\n }\n );\n\n this.onPreprocessHttpResponseSubscription = NetworkModule.addListener(\n 'onPreprocessHttpResponse',\n ({ nativeId, responseId, type, response }) => {\n console.log(`Received HTTP Response [${type}]:`, response);\n if (nativeId !== this.nativeId) {\n return;\n }\n this.onPreprocessHttpResponse(responseId, type, response);\n }\n );\n\n // Create native configuration object using Expo module\n if (this.config) {\n await NetworkModule.initializeWithConfig(this.nativeId, this.config);\n }\n this.isInitialized = true;\n }\n };\n\n /**\n * Destroys the native Network config and releases all of its allocated resources.\n */\n destroy = async () => {\n if (!this.isDestroyed) {\n await NetworkModule.destroy(this.nativeId);\n this.onPreprocessHttpRequestSubscription?.remove();\n this.onPreprocessHttpResponseSubscription?.remove();\n this.onPreprocessHttpRequestSubscription = undefined;\n this.onPreprocessHttpResponseSubscription = undefined;\n this.isDestroyed = true;\n }\n };\n\n /**\n * Applies the user-defined `preprocessHttpRequest` function to native's `type` and `request` data and store\n * the result back in `NetworkModule`.\n *\n * Called from native code when `NetworkConfig.preprocessHttpRequest` is dispatched.\n *\n * @param requestId Passed through to identify the completion handler of the request on native.\n * @param type Type of the request to be made.\n * @param request The HTTP request to process.\n */\n private onPreprocessHttpRequest = (\n requestId: string,\n type: HttpRequestType,\n request: HttpRequest\n ) => {\n this.config\n ?.preprocessHttpRequest?.(type, request)\n .then((resultRequest) =>\n NetworkModule.setPreprocessedHttpRequest(requestId, resultRequest)\n )\n .catch(() =>\n NetworkModule.setPreprocessedHttpRequest(requestId, request)\n );\n };\n\n /**\n * Applies the user-defined `preprocessHttpResponse` function to native's `type` and `response` data and store\n * the result back in `NetworkModule`.\n *\n * Called from native code when `NetworkConfig.preprocessHttpResponse` is dispatched.\n *\n * @param responseId Passed through to identify the completion handler of the response on native.\n * @param type Type of the request to be made.\n * @param response The HTTP response to process.\n */\n private onPreprocessHttpResponse = (\n responseId: string,\n type: HttpRequestType,\n response: HttpResponse\n ) => {\n this.config\n ?.preprocessHttpResponse?.(type, response)\n .then((resultResponse) =>\n NetworkModule.setPreprocessedHttpResponse(responseId, resultResponse)\n )\n .catch(() =>\n NetworkModule.setPreprocessedHttpResponse(responseId, response)\n );\n };\n}\n"]}
@@ -90,7 +90,7 @@ export class OfflineContentManager extends NativeInstance {
90
90
  this.isDestroyed = true;
91
91
  this.eventSubscription?.remove?.();
92
92
  this.listeners.clear();
93
- this.drm?.destroy();
93
+ await this.drm?.destroy();
94
94
  return OfflineModule.release(this.nativeId);
95
95
  }
96
96
  return Promise.resolve();
@@ -1 +1 @@
1
- {"version":3,"file":"offlineContentManager.js","sourceRoot":"","sources":["../../src/offline/offlineContentManager.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAGL,gBAAgB,GACjB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,gCAAgC,GAAG,CACvC,IAAoC,EACpC,SAA6C,EAC7C,EAAE;IACF,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC7B,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,IAAI,IAAI,CAAC,SAAS,KAAK,gBAAgB,CAAC,WAAW,EAAE,CAAC;YACpD,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;aAAM,IAAI,IAAI,CAAC,SAAS,KAAK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AAG,KAAK,IAAmB,EAAE;QACzC,OAAO,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC,CAAC;IAEF;;OAEG;IACH,WAAW,GAAG,KAAK,IAAqB,EAAE;QACxC,OAAO,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC,CAAC;IAEF;;OAEG;IACH,SAAS,GAAG,KAAK,IAAmB,EAAE;QACpC,OAAO,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC,CAAC;IAEF;;;;OAIG;IACH,eAAe,GAAG,KAAK,IAAmB,EAAE;QAC1C,OAAO,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC,CAAC;IAEF;;;;;;OAMG;IACH,cAAc,GAAG,KAAK,IAAmB,EAAE;QACzC,OAAO,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC,CAAC;IAEF;;;;OAIG;IACH,mBAAmB,GAAG,KAAK,IAAmB,EAAE;QAC9C,OAAO,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC,CAAC;CACH","sourcesContent":["import { EventSubscription } from 'expo-modules-core';\nimport NativeInstance from '../nativeInstance';\nimport {\n BitmovinNativeOfflineEventData,\n OfflineContentManagerListener,\n OfflineEventType,\n} from './offlineContentManagerListener';\nimport { OfflineContentConfig } from './offlineContentConfig';\nimport { OfflineDownloadRequest } from './offlineDownloadRequest';\nimport { OfflineState } from './offlineState';\nimport { Drm } from '../drm';\nimport OfflineModule from './offlineModule';\n\nconst handleBitmovinNativeOfflineEvent = (\n data: BitmovinNativeOfflineEventData,\n listeners: Set<OfflineContentManagerListener>\n) => {\n listeners.forEach((listener) => {\n if (!listener) return;\n\n if (data.eventType === OfflineEventType.onCompleted) {\n listener.onCompleted?.(data);\n } else if (data.eventType === OfflineEventType.onError) {\n listener.onError?.(data);\n } else if (data.eventType === OfflineEventType.onProgress) {\n listener.onProgress?.(data);\n } else if (data.eventType === OfflineEventType.onOptionsAvailable) {\n listener.onOptionsAvailable?.(data);\n } else if (data.eventType === OfflineEventType.onDrmLicenseUpdated) {\n listener.onDrmLicenseUpdated?.(data);\n } else if (data.eventType === OfflineEventType.onDrmLicenseExpired) {\n listener.onDrmLicenseExpired?.(data);\n } else if (data.eventType === OfflineEventType.onSuspended) {\n listener.onSuspended?.(data);\n } else if (data.eventType === OfflineEventType.onResumed) {\n listener.onResumed?.(data);\n } else if (data.eventType === OfflineEventType.onCanceled) {\n listener.onCanceled?.(data);\n }\n });\n};\n\n/**\n * Provides the means to download and store sources locally that can be played back with a Player\n * without an active network connection. An OfflineContentManager instance can be created via\n * the constructor and will be idle until initialized.\n *\n * @platform Android, iOS\n */\nexport class OfflineContentManager extends NativeInstance<OfflineContentConfig> {\n isInitialized = false;\n isDestroyed = false;\n private eventSubscription?: EventSubscription;\n private listeners: Set<OfflineContentManagerListener> =\n new Set<OfflineContentManagerListener>();\n private drm?: Drm;\n\n /**\n * Allocates the native `OfflineManager` instance and its resources natively.\n * Registers the `DeviceEventEmitter` listener to receive data from the native `OfflineContentManagerListener` callbacks\n */\n initialize = async (): Promise<void> => {\n if (!this.isInitialized && this.config) {\n this.eventSubscription = OfflineModule.addListener(\n 'onBitmovinOfflineEvent',\n (event: BitmovinNativeOfflineEventData) => {\n if (this.nativeId !== event.nativeId) {\n return;\n }\n\n handleBitmovinNativeOfflineEvent(event, this.listeners);\n }\n );\n\n if (this.config.sourceConfig.drmConfig) {\n this.drm = new Drm(this.config.sourceConfig.drmConfig);\n await this.drm.initialize();\n }\n\n await OfflineModule.initializeWithConfig(\n this.nativeId,\n {\n identifier: this.config.identifier,\n sourceConfig: this.config.sourceConfig,\n },\n this.drm?.nativeId\n );\n }\n\n this.isInitialized = true;\n return Promise.resolve();\n };\n\n /**\n * Adds a listener to the receive data from the native `OfflineContentManagerListener` callbacks\n * Returns a function that removes this listener from the `OfflineContentManager` that registered it.\n */\n addListener = (listener: OfflineContentManagerListener): (() => void) => {\n this.listeners.add(listener);\n\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n /**\n * Destroys the native `OfflineManager` and releases all of its allocated resources.\n */\n destroy = async (): Promise<void> => {\n if (!this.isDestroyed) {\n this.isDestroyed = true;\n this.eventSubscription?.remove?.();\n this.listeners.clear();\n this.drm?.destroy();\n\n return OfflineModule.release(this.nativeId);\n }\n\n return Promise.resolve();\n };\n\n /**\n * Gets the current state of the `OfflineContentManager`\n */\n state = async (): Promise<OfflineState> => {\n return OfflineModule.getState(this.nativeId) as Promise<OfflineState>;\n };\n\n /**\n * Loads the current `OfflineContentOptions`.\n * When the options are loaded the data will be passed to the `OfflineContentManagerListener.onOptionsAvailable`.\n */\n getOptions = async (): Promise<void> => {\n return OfflineModule.getOptions(this.nativeId);\n };\n\n /**\n * Enqueues downloads according to the `OfflineDownloadRequest`.\n * The promise will reject in the event of null or invalid request parameters.\n * The promise will reject when calling this method when download has already started or is completed.\n * The promise will resolve when the download has been queued. The download will is not finished when the promise resolves.\n */\n download = async (request: OfflineDownloadRequest): Promise<void> => {\n return OfflineModule.download(this.nativeId, request);\n };\n\n /**\n * Resumes all suspended actions.\n */\n resume = async (): Promise<void> => {\n return OfflineModule.resume(this.nativeId);\n };\n\n /**\n * Suspends all active actions.\n */\n suspend = async (): Promise<void> => {\n return OfflineModule.suspend(this.nativeId);\n };\n\n /**\n * Cancels and deletes the active download.\n */\n cancelDownload = async (): Promise<void> => {\n return OfflineModule.cancelDownload(this.nativeId);\n };\n\n /**\n * Resolves how many bytes of storage are used by the offline content.\n */\n usedStorage = async (): Promise<number> => {\n return OfflineModule.usedStorage(this.nativeId);\n };\n\n /**\n * Deletes everything related to the related content ID.\n */\n deleteAll = async (): Promise<void> => {\n return OfflineModule.deleteAll(this.nativeId);\n };\n\n /**\n * Downloads the offline license.\n * When finished successfully, data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.\n * Errors are transmitted to the `OfflineContentManagerListener.onError`.\n */\n downloadLicense = async (): Promise<void> => {\n return OfflineModule.downloadLicense(this.nativeId);\n };\n\n /**\n * Releases the currently held offline license.\n * When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.\n * Errors are transmitted to the `OfflineContentManagerListener.onError`.\n *\n * @platform Android\n */\n releaseLicense = async (): Promise<void> => {\n return OfflineModule.releaseLicense(this.nativeId);\n };\n\n /**\n * Renews the already downloaded DRM license.\n * When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.\n * Errors are transmitted to the `OfflineContentManagerListener.onError`.\n */\n renewOfflineLicense = async (): Promise<void> => {\n return OfflineModule.renewOfflineLicense(this.nativeId);\n };\n}\n"]}
1
+ {"version":3,"file":"offlineContentManager.js","sourceRoot":"","sources":["../../src/offline/offlineContentManager.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAGL,gBAAgB,GACjB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,gCAAgC,GAAG,CACvC,IAAoC,EACpC,SAA6C,EAC7C,EAAE;IACF,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC7B,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,IAAI,IAAI,CAAC,SAAS,KAAK,gBAAgB,CAAC,WAAW,EAAE,CAAC;YACpD,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;aAAM,IAAI,IAAI,CAAC,SAAS,KAAK,gBAAgB,CAAC,OAAO,EAAE,CAAC;YACvD,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;aAAM,I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CAAC;IAEF;;OAEG;IACH,WAAW,GAAG,KAAK,IAAqB,EAAE;QACxC,OAAO,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC,CAAC;IAEF;;OAEG;IACH,SAAS,GAAG,KAAK,IAAmB,EAAE;QACpC,OAAO,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC,CAAC;IAEF;;;;OAIG;IACH,eAAe,GAAG,KAAK,IAAmB,EAAE;QAC1C,OAAO,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC,CAAC;IAEF;;;;;;OAMG;IACH,cAAc,GAAG,KAAK,IAAmB,EAAE;QACzC,OAAO,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC,CAAC;IAEF;;;;OAIG;IACH,mBAAmB,GAAG,KAAK,IAAmB,EAAE;QAC9C,OAAO,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC,CAAC;CACH","sourcesContent":["import { EventSubscription } from 'expo-modules-core';\nimport NativeInstance from '../nativeInstance';\nimport {\n BitmovinNativeOfflineEventData,\n OfflineContentManagerListener,\n OfflineEventType,\n} from './offlineContentManagerListener';\nimport { OfflineContentConfig } from './offlineContentConfig';\nimport { OfflineDownloadRequest } from './offlineDownloadRequest';\nimport { OfflineState } from './offlineState';\nimport { Drm } from '../drm';\nimport OfflineModule from './offlineModule';\n\nconst handleBitmovinNativeOfflineEvent = (\n data: BitmovinNativeOfflineEventData,\n listeners: Set<OfflineContentManagerListener>\n) => {\n listeners.forEach((listener) => {\n if (!listener) return;\n\n if (data.eventType === OfflineEventType.onCompleted) {\n listener.onCompleted?.(data);\n } else if (data.eventType === OfflineEventType.onError) {\n listener.onError?.(data);\n } else if (data.eventType === OfflineEventType.onProgress) {\n listener.onProgress?.(data);\n } else if (data.eventType === OfflineEventType.onOptionsAvailable) {\n listener.onOptionsAvailable?.(data);\n } else if (data.eventType === OfflineEventType.onDrmLicenseUpdated) {\n listener.onDrmLicenseUpdated?.(data);\n } else if (data.eventType === OfflineEventType.onDrmLicenseExpired) {\n listener.onDrmLicenseExpired?.(data);\n } else if (data.eventType === OfflineEventType.onSuspended) {\n listener.onSuspended?.(data);\n } else if (data.eventType === OfflineEventType.onResumed) {\n listener.onResumed?.(data);\n } else if (data.eventType === OfflineEventType.onCanceled) {\n listener.onCanceled?.(data);\n }\n });\n};\n\n/**\n * Provides the means to download and store sources locally that can be played back with a Player\n * without an active network connection. An OfflineContentManager instance can be created via\n * the constructor and will be idle until initialized.\n *\n * @platform Android, iOS\n */\nexport class OfflineContentManager extends NativeInstance<OfflineContentConfig> {\n isInitialized = false;\n isDestroyed = false;\n private eventSubscription?: EventSubscription;\n private listeners: Set<OfflineContentManagerListener> =\n new Set<OfflineContentManagerListener>();\n private drm?: Drm;\n\n /**\n * Allocates the native `OfflineManager` instance and its resources natively.\n * Registers the `DeviceEventEmitter` listener to receive data from the native `OfflineContentManagerListener` callbacks\n */\n initialize = async (): Promise<void> => {\n if (!this.isInitialized && this.config) {\n this.eventSubscription = OfflineModule.addListener(\n 'onBitmovinOfflineEvent',\n (event: BitmovinNativeOfflineEventData) => {\n if (this.nativeId !== event.nativeId) {\n return;\n }\n\n handleBitmovinNativeOfflineEvent(event, this.listeners);\n }\n );\n\n if (this.config.sourceConfig.drmConfig) {\n this.drm = new Drm(this.config.sourceConfig.drmConfig);\n await this.drm.initialize();\n }\n\n await OfflineModule.initializeWithConfig(\n this.nativeId,\n {\n identifier: this.config.identifier,\n sourceConfig: this.config.sourceConfig,\n },\n this.drm?.nativeId\n );\n }\n\n this.isInitialized = true;\n return Promise.resolve();\n };\n\n /**\n * Adds a listener to the receive data from the native `OfflineContentManagerListener` callbacks\n * Returns a function that removes this listener from the `OfflineContentManager` that registered it.\n */\n addListener = (listener: OfflineContentManagerListener): (() => void) => {\n this.listeners.add(listener);\n\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n /**\n * Destroys the native `OfflineManager` and releases all of its allocated resources.\n */\n destroy = async (): Promise<void> => {\n if (!this.isDestroyed) {\n this.isDestroyed = true;\n this.eventSubscription?.remove?.();\n this.listeners.clear();\n await this.drm?.destroy();\n\n return OfflineModule.release(this.nativeId);\n }\n\n return Promise.resolve();\n };\n\n /**\n * Gets the current state of the `OfflineContentManager`\n */\n state = async (): Promise<OfflineState> => {\n return OfflineModule.getState(this.nativeId) as Promise<OfflineState>;\n };\n\n /**\n * Loads the current `OfflineContentOptions`.\n * When the options are loaded the data will be passed to the `OfflineContentManagerListener.onOptionsAvailable`.\n */\n getOptions = async (): Promise<void> => {\n return OfflineModule.getOptions(this.nativeId);\n };\n\n /**\n * Enqueues downloads according to the `OfflineDownloadRequest`.\n * The promise will reject in the event of null or invalid request parameters.\n * The promise will reject when calling this method when download has already started or is completed.\n * The promise will resolve when the download has been queued. The download will is not finished when the promise resolves.\n */\n download = async (request: OfflineDownloadRequest): Promise<void> => {\n return OfflineModule.download(this.nativeId, request);\n };\n\n /**\n * Resumes all suspended actions.\n */\n resume = async (): Promise<void> => {\n return OfflineModule.resume(this.nativeId);\n };\n\n /**\n * Suspends all active actions.\n */\n suspend = async (): Promise<void> => {\n return OfflineModule.suspend(this.nativeId);\n };\n\n /**\n * Cancels and deletes the active download.\n */\n cancelDownload = async (): Promise<void> => {\n return OfflineModule.cancelDownload(this.nativeId);\n };\n\n /**\n * Resolves how many bytes of storage are used by the offline content.\n */\n usedStorage = async (): Promise<number> => {\n return OfflineModule.usedStorage(this.nativeId);\n };\n\n /**\n * Deletes everything related to the related content ID.\n */\n deleteAll = async (): Promise<void> => {\n return OfflineModule.deleteAll(this.nativeId);\n };\n\n /**\n * Downloads the offline license.\n * When finished successfully, data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.\n * Errors are transmitted to the `OfflineContentManagerListener.onError`.\n */\n downloadLicense = async (): Promise<void> => {\n return OfflineModule.downloadLicense(this.nativeId);\n };\n\n /**\n * Releases the currently held offline license.\n * When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.\n * Errors are transmitted to the `OfflineContentManagerListener.onError`.\n *\n * @platform Android\n */\n releaseLicense = async (): Promise<void> => {\n return OfflineModule.releaseLicense(this.nativeId);\n };\n\n /**\n * Renews the already downloaded DRM license.\n * When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.\n * Errors are transmitted to the `OfflineContentManagerListener.onError`.\n */\n renewOfflineLicense = async (): Promise<void> => {\n return OfflineModule.renewOfflineLicense(this.nativeId);\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"offlineContentManagerListener.d.ts","sourceRoot":"","sources":["../../src/offline/offlineContentManagerListener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;IAC3C,mBAAmB,wBAAwB;IAC3C,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,UAAU,eAAe;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,gBAAgB;IACtD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,EAAE,CAAC,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,YAAY,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,gBACf,SAAQ,YAAY,CAAC,gBAAgB,CAAC,WAAW,CAAC;IAClD;;OAEG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC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AAC,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IACpC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;IAC1C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,CAAC,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC1D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC5D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC5D;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;CAC3C"}
1
+ {"version":3,"file":"offlineContentManagerListener.d.ts","sourceRoot":"","sources":["../../src/offline/offlineContentManagerListener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;IAC3C,mBAAmB,wBAAwB;IAC3C,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,UAAU,eAAe;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,gBAAgB;IACtD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;O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BAAwB,GACxB,wBAAwB,GACxB,gBAAgB,GAChB,cAAc,GACd,eAAe,CAAC;AAEpB;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IACpC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;IAC1C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,CAAC,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC1D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC5D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC5D;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;CAC3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"offlineContentManagerListener.js","sourceRoot":"","sources":["../../src/offline/offlineContentManagerListener.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IAC1B,+CAA2B,CAAA;IAC3B,uCAAmB,CAAA;IACnB,6CAAyB,CAAA;IACzB,6DAAyC,CAAA;IACzC,+DAA2C,CAAA;IAC3C,+DAA2C,CAAA;IAC3C,+CAA2B,CAAA;IAC3B,2CAAuB,CAAA;IACvB,6CAAyB,CAAA;AAC3B,CAAC,EAVW,gBAAgB,KAAhB,gBAAgB,QAU3B","sourcesContent":["import { OfflineContentOptions } from './offlineContentOptions';\nimport { OfflineState } from './offlineState';\n\n/**\n * Enum to hold the `eventType` on the `BitmovinNativeOfflineEventData`\n * @platform Android, iOS\n */\nexport enum OfflineEventType {\n onCompleted = 'onCompleted',\n onError = 'onError',\n onProgress = 'onProgress',\n onOptionsAvailable = 'onOptionsAvailable',\n onDrmLicenseUpdated = 'onDrmLicenseUpdated',\n onDrmLicenseExpired = 'onDrmLicenseExpired',\n onSuspended = 'onSuspended',\n onResumed = 'onResumed',\n onCanceled = 'onCanceled',\n}\n\n/**\n * The base interface for all offline events.\n * @platform Android, iOS\n */\nexport interface OfflineEvent<T extends OfflineEventType> {\n /**\n * The native id associated with the `OfflineContentManager` emitting this event\n */\n nativeId: string;\n /**\n * The supplied id representing the source associated with the `OfflineContentManager` emitting this event.\n */\n identifier: string;\n /**\n * The `OfflineEventType` that correlates to which native `OfflineContentManagerListener` method was called.\n */\n eventType: T;\n /**\n * The current offline download state\n */\n state: OfflineState;\n}\n\n/**\n * Emitted when the download process has completed.\n * @platform Android, iOS\n */\nexport interface OnCompletedEvent\n extends OfflineEvent<OfflineEventType.onCompleted> {\n /**\n * The options that are available to download\n */\n options?: OfflineContentOptions;\n}\n\n/**\n * Emitted when an error has occurred.\n * @platform Android, iOS\n */\nexport interface OnErrorEvent extends OfflineEvent<OfflineEventType.onError> {\n /**\n * The error code of the process error\n */\n code?: number;\n /**\n * The error message of the process error\n */\n message?: string;\n}\n\n/**\n * Emitted when there is a progress change for the process call.\n * @platform Android, iOS\n */\nexport interface OnProgressEvent\n extends OfflineEvent<OfflineEventType.onProgress> {\n /**\n * The progress for the current process\n */\n progress: number;\n}\n\n/**\n * Emitted when the `OfflineContentOptions` is available after a `OfflineContentManager.getOptions` call.\n * @platform Android, iOS\n */\nexport interface OnOptionsAvailableEvent\n extends OfflineEvent<OfflineEventType.onOptionsAvailable> {\n /**\n * The options that are available to download\n */\n options?: OfflineContentOptions;\n}\n\n/**\n * Emitted when the DRM license was updated.\n * @platform Android, iOS\n */\nexport type OnDrmLicenseUpdatedEvent =\n OfflineEvent<OfflineEventType.onDrmLicenseUpdated>;\n\n/**\n * Emitted when the DRM license has expired.\n * @platform iOS\n */\nexport type OnDrmLicenseExpiredEvent =\n OfflineEvent<OfflineEventType.onDrmLicenseExpired>;\n\n/**\n * Emitted when all active actions have been suspended.\n * @platform Android, iOS\n */\nexport type OnSuspendedEvent = OfflineEvent<OfflineEventType.onSuspended>;\n\n/**\n * Emitted when all actions have been resumed.\n * @platform Android, iOS\n */\nexport type OnResumedEvent = OfflineEvent<OfflineEventType.onResumed>;\n\n/**\n * Emitted when the download of the media content was canceled by the user and all partially downloaded content has been deleted from disk.\n * @platform Android, iOS\n */\nexport type OnCanceledEvent = OfflineEvent<OfflineEventType.onCanceled>;\n\n/**\n * The type aggregation for all possible native offline events received from the `DeviceEventEmitter`\n * @platform Android, iOS\n */\nexport type BitmovinNativeOfflineEventData =\n | OnCompletedEvent\n | OnOptionsAvailableEvent\n | OnProgressEvent\n | OnErrorEvent\n | OnDrmLicenseUpdatedEvent\n | OnDrmLicenseExpiredEvent\n | OnSuspendedEvent\n | OnResumedEvent\n | OnCanceledEvent;\n\n/**\n * The listener that can be passed to the `OfflineContentManager` to receive callbacks for different events.\n * @platform Android, iOS\n */\nexport interface OfflineContentManagerListener {\n /**\n * Emitted when the download process has completed.\n *\n * @param e The `OnCompletedEvent` that was emitted\n */\n onCompleted?: (e: OnCompletedEvent) => void;\n /**\n * Emitted when an error has occurred.\n *\n * @param e The `OnErrorEvent` that was emitted\n */\n onError?: (e: OnErrorEvent) => void;\n /**\n * Emitted when there is a progress change for the process call.\n *\n * @param e The `OnProgressEvent` that was emitted\n */\n onProgress?: (e: OnProgressEvent) => void;\n /**\n * Emitted when the `OfflineContentOptions` is available after a `OfflineContentManager.getOptions` call.\n *\n * @param e The `OnOptionsAvailableEvent` that was emitted\n */\n onOptionsAvailable?: (e: OnOptionsAvailableEvent) => void;\n /**\n * Emitted when the DRM license was updated.\n *\n * @param e The `OnDrmLicenseUpdatedEvent` that was emitted\n */\n onDrmLicenseUpdated?: (e: OnDrmLicenseUpdatedEvent) => void;\n /**\n * Emitted when the DRM license has expired.\n *\n * @param e The `OnDrmLicenseExpiredEvent` that was emitted\n */\n onDrmLicenseExpired?: (e: OnDrmLicenseExpiredEvent) => void;\n /**\n * Emitted when all active actions have been suspended.\n *\n * @param e The `OnSuspendedEvent` that was emitted\n */\n onSuspended?: (e: OnSuspendedEvent) => void;\n /**\n * Emitted when all actions have been resumed.\n *\n * @param e The `OnResumedEvent` that was emitted\n */\n onResumed?: (e: OnResumedEvent) => void;\n /**\n * Emitted when the download of the media content was canceled by the user and all partially downloaded content has been deleted from disk.\n *\n * @param e The `OnCanceledEvent` that was emitted\n */\n onCanceled?: (e: OnCanceledEvent) => void;\n}\n"]}
1
+ {"version":3,"file":"offlineContentManagerListener.js","sourceRoot":"","sources":["../../src/offline/offlineContentManagerListener.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IAC1B,+CAA2B,CAAA;IAC3B,uCAAmB,CAAA;IACnB,6CAAyB,CAAA;IACzB,6DAAyC,CAAA;IACzC,+DAA2C,CAAA;IAC3C,+DAA2C,CAAA;IAC3C,+CAA2B,CAAA;IAC3B,2CAAuB,CAAA;IACvB,6CAAyB,CAAA;AAC3B,CAAC,EAVW,gBAAgB,KAAhB,gBAAgB,QAU3B","sourcesContent":["import { OfflineContentOptions } from './offlineContentOptions';\nimport { OfflineState } from './offlineState';\n\n/**\n * Enum to hold the `eventType` on the `BitmovinNativeOfflineEventData`\n * @platform Android, iOS\n */\nexport enum OfflineEventType {\n onCompleted = 'onCompleted',\n onError = 'onError',\n onProgress = 'onProgress',\n onOptionsAvailable = 'onOptionsAvailable',\n onDrmLicenseUpdated = 'onDrmLicenseUpdated',\n onDrmLicenseExpired = 'onDrmLicenseExpired',\n onSuspended = 'onSuspended',\n onResumed = 'onResumed',\n onCanceled = 'onCanceled',\n}\n\n/**\n * The base interface for all offline events.\n * @platform Android, iOS\n */\nexport interface OfflineEvent<T extends OfflineEventType> {\n /**\n * The native id associated with the `OfflineContentManager` emitting this event\n */\n nativeId: string;\n /**\n * The supplied id representing the source associated with the `OfflineContentManager` emitting this event.\n */\n identifier: string;\n /**\n * The `OfflineEventType` that correlates to which native `OfflineContentManagerListener` method was called.\n */\n eventType: T;\n /**\n * The current offline download state\n */\n state: OfflineState;\n}\n\n/**\n * Emitted when the download process has completed.\n * @platform Android, iOS\n */\nexport interface OnCompletedEvent extends OfflineEvent<OfflineEventType.onCompleted> {\n /**\n * The options that are available to download\n */\n options?: OfflineContentOptions;\n}\n\n/**\n * Emitted when an error has occurred.\n * @platform Android, iOS\n */\nexport interface OnErrorEvent extends OfflineEvent<OfflineEventType.onError> {\n /**\n * The error code of the process error\n */\n code?: number;\n /**\n * The error message of the process error\n */\n message?: string;\n}\n\n/**\n * Emitted when there is a progress change for the process call.\n * @platform Android, iOS\n */\nexport interface OnProgressEvent extends OfflineEvent<OfflineEventType.onProgress> {\n /**\n * The progress for the current process\n */\n progress: number;\n}\n\n/**\n * Emitted when the `OfflineContentOptions` is available after a `OfflineContentManager.getOptions` call.\n * @platform Android, iOS\n */\nexport interface OnOptionsAvailableEvent extends OfflineEvent<OfflineEventType.onOptionsAvailable> {\n /**\n * The options that are available to download\n */\n options?: OfflineContentOptions;\n}\n\n/**\n * Emitted when the DRM license was updated.\n * @platform Android, iOS\n */\nexport type OnDrmLicenseUpdatedEvent =\n OfflineEvent<OfflineEventType.onDrmLicenseUpdated>;\n\n/**\n * Emitted when the DRM license has expired.\n * @platform iOS\n */\nexport type OnDrmLicenseExpiredEvent =\n OfflineEvent<OfflineEventType.onDrmLicenseExpired>;\n\n/**\n * Emitted when all active actions have been suspended.\n * @platform Android, iOS\n */\nexport type OnSuspendedEvent = OfflineEvent<OfflineEventType.onSuspended>;\n\n/**\n * Emitted when all actions have been resumed.\n * @platform Android, iOS\n */\nexport type OnResumedEvent = OfflineEvent<OfflineEventType.onResumed>;\n\n/**\n * Emitted when the download of the media content was canceled by the user and all partially downloaded content has been deleted from disk.\n * @platform Android, iOS\n */\nexport type OnCanceledEvent = OfflineEvent<OfflineEventType.onCanceled>;\n\n/**\n * The type aggregation for all possible native offline events received from the `DeviceEventEmitter`\n * @platform Android, iOS\n */\nexport type BitmovinNativeOfflineEventData =\n | OnCompletedEvent\n | OnOptionsAvailableEvent\n | OnProgressEvent\n | OnErrorEvent\n | OnDrmLicenseUpdatedEvent\n | OnDrmLicenseExpiredEvent\n | OnSuspendedEvent\n | OnResumedEvent\n | OnCanceledEvent;\n\n/**\n * The listener that can be passed to the `OfflineContentManager` to receive callbacks for different events.\n * @platform Android, iOS\n */\nexport interface OfflineContentManagerListener {\n /**\n * Emitted when the download process has completed.\n *\n * @param e The `OnCompletedEvent` that was emitted\n */\n onCompleted?: (e: OnCompletedEvent) => void;\n /**\n * Emitted when an error has occurred.\n *\n * @param e The `OnErrorEvent` that was emitted\n */\n onError?: (e: OnErrorEvent) => void;\n /**\n * Emitted when there is a progress change for the process call.\n *\n * @param e The `OnProgressEvent` that was emitted\n */\n onProgress?: (e: OnProgressEvent) => void;\n /**\n * Emitted when the `OfflineContentOptions` is available after a `OfflineContentManager.getOptions` call.\n *\n * @param e The `OnOptionsAvailableEvent` that was emitted\n */\n onOptionsAvailable?: (e: OnOptionsAvailableEvent) => void;\n /**\n * Emitted when the DRM license was updated.\n *\n * @param e The `OnDrmLicenseUpdatedEvent` that was emitted\n */\n onDrmLicenseUpdated?: (e: OnDrmLicenseUpdatedEvent) => void;\n /**\n * Emitted when the DRM license has expired.\n *\n * @param e The `OnDrmLicenseExpiredEvent` that was emitted\n */\n onDrmLicenseExpired?: (e: OnDrmLicenseExpiredEvent) => void;\n /**\n * Emitted when all active actions have been suspended.\n *\n * @param e The `OnSuspendedEvent` that was emitted\n */\n onSuspended?: (e: OnSuspendedEvent) => void;\n /**\n * Emitted when all actions have been resumed.\n *\n * @param e The `OnResumedEvent` that was emitted\n */\n onResumed?: (e: OnResumedEvent) => void;\n /**\n * Emitted when the download of the media content was canceled by the user and all partially downloaded content has been deleted from disk.\n *\n * @param e The `OnCanceledEvent` that was emitted\n */\n onCanceled?: (e: OnCanceledEvent) => void;\n}\n"]}
package/build/player.js CHANGED
@@ -69,10 +69,10 @@ export class Player extends NativeInstance {
69
69
  */
70
70
  destroy = () => {
71
71
  if (!this.isDestroyed) {
72
- PlayerModule.destroy(this.nativeId);
73
- this.source?.destroy();
74
- this.network?.destroy();
75
- this.decoderConfig?.destroy();
72
+ void PlayerModule.destroy(this.nativeId);
73
+ void this.source?.destroy();
74
+ void this.network?.destroy();
75
+ void this.decoderConfig?.destroy();
76
76
  this.onImaBeforeInitializationSubscription?.remove();
77
77
  this.onImaBeforeInitializationSubscription = undefined;
78
78
  this.isDestroyed = true;
@@ -88,34 +88,34 @@ export class Player extends NativeInstance {
88
88
  * Loads the downloaded content from {@link OfflineContentManager} into the player.
89
89
  */
90
90
  loadOfflineContent = (offlineContentManager, options) => {
91
- PlayerModule.loadOfflineContent(this.nativeId, offlineContentManager.nativeId, options);
91
+ void PlayerModule.loadOfflineContent(this.nativeId, offlineContentManager.nativeId, options);
92
92
  };
93
93
  /**
94
94
  * Loads the given {@link Source} into the player.
95
95
  */
96
96
  loadSource = (source) => {
97
97
  this.source = source;
98
- source.initialize().then(() => {
99
- PlayerModule.loadSource(this.nativeId, source.nativeId);
100
- });
98
+ void source
99
+ .initialize()
100
+ .then(() => PlayerModule.loadSource(this.nativeId, source.nativeId));
101
101
  };
102
102
  /**
103
103
  * Unloads all {@link Source}s from the player.
104
104
  */
105
105
  unload = () => {
106
- PlayerModule.unload(this.nativeId);
106
+ void PlayerModule.unload(this.nativeId);
107
107
  };
108
108
  /**
109
109
  * Starts or resumes playback after being paused. Has no effect if the player is already playing.
110
110
  */
111
111
  play = () => {
112
- PlayerModule.play(this.nativeId);
112
+ void PlayerModule.play(this.nativeId);
113
113
  };
114
114
  /**
115
115
  * Pauses the video if it is playing. Has no effect if the player is already paused.
116
116
  */
117
117
  pause = () => {
118
- PlayerModule.pause(this.nativeId);
118
+ void PlayerModule.pause(this.nativeId);
119
119
  };
120
120
  /**
121
121
  * Seeks to the given playback time specified by the parameter `time` in seconds. Must not be
@@ -125,7 +125,7 @@ export class Player extends NativeInstance {
125
125
  * @param time - The time to seek to in seconds.
126
126
  */
127
127
  seek = (time) => {
128
- PlayerModule.seek(this.nativeId, time);
128
+ void PlayerModule.seek(this.nativeId, time);
129
129
  };
130
130
  /**
131
131
  * Shifts the time to the given `offset` in seconds from the live edge. The resulting offset has to be within the
@@ -139,19 +139,19 @@ export class Player extends NativeInstance {
139
139
  * @param offset - Target offset from the live edge in seconds.
140
140
  */
141
141
  timeShift = (offset) => {
142
- PlayerModule.timeShift(this.nativeId, offset);
142
+ void PlayerModule.timeShift(this.nativeId, offset);
143
143
  };
144
144
  /**
145
145
  * Mutes the player if an audio track is available. Has no effect if the player is already muted.
146
146
  */
147
147
  mute = () => {
148
- PlayerModule.mute(this.nativeId);
148
+ void PlayerModule.mute(this.nativeId);
149
149
  };
150
150
  /**
151
151
  * Unmutes the player if it is muted. Has no effect if the player is already unmuted.
152
152
  */
153
153
  unmute = () => {
154
- PlayerModule.unmute(this.nativeId);
154
+ void PlayerModule.unmute(this.nativeId);
155
155
  };
156
156
  /**
157
157
  * Sets the player's volume between 0 (silent) and 100 (max volume).
@@ -159,7 +159,7 @@ export class Player extends NativeInstance {
159
159
  * @param volume - The volume level to set.
160
160
  */
161
161
  setVolume = (volume) => {
162
- PlayerModule.setVolume(this.nativeId, volume);
162
+ void PlayerModule.setVolume(this.nativeId, volume);
163
163
  };
164
164
  ensureImaBeforeInitializationListener = () => {
165
165
  const callback = this.config?.advertisingConfig?.ima?.beforeInitialization;
@@ -185,7 +185,7 @@ export class Player extends NativeInstance {
185
185
  catch {
186
186
  prepared = cloned;
187
187
  }
188
- PlayerModule.setPreparedImaSettings(id, prepared);
188
+ void PlayerModule.setPreparedImaSettings(id, prepared);
189
189
  });
190
190
  };
191
191
  /**
@@ -309,7 +309,7 @@ export class Player extends NativeInstance {
309
309
  * @platform iOS, Android
310
310
  */
311
311
  scheduleAd = (adItem) => {
312
- PlayerModule.scheduleAd(this.nativeId, adItem);
312
+ void PlayerModule.scheduleAd(this.nativeId, adItem);
313
313
  };
314
314
  /**
315
315
  * Skips the current ad.
@@ -318,7 +318,7 @@ export class Player extends NativeInstance {
318
318
  * @platform iOS, Android
319
319
  */
320
320
  skipAd = () => {
321
- PlayerModule.skipAd(this.nativeId);
321
+ void PlayerModule.skipAd(this.nativeId);
322
322
  };
323
323
  /**
324
324
  * @returns `true` while an ad is being played back or when main content playback has been paused for ad playback.
@@ -348,7 +348,7 @@ export class Player extends NativeInstance {
348
348
  * Can be set to `null` for no limitation.
349
349
  */
350
350
  setMaxSelectableBitrate = (bitrate) => {
351
- PlayerModule.setMaxSelectableBitrate(this.nativeId, bitrate || -1);
351
+ void PlayerModule.setMaxSelectableBitrate(this.nativeId, bitrate || -1);
352
352
  };
353
353
  /**
354
354
  * @returns a {@link Thumbnail} for the specified playback time for the currently active source if available.
@@ -387,7 +387,7 @@ export class Player extends NativeInstance {
387
387
  * @platform iOS, Android
388
388
  */
389
389
  castVideo = () => {
390
- PlayerModule.castVideo(this.nativeId);
390
+ void PlayerModule.castVideo(this.nativeId);
391
391
  };
392
392
  /**
393
393
  * Stops casting the current video. Has no effect if {@link Player.isCasting} is `false`.
@@ -395,7 +395,7 @@ export class Player extends NativeInstance {
395
395
  * @platform iOS, Android
396
396
  */
397
397
  castStop = () => {
398
- PlayerModule.castStop(this.nativeId);
398
+ void PlayerModule.castStop(this.nativeId);
399
399
  };
400
400
  /**
401
401
  * Returns the currently selected video quality.
@@ -422,7 +422,7 @@ export class Player extends NativeInstance {
422
422
  console.warn(`[Player ${this.nativeId}] Method setVideoQuality is not available for iOS and tvOS devices. Only Android devices.`);
423
423
  return;
424
424
  }
425
- PlayerModule.setVideoQuality(this.nativeId, qualityId);
425
+ void PlayerModule.setVideoQuality(this.nativeId, qualityId);
426
426
  };
427
427
  /**
428
428
  * Sets the playback speed of the player. Fast forward, slow motion and reverse playback are supported.
@@ -441,7 +441,7 @@ export class Player extends NativeInstance {
441
441
  * @param playbackSpeed - The playback speed to set.
442
442
  */
443
443
  setPlaybackSpeed = (playbackSpeed) => {
444
- PlayerModule.setPlaybackSpeed(this.nativeId, playbackSpeed);
444
+ void PlayerModule.setPlaybackSpeed(this.nativeId, playbackSpeed);
445
445
  };
446
446
  /**
447
447
  * @see {@link setPlaybackSpeed} for details on which values playback speed can assume.