react-native-theoplayer 3.7.0 → 3.8.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 (82) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/android/build.gradle +1 -1
  3. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/6.10.0/ads-wrapper-6.10.0.aar +0 -0
  4. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/{4.8.0/ads-wrapper-4.8.0.pom → 6.10.0/ads-wrapper-6.10.0.pom} +1 -1
  5. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/maven-metadata-local.xml +4 -4
  6. package/android/src/main/java/com/theoplayer/PlayerConfigAdapter.kt +4 -0
  7. package/android/src/main/java/com/theoplayer/ads/AdEventAdapter.kt +9 -4
  8. package/android/src/main/java/com/theoplayer/ads/AdsModule.kt +1 -1
  9. package/android/src/main/java/com/theoplayer/broadcast/EventBroadcastModule.kt +1 -1
  10. package/android/src/main/java/com/theoplayer/cache/CacheModule.kt +1 -1
  11. package/android/src/main/java/com/theoplayer/cast/CastModule.kt +1 -1
  12. package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +1 -1
  13. package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +1 -1
  14. package/ios/THEOplayerRCTBridge.m +6 -6
  15. package/ios/THEOplayerRCTPlayerAPI.swift +25 -25
  16. package/ios/ads/THEOplayerRCTAdsAPI.swift +17 -17
  17. package/ios/cache/THEOplayerRCTCacheAPI.swift +29 -29
  18. package/ios/casting/THEOplayerRCTCastAPI.swift +9 -9
  19. package/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift +22 -22
  20. package/ios/eventBroadcasting/THEOplayerRCTEventBroadcastAPI.swift +5 -5
  21. package/lib/commonjs/api/config/PlayerConfiguration.js.map +1 -1
  22. package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +18 -17
  23. package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
  24. package/lib/commonjs/internal/adapter/abr/AbrAdapter.js +2 -1
  25. package/lib/commonjs/internal/adapter/abr/AbrAdapter.js.map +1 -1
  26. package/lib/commonjs/internal/adapter/ads/THEOplayerNativeAdsAdapter.js +7 -6
  27. package/lib/commonjs/internal/adapter/ads/THEOplayerNativeAdsAdapter.js.map +1 -1
  28. package/lib/commonjs/internal/adapter/ads/THEOplayerNativeGoogleDAI.js +5 -4
  29. package/lib/commonjs/internal/adapter/ads/THEOplayerNativeGoogleDAI.js.map +1 -1
  30. package/lib/commonjs/internal/adapter/broadcast/EventBroadcastAdapter.js +2 -1
  31. package/lib/commonjs/internal/adapter/broadcast/EventBroadcastAdapter.js.map +1 -1
  32. package/lib/commonjs/internal/adapter/cast/THEOplayerNativeAirplay.js +5 -4
  33. package/lib/commonjs/internal/adapter/cast/THEOplayerNativeAirplay.js.map +1 -1
  34. package/lib/commonjs/internal/adapter/cast/THEOplayerNativeChromecast.js +7 -6
  35. package/lib/commonjs/internal/adapter/cast/THEOplayerNativeChromecast.js.map +1 -1
  36. package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js +11 -10
  37. package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
  38. package/lib/commonjs/internal/cache/MediaCache.js +4 -3
  39. package/lib/commonjs/internal/cache/MediaCache.js.map +1 -1
  40. package/lib/commonjs/internal/cache/NativeCachingTaskAdapter.js +5 -4
  41. package/lib/commonjs/internal/cache/NativeCachingTaskAdapter.js.map +1 -1
  42. package/lib/commonjs/internal/drm/ContentProtectionRegistry.js +23 -22
  43. package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -1
  44. package/lib/module/api/config/PlayerConfiguration.js.map +1 -1
  45. package/lib/module/internal/adapter/THEOplayerAdapter.js +18 -17
  46. package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
  47. package/lib/module/internal/adapter/abr/AbrAdapter.js +2 -1
  48. package/lib/module/internal/adapter/abr/AbrAdapter.js.map +1 -1
  49. package/lib/module/internal/adapter/ads/THEOplayerNativeAdsAdapter.js +7 -6
  50. package/lib/module/internal/adapter/ads/THEOplayerNativeAdsAdapter.js.map +1 -1
  51. package/lib/module/internal/adapter/ads/THEOplayerNativeGoogleDAI.js +5 -4
  52. package/lib/module/internal/adapter/ads/THEOplayerNativeGoogleDAI.js.map +1 -1
  53. package/lib/module/internal/adapter/broadcast/EventBroadcastAdapter.js +2 -1
  54. package/lib/module/internal/adapter/broadcast/EventBroadcastAdapter.js.map +1 -1
  55. package/lib/module/internal/adapter/cast/THEOplayerNativeAirplay.js +5 -4
  56. package/lib/module/internal/adapter/cast/THEOplayerNativeAirplay.js.map +1 -1
  57. package/lib/module/internal/adapter/cast/THEOplayerNativeChromecast.js +7 -6
  58. package/lib/module/internal/adapter/cast/THEOplayerNativeChromecast.js.map +1 -1
  59. package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js +11 -10
  60. package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
  61. package/lib/module/internal/cache/MediaCache.js +4 -3
  62. package/lib/module/internal/cache/MediaCache.js.map +1 -1
  63. package/lib/module/internal/cache/NativeCachingTaskAdapter.js +5 -4
  64. package/lib/module/internal/cache/NativeCachingTaskAdapter.js.map +1 -1
  65. package/lib/module/internal/drm/ContentProtectionRegistry.js +23 -22
  66. package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -1
  67. package/lib/typescript/api/config/PlayerConfiguration.d.ts +10 -0
  68. package/package.json +1 -1
  69. package/react-native-theoplayer.podspec +15 -8
  70. package/src/api/config/PlayerConfiguration.ts +11 -0
  71. package/src/internal/adapter/THEOplayerAdapter.ts +19 -17
  72. package/src/internal/adapter/abr/AbrAdapter.ts +3 -1
  73. package/src/internal/adapter/ads/THEOplayerNativeAdsAdapter.ts +8 -6
  74. package/src/internal/adapter/ads/THEOplayerNativeGoogleDAI.ts +6 -4
  75. package/src/internal/adapter/broadcast/EventBroadcastAdapter.ts +3 -1
  76. package/src/internal/adapter/cast/THEOplayerNativeAirplay.ts +6 -4
  77. package/src/internal/adapter/cast/THEOplayerNativeChromecast.ts +8 -6
  78. package/src/internal/adapter/track/TextTrackStyleAdapter.ts +11 -10
  79. package/src/internal/cache/MediaCache.ts +5 -3
  80. package/src/internal/cache/NativeCachingTaskAdapter.ts +6 -4
  81. package/src/internal/drm/ContentProtectionRegistry.ts +24 -22
  82. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/4.8.0/ads-wrapper-4.8.0.aar +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_NamedColors","_interopRequireDefault","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","namedColorsMap","NamedColors","TextTrackStyleAdapter","constructor","_view","backgroundColor","_backgroundColor","color","NativeModules","PlayerModule","setTextTrackStyle","nativeHandle","convertColorToRGBA","edgeStyle","_edgeStyle","style","fontColor","_fontColor","fontFamily","_fontFamily","family","fontSize","_fontSize","size","fromPercentage","windowColor","_windowColor","marginBottom","_marginBottom","margin","marginLeft","_marginLeft","marginRight","_marginRight","marginTop","_marginTop","exports","replace","toLowerCase","colorPattern","match","r","parseInt","g","b","a","pct","parseFloat"],"sources":["TextTrackStyleAdapter.ts"],"sourcesContent":["import type { EdgeStyle, TextTrackStyle, THEOplayerView } from 'react-native-theoplayer';\nimport { NativeModules } from 'react-native';\nimport NamedColors from './NamedColors.json';\n\nconst namedColorsMap = NamedColors as { [name: string]: string };\n\nexport class TextTrackStyleAdapter implements TextTrackStyle {\n private _backgroundColor: string | undefined = undefined;\n private _edgeStyle: EdgeStyle | undefined = undefined;\n private _fontColor: string | undefined = undefined;\n private _fontFamily: string | undefined = undefined;\n private _fontSize: string | undefined = undefined;\n private _windowColor: string | undefined = undefined;\n private _marginBottom: number | undefined = undefined;\n private _marginTop: number | undefined = undefined;\n private _marginLeft: number | undefined = undefined;\n private _marginRight: number | undefined = undefined;\n\n constructor(private readonly _view: THEOplayerView) {}\n\n get backgroundColor(): string | undefined {\n return this._backgroundColor;\n }\n\n set backgroundColor(color: string | undefined) {\n this._backgroundColor = color;\n NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n backgroundColor: convertColorToRGBA(color),\n });\n }\n\n get edgeStyle(): EdgeStyle | undefined {\n return this._edgeStyle;\n }\n\n set edgeStyle(style: EdgeStyle | undefined) {\n this._edgeStyle = style;\n NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n edgeStyle: style,\n });\n }\n\n get fontColor(): string | undefined {\n return this._fontColor;\n }\n\n set fontColor(color: string | undefined) {\n this._fontColor = color;\n NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n fontColor: convertColorToRGBA(color),\n });\n }\n\n get fontFamily(): string | undefined {\n return this._fontFamily;\n }\n\n set fontFamily(family: string | undefined) {\n this._fontFamily = family;\n NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n fontFamily: family,\n });\n }\n\n get fontSize(): string | undefined {\n return this._fontSize;\n }\n\n set fontSize(size: string | undefined) {\n this._fontSize = size;\n NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n fontSize: fromPercentage(size),\n });\n }\n\n get windowColor(): string | undefined {\n return this._windowColor;\n }\n\n set windowColor(color: string | undefined) {\n this._windowColor = color;\n NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n windowColor: convertColorToRGBA(color),\n });\n }\n\n get marginBottom(): number | undefined {\n return this._marginBottom;\n }\n\n set marginBottom(margin: number | undefined) {\n this._marginBottom = margin;\n NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n marginBottom: margin,\n });\n }\n\n get marginLeft(): number | undefined {\n return this._marginLeft;\n }\n\n set marginLeft(margin: number | undefined) {\n this._marginLeft = margin;\n NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n marginLeft: margin,\n });\n }\n\n get marginRight(): number | undefined {\n return this._marginRight;\n }\n\n set marginRight(margin: number | undefined) {\n this._marginRight = margin;\n NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n marginRight: margin,\n });\n }\n\n get marginTop(): number | undefined {\n return this._marginTop;\n }\n\n set marginTop(margin: number | undefined) {\n this._marginTop = margin;\n NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n marginTop: margin,\n });\n }\n}\n\ninterface BridgeColor {\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\nfunction convertColorToRGBA(color: string | undefined): BridgeColor | null {\n if (!color) {\n return null;\n }\n\n color = color.replace('#', '');\n\n if (namedColorsMap[color.toLowerCase()]) {\n color = namedColorsMap[color.toLowerCase()];\n }\n\n const colorPattern = /^(?:#|0x)?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})?$/i;\n const match = color.match(colorPattern);\n\n if (!match) {\n return null;\n }\n\n const r = parseInt(match[1], 16);\n const g = parseInt(match[2], 16);\n const b = parseInt(match[3], 16);\n const a = match[4] ? parseInt(match[4], 16) : 255;\n return { r, g, b, a };\n}\n\nfunction fromPercentage(pct: string | undefined): number {\n return pct ? parseFloat(pct) : 100;\n}\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA6C,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC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AC,IAAI,CAACN,KAAK,CAACO,YAAY,EAAE;MACpEuB,SAAS,EAAEL;IACb,CAAC,CAAC;EACJ;AACF;AAACO,OAAA,CAAAlC,qBAAA,GAAAA,qBAAA;AASD,SAASU,kBAAkBA,CAACL,KAAyB,EAAsB;EACzE,IAAI,CAACA,KAAK,EAAE;IACV,OAAO,IAAI;EACb;EAEAA,KAAK,GAAGA,KAAK,CAAC8B,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;EAE9B,IAAIrC,cAAc,CAACO,KAAK,CAAC+B,WAAW,CAAC,CAAC,CAAC,EAAE;IACvC/B,KAAK,GAAGP,cAAc,CAACO,KAAK,CAAC+B,WAAW,CAAC,CAAC,CAAC;EAC7C;EAEA,MAAMC,YAAY,GAAG,+DAA+D;EACpF,MAAMC,KAAK,GAAGjC,KAAK,CAACiC,KAAK,CAACD,YAAY,CAAC;EAEvC,IAAI,CAACC,KAAK,EAAE;IACV,OAAO,IAAI;EACb;EAEA,MAAMC,CAAC,GAAGC,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;EAChC,MAAMG,CAAC,GAAGD,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;EAChC,MAAMI,CAAC,GAAGF,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;EAChC,MAAMK,CAAC,GAAGL,KAAK,CAAC,CAAC,CAAC,GAAGE,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG;EACjD,OAAO;IAAEC,CAAC;IAAEE,CAAC;IAAEC,CAAC;IAAEC;EAAE,CAAC;AACvB;AAEA,SAASrB,cAAcA,CAACsB,GAAuB,EAAU;EACvD,OAAOA,GAAG,GAAGC,UAAU,CAACD,GAAG,CAAC,GAAG,GAAG;AACpC"}
1
+ {"version":3,"names":["_reactNative","require","_NamedColors","_interopRequireDefault","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","namedColorsMap","NamedColors","NativePlayerModule","NativeModules","THEORCTPlayerModule","TextTrackStyleAdapter","constructor","_view","backgroundColor","_backgroundColor","color","setTextTrackStyle","nativeHandle","convertColorToRGBA","edgeStyle","_edgeStyle","style","fontColor","_fontColor","fontFamily","_fontFamily","family","fontSize","_fontSize","size","fromPercentage","windowColor","_windowColor","marginBottom","_marginBottom","margin","marginLeft","_marginLeft","marginRight","_marginRight","marginTop","_marginTop","exports","replace","toLowerCase","colorPattern","match","r","parseInt","g","b","a","pct","parseFloat"],"sources":["TextTrackStyleAdapter.ts"],"sourcesContent":["import type { EdgeStyle, TextTrackStyle, THEOplayerView } from 'react-native-theoplayer';\nimport { NativeModules } from 'react-native';\nimport NamedColors from './NamedColors.json';\n\nconst namedColorsMap = NamedColors as { [name: string]: string };\nconst NativePlayerModule = NativeModules.THEORCTPlayerModule;\n\nexport class TextTrackStyleAdapter implements TextTrackStyle {\n private _backgroundColor: string | undefined = undefined;\n private _edgeStyle: EdgeStyle | undefined = undefined;\n private _fontColor: string | undefined = undefined;\n private _fontFamily: string | undefined = undefined;\n private _fontSize: string | undefined = undefined;\n private _windowColor: string | undefined = undefined;\n private _marginBottom: number | undefined = undefined;\n private _marginTop: number | undefined = undefined;\n private _marginLeft: number | undefined = undefined;\n private _marginRight: number | undefined = undefined;\n\n constructor(private readonly _view: THEOplayerView) {}\n\n get backgroundColor(): string | undefined {\n return this._backgroundColor;\n }\n\n set backgroundColor(color: string | undefined) {\n this._backgroundColor = color;\n NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n backgroundColor: convertColorToRGBA(color),\n });\n }\n\n get edgeStyle(): EdgeStyle | undefined {\n return this._edgeStyle;\n }\n\n set edgeStyle(style: EdgeStyle | undefined) {\n this._edgeStyle = style;\n NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n edgeStyle: style,\n });\n }\n\n get fontColor(): string | undefined {\n return this._fontColor;\n }\n\n set fontColor(color: string | undefined) {\n this._fontColor = color;\n NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n fontColor: convertColorToRGBA(color),\n });\n }\n\n get fontFamily(): string | undefined {\n return this._fontFamily;\n }\n\n set fontFamily(family: string | undefined) {\n this._fontFamily = family;\n NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n fontFamily: family,\n });\n }\n\n get fontSize(): string | undefined {\n return this._fontSize;\n }\n\n set fontSize(size: string | undefined) {\n this._fontSize = size;\n NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n fontSize: fromPercentage(size),\n });\n }\n\n get windowColor(): string | undefined {\n return this._windowColor;\n }\n\n set windowColor(color: string | undefined) {\n this._windowColor = color;\n NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n windowColor: convertColorToRGBA(color),\n });\n }\n\n get marginBottom(): number | undefined {\n return this._marginBottom;\n }\n\n set marginBottom(margin: number | undefined) {\n this._marginBottom = margin;\n NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n marginBottom: margin,\n });\n }\n\n get marginLeft(): number | undefined {\n return this._marginLeft;\n }\n\n set marginLeft(margin: number | undefined) {\n this._marginLeft = margin;\n NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n marginLeft: margin,\n });\n }\n\n get marginRight(): number | undefined {\n return this._marginRight;\n }\n\n set marginRight(margin: number | undefined) {\n this._marginRight = margin;\n NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n marginRight: margin,\n });\n }\n\n get marginTop(): number | undefined {\n return this._marginTop;\n }\n\n set marginTop(margin: number | undefined) {\n this._marginTop = margin;\n NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, {\n marginTop: margin,\n });\n }\n}\n\ninterface BridgeColor {\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\nfunction convertColorToRGBA(color: string | undefined): BridgeColor | null {\n if (!color) {\n return null;\n }\n\n color = color.replace('#', '');\n\n if (namedColorsMap[color.toLowerCase()]) {\n color = namedColorsMap[color.toLowerCase()];\n }\n\n const colorPattern = /^(?:#|0x)?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})?$/i;\n const match = color.match(colorPattern);\n\n if (!match) {\n return null;\n }\n\n const r = parseInt(match[1], 16);\n const g = parseInt(match[2], 16);\n const b = parseInt(match[3], 16);\n const a = match[4] ? parseInt(match[4], 16) : 255;\n return { r, g, b, a };\n}\n\nfunction fromPercentage(pct: string | undefined): number {\n return pct ? parseFloat(pct) : 100;\n}\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA6C,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK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A,MAAMC,YAAY,GAAG,+DAA+D;EACpF,MAAMC,KAAK,GAAG/B,KAAK,CAAC+B,KAAK,CAACD,YAAY,CAAC;EAEvC,IAAI,CAACC,KAAK,EAAE;IACV,OAAO,IAAI;EACb;EAEA,MAAMC,CAAC,GAAGC,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;EAChC,MAAMG,CAAC,GAAGD,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;EAChC,MAAMI,CAAC,GAAGF,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;EAChC,MAAMK,CAAC,GAAGL,KAAK,CAAC,CAAC,CAAC,GAAGE,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG;EACjD,OAAO;IAAEC,CAAC;IAAEE,CAAC;IAAEC,CAAC;IAAEC;EAAE,CAAC;AACvB;AAEA,SAASrB,cAAcA,CAACsB,GAAuB,EAAU;EACvD,OAAOA,GAAG,GAAGC,UAAU,CAACD,GAAG,CAAC,GAAG,GAAG;AACpC"}
@@ -15,10 +15,11 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
15
15
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
16
16
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
17
17
  const TAG = "NativeMediaCache";
18
+ const NativeCacheModule = _reactNative.NativeModules.THEORCTCacheModule;
18
19
  class NativeMediaCache extends _DefaultEventDispatcher.DefaultEventDispatcher {
19
20
  constructor() {
20
21
  super();
21
- _defineProperty(this, "_emitter", new _reactNative.NativeEventEmitter(_reactNative.NativeModules.CacheModule));
22
+ _defineProperty(this, "_emitter", new _reactNative.NativeEventEmitter(NativeCacheModule));
22
23
  _defineProperty(this, "_status", _MediaCacheAPI.CacheStatus.uninitialised);
23
24
  _defineProperty(this, "_tasks", []);
24
25
  _defineProperty(this, "onCacheStatusChange", async event => {
@@ -85,7 +86,7 @@ class NativeMediaCache extends _DefaultEventDispatcher.DefaultEventDispatcher {
85
86
  void this.initialize();
86
87
  }
87
88
  async createTask(source, parameters) {
88
- return _reactNative.NativeModules.CacheModule.createTask(source, (0, _NativeCachingTaskParametersAdapter.toNativeCachingTaskParameters)(parameters));
89
+ return NativeCacheModule.createTask(source, (0, _NativeCachingTaskParametersAdapter.toNativeCachingTaskParameters)(parameters));
89
90
  }
90
91
  get status() {
91
92
  return this._status;
@@ -104,7 +105,7 @@ class NativeMediaCache extends _DefaultEventDispatcher.DefaultEventDispatcher {
104
105
  }
105
106
  }
106
107
  async getInitialState() {
107
- const initialState = await _reactNative.NativeModules.CacheModule.getInitialState();
108
+ const initialState = await NativeCacheModule.getInitialState();
108
109
  this._status = initialState.status;
109
110
  this._tasks = initialState.tasks.map(task => new _NativeCachingTaskAdapter.NativeCachingTaskAdapter(task));
110
111
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_MediaCacheAPI","require","_DefaultEventDispatcher","_CacheEvent","_reactNativeTheoplayer","_reactNative","_NativeCachingTaskAdapter","_NativeCachingTaskParametersAdapter","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","TAG","NativeMediaCache","DefaultEventDispatcher","constructor","NativeEventEmitter","NativeModules","CacheModule","CacheStatus","uninitialised","event","_status","getInitialState","status","dispatchEvent","type","CacheEventType","statechange","date","Date","task","NativeCachingTaskAdapter","_tasks","push","addtask","taskById","id","filter","removetask","console","warn","assign","progress","CachingTaskEventType","_emitter","addListener","onCacheStatusChange","onAddCachingTaskEvent","onRemoveCachingTaskEvent","onCachingTaskProgressEvent","onCachingTaskStatusChangeEvent","initialize","createTask","source","parameters","toNativeCachingTaskParameters","tasks","initialised","initialState","map","find","exports","MediaCache"],"sources":["MediaCache.ts"],"sourcesContent":["import { CacheStatus, MediaCacheAPI } from '../../api/cache/MediaCacheAPI';\nimport type { CachingTaskList } from '../../api/cache/CachingTaskList';\nimport { DefaultEventDispatcher } from '../adapter/event/DefaultEventDispatcher';\nimport type { CacheEventMap } from '../../api/cache/events/CacheEvent';\nimport { CacheEventType } from '../../api/cache/events/CacheEvent';\nimport type { CachingTaskProgressEvent, CachingTaskStatusChangeEvent, SourceDescription } from 'react-native-theoplayer';\nimport { CacheTaskStatus, CachingTaskEventType, TimeRange } from 'react-native-theoplayer';\nimport type { CachingTaskParameters } from '../../api/cache/CachingTaskParameters';\nimport type { CachingTask } from '../../api/cache/CachingTask';\nimport { NativeEventEmitter, NativeModules } from 'react-native';\nimport { NativeCachingTask, NativeCachingTaskAdapter } from './NativeCachingTaskAdapter';\nimport { toNativeCachingTaskParameters } from \"./NativeCachingTaskParametersAdapter\";\n\nconst TAG = \"NativeMediaCache\";\n\ninterface NativeCachingStatusChangeEvent {\n readonly id: string;\n readonly status: CacheTaskStatus;\n}\n\ninterface NativeCacheStatusChangeEvent {\n readonly status: CacheStatus;\n}\n\ninterface NativeAddCachingTaskEvent {\n readonly task: NativeCachingTask;\n}\n\ninterface NativeRemoveCachingTaskEvent {\n readonly task: NativeCachingTask;\n}\n\ninterface NativeCachingTaskProgressEvent {\n id: string;\n progress: {\n readonly duration: number;\n readonly cached: TimeRange[];\n readonly secondsCached: number;\n readonly percentageCached: number;\n readonly bytes: number;\n readonly bytesCached: number;\n };\n}\n\nexport class NativeMediaCache extends DefaultEventDispatcher<CacheEventMap> implements MediaCacheAPI {\n private _emitter: NativeEventEmitter = new NativeEventEmitter(NativeModules.CacheModule);\n private _status: CacheStatus = CacheStatus.uninitialised;\n private _tasks: NativeCachingTaskAdapter[] = [];\n\n constructor() {\n super();\n this._emitter.addListener('onCacheStatusChange', this.onCacheStatusChange);\n this._emitter.addListener('onAddCachingTaskEvent', this.onAddCachingTaskEvent);\n this._emitter.addListener('onRemoveCachingTaskEvent', this.onRemoveCachingTaskEvent);\n this._emitter.addListener('onCachingTaskProgressEvent', this.onCachingTaskProgressEvent);\n this._emitter.addListener('onCachingTaskStatusChangeEvent', this.onCachingTaskStatusChangeEvent);\n void this.initialize();\n }\n\n async createTask(source: SourceDescription, parameters: CachingTaskParameters): Promise<CachingTask> {\n return NativeModules.CacheModule.createTask(source, toNativeCachingTaskParameters(parameters));\n }\n\n get status(): CacheStatus {\n return this._status;\n }\n\n get tasks(): CachingTaskList {\n return this._tasks;\n }\n\n private async initialize(): Promise<void> {\n await this.getInitialState();\n\n // Dispatch status change event here\n if (this._status === CacheStatus.initialised) {\n await this.onCacheStatusChange({\n status: this._status,\n });\n }\n }\n\n private async getInitialState(): Promise<void> {\n const initialState = await NativeModules.CacheModule.getInitialState();\n this._status = initialState.status;\n this._tasks = initialState.tasks.map((task: NativeCachingTask) => new NativeCachingTaskAdapter(task));\n }\n\n private onCacheStatusChange = async (event: NativeCacheStatusChangeEvent) => {\n if (this._status === CacheStatus.uninitialised) {\n await this.getInitialState();\n }\n this._status = event.status;\n this.dispatchEvent({\n type: CacheEventType.statechange,\n date: new Date()\n });\n };\n\n private onAddCachingTaskEvent = (event: NativeAddCachingTaskEvent) => {\n const task= new NativeCachingTaskAdapter(event.task);\n this._tasks.push(task);\n this.dispatchEvent({\n type: CacheEventType.addtask,\n task,\n date: new Date(),\n });\n };\n\n private onRemoveCachingTaskEvent = (event: NativeRemoveCachingTaskEvent) => {\n const task = this.taskById(event.task.id);\n if (task) {\n this._tasks = this._tasks.filter((task) => task.id !== event.task.id);\n this.dispatchEvent({\n type: CacheEventType.removetask,\n task,\n date: new Date(),\n });\n } else {\n console.warn(TAG, `onRemoveCachingTaskEvent: CachingTask with id ${event.task.id} not found.`)\n }\n };\n\n private onCachingTaskProgressEvent = (event: NativeCachingTaskProgressEvent) => {\n const task = this.taskById(event.id);\n if (task) {\n Object.assign(task, { ...event.progress });\n task.dispatchEvent({\n type: CachingTaskEventType.progress,\n date: new Date(),\n } as CachingTaskProgressEvent);\n }\n };\n\n private onCachingTaskStatusChangeEvent = (event: NativeCachingStatusChangeEvent) => {\n const task = this.taskById(event.id);\n if (task) {\n Object.assign(task, { ...event });\n task.dispatchEvent({\n type: CachingTaskEventType.statechange,\n date: new Date(),\n } as CachingTaskStatusChangeEvent);\n }\n };\n\n private taskById(id: string): NativeCachingTaskAdapter | undefined {\n return this._tasks.find((task) => task.id === id);\n }\n}\n\nexport const MediaCache = new NativeMediaCache();\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,uBAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,sBAAA,GAAAH,OAAA;AAGA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAL,OAAA;AACA,IAAAM,mCAAA,GAAAN,OAAA;AAAqF,SAAAO,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAA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K,IAAIC,kDAAwB,CAACD,IAAI,CAAC,CAAC;EACvG;EA2DQK,QAAQA,CAACC,EAAU,EAAwC;IACjE,OAAO,IAAI,CAACJ,MAAM,CAAC4B,IAAI,CAAE9B,IAAI,IAAKA,IAAI,CAACM,EAAE,KAAKA,EAAE,CAAC;EACnD;AACF;AAACyB,OAAA,CAAAjD,gBAAA,GAAAA,gBAAA;AAEM,MAAMkD,UAAU,GAAAD,OAAA,CAAAC,UAAA,GAAG,IAAIlD,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"names":["_MediaCacheAPI","require","_DefaultEventDispatcher","_CacheEvent","_reactNativeTheoplayer","_reactNative","_NativeCachingTaskAdapter","_NativeCachingTaskParametersAdapter","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","TAG","NativeCacheModule","NativeModules","THEORCTCacheModule","NativeMediaCache","DefaultEventDispatcher","constructor","NativeEventEmitter","CacheStatus","uninitialised","event","_status","getInitialState","status","dispatchEvent","type","CacheEventType","statechange","date","Date","task","NativeCachingTaskAdapter","_tasks","push","addtask","taskById","id","filter","removetask","console","warn","assign","progress","CachingTaskEventType","_emitter","addListener","onCacheStatusChange","onAddCachingTaskEvent","onRemoveCachingTaskEvent","onCachingTaskProgressEvent","onCachingTaskStatusChangeEvent","initialize","createTask","source","parameters","toNativeCachingTaskParameters","tasks","initialised","initialState","map","find","exports","MediaCache"],"sources":["MediaCache.ts"],"sourcesContent":["import { CacheStatus, MediaCacheAPI } from '../../api/cache/MediaCacheAPI';\nimport type { CachingTaskList } from '../../api/cache/CachingTaskList';\nimport { DefaultEventDispatcher } from '../adapter/event/DefaultEventDispatcher';\nimport type { CacheEventMap } from '../../api/cache/events/CacheEvent';\nimport { CacheEventType } from '../../api/cache/events/CacheEvent';\nimport type { CachingTaskProgressEvent, CachingTaskStatusChangeEvent, SourceDescription } from 'react-native-theoplayer';\nimport { CacheTaskStatus, CachingTaskEventType, TimeRange } from 'react-native-theoplayer';\nimport type { CachingTaskParameters } from '../../api/cache/CachingTaskParameters';\nimport type { CachingTask } from '../../api/cache/CachingTask';\nimport { NativeEventEmitter, NativeModules } from 'react-native';\nimport { NativeCachingTask, NativeCachingTaskAdapter } from './NativeCachingTaskAdapter';\nimport { toNativeCachingTaskParameters } from \"./NativeCachingTaskParametersAdapter\";\n\nconst TAG = \"NativeMediaCache\";\n\nconst NativeCacheModule = NativeModules.THEORCTCacheModule;\n\ninterface NativeCachingStatusChangeEvent {\n readonly id: string;\n readonly status: CacheTaskStatus;\n}\n\ninterface NativeCacheStatusChangeEvent {\n readonly status: CacheStatus;\n}\n\ninterface NativeAddCachingTaskEvent {\n readonly task: NativeCachingTask;\n}\n\ninterface NativeRemoveCachingTaskEvent {\n readonly task: NativeCachingTask;\n}\n\ninterface NativeCachingTaskProgressEvent {\n id: string;\n progress: {\n readonly duration: number;\n readonly cached: TimeRange[];\n readonly secondsCached: number;\n readonly percentageCached: number;\n readonly bytes: number;\n readonly bytesCached: number;\n };\n}\n\nexport class NativeMediaCache extends DefaultEventDispatcher<CacheEventMap> implements MediaCacheAPI {\n private _emitter: NativeEventEmitter = new NativeEventEmitter(NativeCacheModule);\n private _status: CacheStatus = CacheStatus.uninitialised;\n private _tasks: NativeCachingTaskAdapter[] = [];\n\n constructor() {\n super();\n this._emitter.addListener('onCacheStatusChange', this.onCacheStatusChange);\n this._emitter.addListener('onAddCachingTaskEvent', this.onAddCachingTaskEvent);\n this._emitter.addListener('onRemoveCachingTaskEvent', this.onRemoveCachingTaskEvent);\n this._emitter.addListener('onCachingTaskProgressEvent', this.onCachingTaskProgressEvent);\n this._emitter.addListener('onCachingTaskStatusChangeEvent', this.onCachingTaskStatusChangeEvent);\n void this.initialize();\n }\n\n async createTask(source: SourceDescription, parameters: CachingTaskParameters): Promise<CachingTask> {\n return NativeCacheModule.createTask(source, toNativeCachingTaskParameters(parameters));\n }\n\n get status(): CacheStatus {\n return this._status;\n }\n\n get tasks(): CachingTaskList {\n return this._tasks;\n }\n\n private async initialize(): Promise<void> {\n await this.getInitialState();\n\n // Dispatch status change event here\n if (this._status === CacheStatus.initialised) {\n await this.onCacheStatusChange({\n status: this._status,\n });\n }\n }\n\n private async getInitialState(): Promise<void> {\n const initialState = await NativeCacheModule.getInitialState();\n this._status = initialState.status;\n this._tasks = initialState.tasks.map((task: NativeCachingTask) => new NativeCachingTaskAdapter(task));\n }\n\n private onCacheStatusChange = async (event: NativeCacheStatusChangeEvent) => {\n if (this._status === CacheStatus.uninitialised) {\n await this.getInitialState();\n }\n this._status = event.status;\n this.dispatchEvent({\n type: CacheEventType.statechange,\n date: new Date()\n });\n };\n\n private onAddCachingTaskEvent = (event: NativeAddCachingTaskEvent) => {\n const task= new NativeCachingTaskAdapter(event.task);\n this._tasks.push(task);\n this.dispatchEvent({\n type: CacheEventType.addtask,\n task,\n date: new Date(),\n });\n };\n\n private onRemoveCachingTaskEvent = (event: NativeRemoveCachingTaskEvent) => {\n const task = this.taskById(event.task.id);\n if (task) {\n this._tasks = this._tasks.filter((task) => task.id !== event.task.id);\n this.dispatchEvent({\n type: CacheEventType.removetask,\n task,\n date: new Date(),\n });\n } else {\n console.warn(TAG, `onRemoveCachingTaskEvent: CachingTask with id ${event.task.id} not found.`)\n }\n };\n\n private onCachingTaskProgressEvent = (event: NativeCachingTaskProgressEvent) => {\n const task = this.taskById(event.id);\n if (task) {\n Object.assign(task, { ...event.progress });\n task.dispatchEvent({\n type: CachingTaskEventType.progress,\n date: new Date(),\n } as CachingTaskProgressEvent);\n }\n };\n\n private onCachingTaskStatusChangeEvent = (event: NativeCachingStatusChangeEvent) => {\n const task = this.taskById(event.id);\n if (task) {\n Object.assign(task, { ...event });\n task.dispatchEvent({\n type: CachingTaskEventType.statechange,\n date: new Date(),\n } as CachingTaskStatusChangeEvent);\n }\n };\n\n private taskById(id: string): NativeCachingTaskAdapter | undefined {\n return this._tasks.find((task) => task.id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ativeCachingTaskParametersAdapter = require("./NativeCachingTaskParameters
10
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
11
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
12
12
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
+ const NativeCacheModule = _reactNative.NativeModules.THEORCTCacheModule;
13
14
  class NativeCachingTaskAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
14
15
  constructor(task) {
15
16
  super();
@@ -33,7 +34,7 @@ class NativeCachingTaskAdapter extends _DefaultEventDispatcher.DefaultEventDispa
33
34
  this.bytesCached = task.bytesCached;
34
35
  this.license = {
35
36
  renew(drmConfiguration) {
36
- _reactNative.NativeModules.CacheModule.renewLicense(task.id, drmConfiguration);
37
+ NativeCacheModule.renewLicense(task.id, drmConfiguration);
37
38
  }
38
39
  };
39
40
  this.parameters = (0, _NativeCachingTaskParametersAdapter.fromNativeCachingTaskParameters)(task.parameters);
@@ -46,13 +47,13 @@ class NativeCachingTaskAdapter extends _DefaultEventDispatcher.DefaultEventDispa
46
47
  this.status = task.status;
47
48
  }
48
49
  pause() {
49
- _reactNative.NativeModules.CacheModule.pauseCachingTask(this.id);
50
+ NativeCacheModule.pauseCachingTask(this.id);
50
51
  }
51
52
  remove() {
52
- _reactNative.NativeModules.CacheModule.removeCachingTask(this.id);
53
+ NativeCacheModule.removeCachingTask(this.id);
53
54
  }
54
55
  start() {
55
- _reactNative.NativeModules.CacheModule.startCachingTask(this.id);
56
+ NativeCacheModule.startCachingTask(this.id);
56
57
  }
57
58
  }
58
59
  exports.NativeCachingTaskAdapter = NativeCachingTaskAdapter;
@@ -1 +1 @@
1
- {"version":3,"names":["_DefaultEventDispatcher","require","_reactNative","_NativeCachingTaskParametersAdapter","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","NativeCachingTaskAdapter","DefaultEventDispatcher","constructor","task","bytes","cached","duration","id","bytesCached","license","renew","drmConfiguration","NativeModules","CacheModule","renewLicense","parameters","fromNativeCachingTaskParameters","percentageCached","secondsCached","source","status","pause","pauseCachingTask","remove","removeCachingTask","start","startCachingTask","exports"],"sources":["NativeCachingTaskAdapter.ts"],"sourcesContent":["import { DefaultEventDispatcher } from '../adapter/event/DefaultEventDispatcher';\nimport type {\n CachingTask,\n CachingTaskEventMap,\n CachingTaskLicense,\n CachingTaskParameters,\n SourceDescription,\n TimeRange,\n} from 'react-native-theoplayer';\nimport type { CacheTaskStatus } from 'react-native-theoplayer';\nimport { NativeModules } from 'react-native';\nimport type { DRMConfiguration } from 'react-native-theoplayer';\nimport { fromNativeCachingTaskParameters, NativeCachingTaskParameters } from \"./NativeCachingTaskParametersAdapter\";\n\nexport interface NativeCachingTask {\n readonly id: string;\n\n readonly status: CacheTaskStatus;\n\n readonly source: SourceDescription;\n\n readonly parameters: NativeCachingTaskParameters;\n\n readonly duration: number;\n\n readonly cached: TimeRange[];\n\n readonly secondsCached: number;\n\n readonly percentageCached: number;\n\n readonly bytes: number;\n\n readonly bytesCached: number;\n}\n\nexport class NativeCachingTaskAdapter extends DefaultEventDispatcher<CachingTaskEventMap> implements CachingTask {\n readonly bytes: number;\n readonly bytesCached: number;\n readonly cached: TimeRange[];\n readonly duration: number;\n readonly id: string;\n readonly license: CachingTaskLicense;\n readonly parameters: CachingTaskParameters;\n readonly percentageCached: number;\n readonly secondsCached: number;\n readonly source: SourceDescription;\n readonly status: CacheTaskStatus;\n\n constructor(task: NativeCachingTask) {\n super();\n this.bytes = task.bytes;\n this.cached = { ...task.cached };\n this.duration = task.duration;\n this.id = task.id;\n this.bytesCached = task.bytesCached;\n this.license = {\n renew(drmConfiguration?: DRMConfiguration) {\n NativeModules.CacheModule.renewLicense(task.id, drmConfiguration);\n },\n };\n this.parameters = fromNativeCachingTaskParameters(task.parameters);\n this.percentageCached = task.percentageCached;\n this.secondsCached = task.secondsCached;\n // TODO!\n this.source = { ...task.source };\n this.status = task.status;\n }\n\n pause(): void {\n NativeModules.CacheModule.pauseCachingTask(this.id);\n }\n\n remove(): void {\n NativeModules.CacheModule.removeCachingTask(this.id);\n }\n\n start(): void {\n NativeModules.CacheModule.startCachingTask(this.id);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AAUA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,mCAAA,GAAAF,OAAA;AAAoH,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF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C;EACtD;EAEAkB,KAAKA,CAAA,EAAS;IACZb,0BAAa,CAACC,WAAW,CAACa,gBAAgB,CAAC,IAAI,CAACnB,EAAE,CAAC;EACrD;AACF;AAACoB,OAAA,CAAA3B,wBAAA,GAAAA,wBAAA"}
1
+ {"version":3,"names":["_DefaultEventDispatcher","require","_reactNative","_NativeCachingTaskParametersAdapter","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","NativeCacheModule","NativeModules","THEORCTCacheModule","NativeCachingTaskAdapter","DefaultEventDispatcher","constructor","task","bytes","cached","duration","id","bytesCached","license","renew","drmConfiguration","renewLicense","parameters","fromNativeCachingTaskParameters","percentageCached","secondsCached","source","status","pause","pauseCachingTask","remove","removeCachingTask","start","startCachingTask","exports"],"sources":["NativeCachingTaskAdapter.ts"],"sourcesContent":["import { DefaultEventDispatcher } from '../adapter/event/DefaultEventDispatcher';\nimport type {\n CachingTask,\n CachingTaskEventMap,\n CachingTaskLicense,\n CachingTaskParameters,\n SourceDescription,\n TimeRange,\n} from 'react-native-theoplayer';\nimport type { CacheTaskStatus } from 'react-native-theoplayer';\nimport { NativeModules } from 'react-native';\nimport type { DRMConfiguration } from 'react-native-theoplayer';\nimport { fromNativeCachingTaskParameters, NativeCachingTaskParameters } from \"./NativeCachingTaskParametersAdapter\";\n\nconst NativeCacheModule = NativeModules.THEORCTCacheModule;\n\nexport interface NativeCachingTask {\n readonly id: string;\n\n readonly status: CacheTaskStatus;\n\n readonly source: SourceDescription;\n\n readonly parameters: NativeCachingTaskParameters;\n\n readonly duration: number;\n\n readonly cached: TimeRange[];\n\n readonly secondsCached: number;\n\n readonly percentageCached: number;\n\n readonly bytes: number;\n\n readonly bytesCached: number;\n}\n\nexport class NativeCachingTaskAdapter extends DefaultEventDispatcher<CachingTaskEventMap> implements CachingTask {\n readonly bytes: number;\n readonly bytesCached: number;\n readonly cached: TimeRange[];\n readonly duration: number;\n readonly id: string;\n readonly license: CachingTaskLicense;\n readonly parameters: CachingTaskParameters;\n readonly percentageCached: number;\n readonly secondsCached: number;\n readonly source: SourceDescription;\n readonly status: CacheTaskStatus;\n\n constructor(task: NativeCachingTask) {\n super();\n this.bytes = task.bytes;\n this.cached = { ...task.cached };\n this.duration = task.duration;\n this.id = task.id;\n this.bytesCached = task.bytesCached;\n this.license = {\n renew(drmConfiguration?: DRMConfiguration) {\n NativeCacheModule.renewLicense(task.id, drmConfiguration);\n },\n };\n this.parameters = fromNativeCachingTaskParameters(task.parameters);\n this.percentageCached = task.percentageCached;\n this.secondsCached = task.secondsCached;\n // TODO!\n this.source = { ...task.source };\n this.status = task.status;\n }\n\n pause(): void {\n NativeCacheModule.pauseCachingTask(this.id);\n }\n\n remove(): void {\n NativeCacheModule.removeCachingTask(this.id);\n }\n\n start(): void {\n NativeCacheModule.startCachingTask(this.id);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AAUA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,mCAAA,GAAAF,OAAA;AAAoH,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,M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e,MAAM;EAC3B;EAEAC,KAAKA,CAAA,EAAS;IACZtB,iBAAiB,CAACuB,gBAAgB,CAAC,IAAI,CAACb,EAAE,CAAC;EAC7C;EAEAc,MAAMA,CAAA,EAAS;IACbxB,iBAAiB,CAACyB,iBAAiB,CAAC,IAAI,CAACf,EAAE,CAAC;EAC9C;EAEAgB,KAAKA,CAAA,EAAS;IACZ1B,iBAAiB,CAAC2B,gBAAgB,CAAC,IAAI,CAACjB,EAAE,CAAC;EAC7C;AACF;AAACkB,OAAA,CAAAzB,wBAAA,GAAAA,wBAAA"}
@@ -13,6 +13,7 @@ var _TypeUtils = require("../utils/TypeUtils");
13
13
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
14
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
15
15
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
+ const NativeContentProtectionModule = _reactNative.NativeModules.THEORCTContentProtectionModule;
16
17
  class NativeContentProtectionRegistry {
17
18
  constructor() {
18
19
  _defineProperty(this, "emitter", void 0);
@@ -25,7 +26,7 @@ class NativeContentProtectionRegistry {
25
26
  keySystemId,
26
27
  drmConfig
27
28
  } = event;
28
- console.log('ContentProtectionModule', `onBuildIntegrationRequest ${integrationId} ${keySystemId}`);
29
+ console.log('NativeContentProtectionModule', `onBuildIntegrationRequest ${integrationId} ${keySystemId}`);
29
30
  const factory = this.getFactory(integrationId, keySystemId);
30
31
  if (factory) {
31
32
  this.currentIntegration = {
@@ -33,12 +34,12 @@ class NativeContentProtectionRegistry {
33
34
  keySystemId,
34
35
  integration: factory.build(drmConfig)
35
36
  };
36
- _reactNative.NativeModules.ContentProtectionModule.onBuildProcessed({
37
+ NativeContentProtectionModule.onBuildProcessed({
37
38
  requestId,
38
39
  resultString: 'success'
39
40
  });
40
41
  } else {
41
- _reactNative.NativeModules.ContentProtectionModule.onBuildProcessed({
42
+ NativeContentProtectionModule.onBuildProcessed({
42
43
  requestId,
43
44
  resultString: 'failed'
44
45
  });
@@ -50,20 +51,20 @@ class NativeContentProtectionRegistry {
50
51
  integrationId,
51
52
  keySystemId
52
53
  } = request;
53
- console.log('ContentProtectionModule', `onCertificateRequest ${integrationId} ${keySystemId}`);
54
+ console.log('NativeContentProtectionModule', `onCertificateRequest ${integrationId} ${keySystemId}`);
54
55
  const integration = this.getIntegration(integrationId, keySystemId);
55
56
  if (integration !== null && integration !== void 0 && integration.onCertificateRequest) {
56
57
  const result = await integration.onCertificateRequest((0, _NativeCertificateRequest.fromNativeCertificateRequest)(request));
57
58
  // TODO: we also want to support ArrayBufferView results
58
59
  if ((0, _TypeUtils.isBufferSource)(result)) {
59
60
  const nativeResponse = (0, _NativeCertificateResponse.toNativeCertificateResponseResult)(requestId, integrationId, keySystemId, result);
60
- _reactNative.NativeModules.ContentProtectionModule.onCertificateRequestProcessedAsCertificate(nativeResponse);
61
+ NativeContentProtectionModule.onCertificateRequestProcessedAsCertificate(nativeResponse);
61
62
  } else if (result) {
62
63
  const modifiedNativeRequest = (0, _NativeCertificateRequest.toNativeCertificateRequest)(requestId, integrationId, keySystemId, result);
63
- _reactNative.NativeModules.ContentProtectionModule.onCertificateRequestProcessedAsRequest(modifiedNativeRequest);
64
+ NativeContentProtectionModule.onCertificateRequestProcessedAsRequest(modifiedNativeRequest);
64
65
  }
65
66
  } else {
66
- _reactNative.NativeModules.ContentProtectionModule.onCertificateRequestProcessedAsRequest(request);
67
+ NativeContentProtectionModule.onCertificateRequestProcessedAsRequest(request);
67
68
  }
68
69
  });
69
70
  _defineProperty(this, "onCertificateResponse", async response => {
@@ -72,15 +73,15 @@ class NativeContentProtectionRegistry {
72
73
  integrationId,
73
74
  keySystemId
74
75
  } = response;
75
- console.log('ContentProtectionModule', `onCertificateResponse ${integrationId} ${keySystemId}`);
76
+ console.log('NativeContentProtectionModule', `onCertificateResponse ${integrationId} ${keySystemId}`);
76
77
  const integration = this.getIntegration(integrationId, keySystemId);
77
78
  if (integration !== null && integration !== void 0 && integration.onCertificateResponse) {
78
79
  const responseResult = await integration.onCertificateResponse((0, _NativeCertificateResponse.fromNativeCertificateResponse)(response));
79
80
  // TODO: we also want to support ArrayBufferView results
80
81
  const modifiedNativeResponse = (0, _NativeCertificateResponse.toNativeCertificateResponseResult)(requestId, integrationId, keySystemId, responseResult);
81
- _reactNative.NativeModules.ContentProtectionModule.onCertificateResponseProcessed(modifiedNativeResponse);
82
+ NativeContentProtectionModule.onCertificateResponseProcessed(modifiedNativeResponse);
82
83
  } else {
83
- _reactNative.NativeModules.ContentProtectionModule.onCertificateResponseProcessed(response);
84
+ NativeContentProtectionModule.onCertificateResponseProcessed(response);
84
85
  }
85
86
  });
86
87
  _defineProperty(this, "onLicenseRequest", async request => {
@@ -89,7 +90,7 @@ class NativeContentProtectionRegistry {
89
90
  integrationId,
90
91
  keySystemId
91
92
  } = request;
92
- console.log('ContentProtectionModule', `onLicenseRequest ${integrationId} ${keySystemId}`);
93
+ console.log('NativeContentProtectionModule', `onLicenseRequest ${integrationId} ${keySystemId}`);
93
94
  const integration = this.getIntegration(integrationId, keySystemId);
94
95
  // Optionally let the custom integration modify the request.
95
96
  if (integration !== null && integration !== void 0 && integration.onLicenseRequest) {
@@ -97,13 +98,13 @@ class NativeContentProtectionRegistry {
97
98
  // TODO: we also want to support ArrayBufferView results
98
99
  if ((0, _TypeUtils.isBufferSource)(result)) {
99
100
  const nativeResponse = (0, _NativeLicenseResponse.toNativeLicenseResponseResult)(requestId, integrationId, keySystemId, result);
100
- _reactNative.NativeModules.ContentProtectionModule.onLicenseRequestProcessedAsLicense(nativeResponse);
101
+ NativeContentProtectionModule.onLicenseRequestProcessedAsLicense(nativeResponse);
101
102
  } else if (result) {
102
103
  const modifiedNativeRequest = (0, _NativeLicenseRequest.toNativeLicenseRequest)(requestId, integrationId, keySystemId, result);
103
- _reactNative.NativeModules.ContentProtectionModule.onLicenseRequestProcessedAsRequest(modifiedNativeRequest);
104
+ NativeContentProtectionModule.onLicenseRequestProcessedAsRequest(modifiedNativeRequest);
104
105
  }
105
106
  } else {
106
- _reactNative.NativeModules.ContentProtectionModule.onLicenseRequestProcessedAsRequest(request);
107
+ NativeContentProtectionModule.onLicenseRequestProcessedAsRequest(request);
107
108
  }
108
109
  });
109
110
  _defineProperty(this, "onLicenseResponse", async response => {
@@ -112,15 +113,15 @@ class NativeContentProtectionRegistry {
112
113
  integrationId,
113
114
  keySystemId
114
115
  } = response;
115
- console.log('ContentProtectionModule', `onLicenseResponse ${integrationId} ${keySystemId}`);
116
+ console.log('NativeContentProtectionModule', `onLicenseResponse ${integrationId} ${keySystemId}`);
116
117
  const integration = this.getIntegration(integrationId, keySystemId);
117
118
  if (integration !== null && integration !== void 0 && integration.onLicenseResponse) {
118
119
  const responseResult = await integration.onLicenseResponse((0, _NativeLicenseResponse.fromNativeLicenseResponse)(response));
119
120
  // TODO: we also want to support ArrayBufferView results
120
121
  const modifiedNativeResponse = (0, _NativeLicenseResponse.toNativeLicenseResponseResult)(requestId, integrationId, keySystemId, responseResult);
121
- _reactNative.NativeModules.ContentProtectionModule.onLicenseResponseProcessed(modifiedNativeResponse);
122
+ NativeContentProtectionModule.onLicenseResponseProcessed(modifiedNativeResponse);
122
123
  } else {
123
- _reactNative.NativeModules.ContentProtectionModule.onLicenseResponseProcessed(response);
124
+ NativeContentProtectionModule.onLicenseResponseProcessed(response);
124
125
  }
125
126
  });
126
127
  _defineProperty(this, "onExtractFairplayContentId", async event => {
@@ -130,23 +131,23 @@ class NativeContentProtectionRegistry {
130
131
  fairplaySkdUrl,
131
132
  requestId
132
133
  } = event;
133
- console.log('ContentProtectionModule', `onExtractFairplayContentId ${integrationId} ${keySystemId}`);
134
+ console.log('NativeContentProtectionModule', `onExtractFairplayContentId ${integrationId} ${keySystemId}`);
134
135
  const integration = this.getIntegration(integrationId, keySystemId);
135
136
  if (integration !== null && integration !== void 0 && integration.extractFairplayContentId) {
136
137
  const contentId = await integration.extractFairplayContentId(fairplaySkdUrl);
137
- _reactNative.NativeModules.ContentProtectionModule.onExtractFairplayContentIdProcessed({
138
+ NativeContentProtectionModule.onExtractFairplayContentIdProcessed({
138
139
  requestId,
139
140
  contentId
140
141
  });
141
142
  } else {
142
143
  const contentId = fairplaySkdUrl;
143
- _reactNative.NativeModules.ContentProtectionModule.onExtractFairplayContentIdProcessed({
144
+ NativeContentProtectionModule.onExtractFairplayContentIdProcessed({
144
145
  requestId,
145
146
  contentId
146
147
  });
147
148
  }
148
149
  });
149
- this.emitter = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.ContentProtectionModule);
150
+ this.emitter = new _reactNative.NativeEventEmitter(NativeContentProtectionModule);
150
151
  this.emitter.addListener('onBuildIntegration', this.onBuildIntegrationRequest);
151
152
  this.emitter.addListener('onCertificateRequest', this.onCertificateRequest);
152
153
  this.emitter.addListener('onCertificateResponse', this.onCertificateResponse);
@@ -160,7 +161,7 @@ class NativeContentProtectionRegistry {
160
161
  keySystemId,
161
162
  integrationFactory
162
163
  });
163
- _reactNative.NativeModules.ContentProtectionModule.registerContentProtectionIntegration(integrationId, keySystemId);
164
+ NativeContentProtectionModule.registerContentProtectionIntegration(integrationId, keySystemId);
164
165
  }
165
166
  getFactory(integrationId, keySystemId) {
166
167
  var _this$registeredFacto;
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_NativeLicenseRequest","_NativeLicenseResponse","_NativeCertificateRequest","_NativeCertificateResponse","_TypeUtils","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","NativeContentProtectionRegistry","constructor","event","requestId","integrationId","keySystemId","drmConfig","console","log","factory","getFactory","currentIntegration","integration","build","NativeModules","ContentProtectionModule","onBuildProcessed","resultString","request","getIntegration","onCertificateRequest","result","fromNativeCertificateRequest","isBufferSource","nativeResponse","toNativeCertificateResponseResult","onCertificateRequestProcessedAsCertificate","modifiedNativeRequest","toNativeCertificateRequest","onCertificateRequestProcessedAsRequest","response","onCertificateResponse","responseResult","fromNativeCertificateResponse","modifiedNativeResponse","onCertificateResponseProcessed","onLicenseRequest","fromNativeLicenseRequest","toNativeLicenseResponseResult","onLicenseRequestProcessedAsLicense","toNativeLicenseRequest","onLicenseRequestProcessedAsRequest","onLicenseResponse","fromNativeLicenseResponse","onLicenseResponseProcessed","fairplaySkdUrl","extractFairplayContentId","contentId","onExtractFairplayContentIdProcessed","emitter","NativeEventEmitter","addListener","onBuildIntegrationRequest","onExtractFairplayContentId","registerContentProtectionIntegration","integrationFactory","registeredFactories","push","_this$registeredFacto","find","init","_this$currentIntegrat","_this$currentIntegrat2","_this$currentIntegrat3","exports","ContentProtectionRegistry"],"sources":["ContentProtectionRegistry.ts"],"sourcesContent":["import type { CertificateRequest, ContentProtectionAPI, DRMConfiguration, LicenseRequest } from 'react-native-theoplayer';\nimport type { KeySystemId } from 'react-native-theoplayer';\nimport type { ContentProtectionIntegrationFactory } from 'react-native-theoplayer';\nimport { NativeEventEmitter, NativeModules } from 'react-native';\nimport type { ContentProtectionIntegration } from 'react-native-theoplayer';\nimport type { NativeContentProtectionEvent } from './NativeContentProtectionEvent';\nimport { fromNativeLicenseRequest, NativeLicenseRequest, toNativeLicenseRequest } from './NativeLicenseRequest';\nimport { fromNativeLicenseResponse, NativeLicenseResponse, toNativeLicenseResponseResult } from './NativeLicenseResponse';\nimport { fromNativeCertificateRequest, NativeCertificateRequest, toNativeCertificateRequest } from './NativeCertificateRequest';\nimport { fromNativeCertificateResponse, NativeCertificateResponse, toNativeCertificateResponseResult } from './NativeCertificateResponse';\nimport { isBufferSource } from '../utils/TypeUtils';\n\ninterface WrappedContentProtectionIntegrationFactory {\n integrationId: string;\n keySystemId: string;\n integrationFactory: ContentProtectionIntegrationFactory;\n}\n\ninterface WrappedContentProtectionIntegration {\n integrationId: string;\n keySystemId: string;\n integration: ContentProtectionIntegration;\n}\n\ninterface BuildEvent extends NativeContentProtectionEvent {\n drmConfig: DRMConfiguration;\n}\n\ninterface ExtractFaiplayContentIdEvent extends NativeContentProtectionEvent {\n fairplaySkdUrl: string;\n}\n\nexport class NativeContentProtectionRegistry implements ContentProtectionAPI {\n private emitter: NativeEventEmitter;\n private registeredFactories: WrappedContentProtectionIntegrationFactory[] = [];\n private currentIntegration: WrappedContentProtectionIntegration | undefined = undefined;\n\n constructor() {\n this.emitter = new NativeEventEmitter(NativeModules.ContentProtectionModule);\n this.emitter.addListener('onBuildIntegration', this.onBuildIntegrationRequest);\n this.emitter.addListener('onCertificateRequest', this.onCertificateRequest);\n this.emitter.addListener('onCertificateResponse', this.onCertificateResponse);\n this.emitter.addListener('onLicenseRequest', this.onLicenseRequest);\n this.emitter.addListener('onLicenseResponse', this.onLicenseResponse);\n this.emitter.addListener('onExtractFairplayContentId', this.onExtractFairplayContentId);\n }\n\n registerContentProtectionIntegration(integrationId: string, keySystemId: KeySystemId, integrationFactory: ContentProtectionIntegrationFactory) {\n this.registeredFactories.push({\n integrationId,\n keySystemId,\n integrationFactory,\n });\n NativeModules.ContentProtectionModule.registerContentProtectionIntegration(integrationId, keySystemId);\n }\n\n private getFactory(integrationId: string, keySystemId: string): ContentProtectionIntegrationFactory | undefined {\n return this.registeredFactories.find((init) => init.integrationId === integrationId && init.keySystemId === keySystemId)?.integrationFactory;\n }\n\n private getIntegration(integrationId: string, keySystemId: string): ContentProtectionIntegration | undefined {\n return this.currentIntegration?.integrationId === integrationId && this.currentIntegration?.keySystemId === keySystemId\n ? this.currentIntegration?.integration\n : undefined;\n }\n\n private onBuildIntegrationRequest = (event: BuildEvent) => {\n const { requestId, integrationId, keySystemId, drmConfig } = event;\n console.log('ContentProtectionModule', `onBuildIntegrationRequest ${integrationId} ${keySystemId}`);\n const factory = this.getFactory(integrationId, keySystemId);\n if (factory) {\n this.currentIntegration = {\n integrationId,\n keySystemId,\n integration: factory.build(drmConfig),\n };\n NativeModules.ContentProtectionModule.onBuildProcessed({ requestId, resultString: 'success' });\n } else {\n NativeModules.ContentProtectionModule.onBuildProcessed({\n requestId,\n resultString: 'failed',\n });\n }\n };\n\n private onCertificateRequest = async (request: NativeCertificateRequest) => {\n const { requestId, integrationId, keySystemId } = request;\n console.log('ContentProtectionModule', `onCertificateRequest ${integrationId} ${keySystemId}`);\n const integration = this.getIntegration(integrationId, keySystemId);\n if (integration?.onCertificateRequest) {\n const result = await integration.onCertificateRequest(fromNativeCertificateRequest(request));\n // TODO: we also want to support ArrayBufferView results\n if (isBufferSource(result)) {\n const nativeResponse = toNativeCertificateResponseResult(requestId, integrationId, keySystemId, result as ArrayBuffer);\n NativeModules.ContentProtectionModule.onCertificateRequestProcessedAsCertificate(nativeResponse);\n } else if (result as CertificateRequest) {\n const modifiedNativeRequest = toNativeCertificateRequest(requestId, integrationId, keySystemId, result as CertificateRequest);\n NativeModules.ContentProtectionModule.onCertificateRequestProcessedAsRequest(modifiedNativeRequest);\n }\n } else {\n NativeModules.ContentProtectionModule.onCertificateRequestProcessedAsRequest(request);\n }\n };\n\n private onCertificateResponse = async (response: NativeCertificateResponse) => {\n const { requestId, integrationId, keySystemId } = response;\n console.log('ContentProtectionModule', `onCertificateResponse ${integrationId} ${keySystemId}`);\n const integration = this.getIntegration(integrationId, keySystemId);\n if (integration?.onCertificateResponse) {\n const responseResult = await integration.onCertificateResponse(fromNativeCertificateResponse(response));\n // TODO: we also want to support ArrayBufferView results\n const modifiedNativeResponse = toNativeCertificateResponseResult(requestId, integrationId, keySystemId, responseResult as ArrayBuffer);\n NativeModules.ContentProtectionModule.onCertificateResponseProcessed(modifiedNativeResponse);\n } else {\n NativeModules.ContentProtectionModule.onCertificateResponseProcessed(response);\n }\n };\n\n private onLicenseRequest = async (request: NativeLicenseRequest) => {\n const { requestId, integrationId, keySystemId } = request;\n console.log('ContentProtectionModule', `onLicenseRequest ${integrationId} ${keySystemId}`);\n const integration = this.getIntegration(integrationId, keySystemId);\n // Optionally let the custom integration modify the request.\n if (integration?.onLicenseRequest) {\n const result = await integration.onLicenseRequest(fromNativeLicenseRequest(request));\n // TODO: we also want to support ArrayBufferView results\n if (isBufferSource(result)) {\n const nativeResponse = toNativeLicenseResponseResult(requestId, integrationId, keySystemId, result as ArrayBuffer);\n NativeModules.ContentProtectionModule.onLicenseRequestProcessedAsLicense(nativeResponse);\n } else if (result as LicenseRequest) {\n const modifiedNativeRequest = toNativeLicenseRequest(requestId, integrationId, keySystemId, result as LicenseRequest);\n NativeModules.ContentProtectionModule.onLicenseRequestProcessedAsRequest(modifiedNativeRequest);\n }\n } else {\n NativeModules.ContentProtectionModule.onLicenseRequestProcessedAsRequest(request);\n }\n };\n\n private onLicenseResponse = async (response: NativeLicenseResponse) => {\n const { requestId, integrationId, keySystemId } = response;\n console.log('ContentProtectionModule', `onLicenseResponse ${integrationId} ${keySystemId}`);\n const integration = this.getIntegration(integrationId, keySystemId);\n if (integration?.onLicenseResponse) {\n const responseResult = await integration.onLicenseResponse(fromNativeLicenseResponse(response));\n // TODO: we also want to support ArrayBufferView results\n const modifiedNativeResponse = toNativeLicenseResponseResult(requestId, integrationId, keySystemId, responseResult as ArrayBuffer);\n NativeModules.ContentProtectionModule.onLicenseResponseProcessed(modifiedNativeResponse);\n } else {\n NativeModules.ContentProtectionModule.onLicenseResponseProcessed(response);\n }\n };\n\n private onExtractFairplayContentId = async (event: ExtractFaiplayContentIdEvent) => {\n const { integrationId, keySystemId, fairplaySkdUrl, requestId } = event;\n console.log('ContentProtectionModule', `onExtractFairplayContentId ${integrationId} ${keySystemId}`);\n const integration = this.getIntegration(integrationId, keySystemId);\n if (integration?.extractFairplayContentId) {\n const contentId = await integration.extractFairplayContentId(fairplaySkdUrl);\n NativeModules.ContentProtectionModule.onExtractFairplayContentIdProcessed({\n requestId,\n contentId,\n });\n } else {\n const contentId = fairplaySkdUrl;\n NativeModules.ContentProtectionModule.onExtractFairplayContentIdProcessed({\n requestId,\n contentId,\n });\n }\n };\n}\n\nexport const ContentProtectionRegistry = new NativeContentProtectionRegistry();\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAAoD,SAAAM,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAsB7C,MAAMU,+BAA+B,CAAiC;EAK3EC,WAAWA,CAAA,EAAG;IAAAxB,eAAA;IAAAA,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AAa,MAAKA,aAAa,IAAI,EAAA0D,sBAAA,OAAI,CAACnD,kBAAkB,cAAAmD,sBAAA,uBAAvBA,sBAAA,CAAyBzD,WAAW,MAAKA,WAAW,IAAA0D,sBAAA,GACnH,IAAI,CAACpD,kBAAkB,cAAAoD,sBAAA,uBAAvBA,sBAAA,CAAyBnD,WAAW,GACpCjB,SAAS;EACf;AA0GF;AAACqE,OAAA,CAAAhE,+BAAA,GAAAA,+BAAA;AAEM,MAAMiE,yBAAyB,GAAAD,OAAA,CAAAC,yBAAA,GAAG,IAAIjE,+BAA+B,CAAC,CAAC"}
1
+ {"version":3,"names":["_reactNative","require","_NativeLicenseRequest","_NativeLicenseResponse","_NativeCertificateRequest","_NativeCertificateResponse","_TypeUtils","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","NativeContentProtectionModule","NativeModules","THEORCTContentProtectionModule","NativeContentProtectionRegistry","constructor","event","requestId","integrationId","keySystemId","drmConfig","console","log","factory","getFactory","currentIntegration","integration","build","onBuildProcessed","resultString","request","getIntegration","onCertificateRequest","result","fromNativeCertificateRequest","isBufferSource","nativeResponse","toNativeCertificateResponseResult","onCertificateRequestProcessedAsCertificate","modifiedNativeRequest","toNativeCertificateRequest","onCertificateRequestProcessedAsRequest","response","onCertificateResponse","responseResult","fromNativeCertificateResponse","modifiedNativeResponse","onCertificateResponseProcessed","onLicenseRequest","fromNativeLicenseRequest","toNativeLicenseResponseResult","onLicenseRequestProcessedAsLicense","toNativeLicenseRequest","onLicenseRequestProcessedAsRequest","onLicenseResponse","fromNativeLicenseResponse","onLicenseResponseProcessed","fairplaySkdUrl","extractFairplayContentId","contentId","onExtractFairplayContentIdProcessed","emitter","NativeEventEmitter","addListener","onBuildIntegrationRequest","onExtractFairplayContentId","registerContentProtectionIntegration","integrationFactory","registeredFactories","push","_this$registeredFacto","find","init","_this$currentIntegrat","_this$currentIntegrat2","_this$currentIntegrat3","exports","ContentProtectionRegistry"],"sources":["ContentProtectionRegistry.ts"],"sourcesContent":["import type { CertificateRequest, ContentProtectionAPI, DRMConfiguration, LicenseRequest } from 'react-native-theoplayer';\nimport type { KeySystemId } from 'react-native-theoplayer';\nimport type { ContentProtectionIntegrationFactory } from 'react-native-theoplayer';\nimport { NativeEventEmitter, NativeModules } from 'react-native';\nimport type { ContentProtectionIntegration } from 'react-native-theoplayer';\nimport type { NativeContentProtectionEvent } from './NativeContentProtectionEvent';\nimport { fromNativeLicenseRequest, NativeLicenseRequest, toNativeLicenseRequest } from './NativeLicenseRequest';\nimport { fromNativeLicenseResponse, NativeLicenseResponse, toNativeLicenseResponseResult } from './NativeLicenseResponse';\nimport { fromNativeCertificateRequest, NativeCertificateRequest, toNativeCertificateRequest } from './NativeCertificateRequest';\nimport { fromNativeCertificateResponse, NativeCertificateResponse, toNativeCertificateResponseResult } from './NativeCertificateResponse';\nimport { isBufferSource } from '../utils/TypeUtils';\n\nconst NativeContentProtectionModule = NativeModules.THEORCTContentProtectionModule;\n\ninterface WrappedContentProtectionIntegrationFactory {\n integrationId: string;\n keySystemId: string;\n integrationFactory: ContentProtectionIntegrationFactory;\n}\n\ninterface WrappedContentProtectionIntegration {\n integrationId: string;\n keySystemId: string;\n integration: ContentProtectionIntegration;\n}\n\ninterface BuildEvent extends NativeContentProtectionEvent {\n drmConfig: DRMConfiguration;\n}\n\ninterface ExtractFaiplayContentIdEvent extends NativeContentProtectionEvent {\n fairplaySkdUrl: string;\n}\n\nexport class NativeContentProtectionRegistry implements ContentProtectionAPI {\n private emitter: NativeEventEmitter;\n private registeredFactories: WrappedContentProtectionIntegrationFactory[] = [];\n private currentIntegration: WrappedContentProtectionIntegration | undefined = undefined;\n\n constructor() {\n this.emitter = new NativeEventEmitter(NativeContentProtectionModule);\n this.emitter.addListener('onBuildIntegration', this.onBuildIntegrationRequest);\n this.emitter.addListener('onCertificateRequest', this.onCertificateRequest);\n this.emitter.addListener('onCertificateResponse', this.onCertificateResponse);\n this.emitter.addListener('onLicenseRequest', this.onLicenseRequest);\n this.emitter.addListener('onLicenseResponse', this.onLicenseResponse);\n this.emitter.addListener('onExtractFairplayContentId', this.onExtractFairplayContentId);\n }\n\n registerContentProtectionIntegration(integrationId: string, keySystemId: KeySystemId, integrationFactory: ContentProtectionIntegrationFactory) {\n this.registeredFactories.push({\n integrationId,\n keySystemId,\n integrationFactory,\n });\n NativeContentProtectionModule.registerContentProtectionIntegration(integrationId, keySystemId);\n }\n\n private getFactory(integrationId: string, keySystemId: string): ContentProtectionIntegrationFactory | undefined {\n return this.registeredFactories.find((init) => init.integrationId === integrationId && init.keySystemId === keySystemId)?.integrationFactory;\n }\n\n private getIntegration(integrationId: string, keySystemId: string): ContentProtectionIntegration | undefined {\n return this.currentIntegration?.integrationId === integrationId && this.currentIntegration?.keySystemId === keySystemId\n ? this.currentIntegration?.integration\n : undefined;\n }\n\n private onBuildIntegrationRequest = (event: BuildEvent) => {\n const { requestId, integrationId, keySystemId, drmConfig } = event;\n console.log('NativeContentProtectionModule', `onBuildIntegrationRequest ${integrationId} ${keySystemId}`);\n const factory = this.getFactory(integrationId, keySystemId);\n if (factory) {\n this.currentIntegration = {\n integrationId,\n keySystemId,\n integration: factory.build(drmConfig),\n };\n NativeContentProtectionModule.onBuildProcessed({ requestId, resultString: 'success' });\n } else {\n NativeContentProtectionModule.onBuildProcessed({\n requestId,\n resultString: 'failed',\n });\n }\n };\n\n private onCertificateRequest = async (request: NativeCertificateRequest) => {\n const { requestId, integrationId, keySystemId } = request;\n console.log('NativeContentProtectionModule', `onCertificateRequest ${integrationId} ${keySystemId}`);\n const integration = this.getIntegration(integrationId, keySystemId);\n if (integration?.onCertificateRequest) {\n const result = await integration.onCertificateRequest(fromNativeCertificateRequest(request));\n // TODO: we also want to support ArrayBufferView results\n if (isBufferSource(result)) {\n const nativeResponse = toNativeCertificateResponseResult(requestId, integrationId, keySystemId, result as ArrayBuffer);\n NativeContentProtectionModule.onCertificateRequestProcessedAsCertificate(nativeResponse);\n } else if (result as CertificateRequest) {\n const modifiedNativeRequest = toNativeCertificateRequest(requestId, integrationId, keySystemId, result as CertificateRequest);\n NativeContentProtectionModule.onCertificateRequestProcessedAsRequest(modifiedNativeRequest);\n }\n } else {\n NativeContentProtectionModule.onCertificateRequestProcessedAsRequest(request);\n }\n };\n\n private onCertificateResponse = async (response: NativeCertificateResponse) => {\n const { requestId, integrationId, keySystemId } = response;\n console.log('NativeContentProtectionModule', `onCertificateResponse ${integrationId} ${keySystemId}`);\n const integration = this.getIntegration(integrationId, keySystemId);\n if (integration?.onCertificateResponse) {\n const responseResult = await integration.onCertificateResponse(fromNativeCertificateResponse(response));\n // TODO: we also want to support ArrayBufferView results\n const modifiedNativeResponse = toNativeCertificateResponseResult(requestId, integrationId, keySystemId, responseResult as ArrayBuffer);\n NativeContentProtectionModule.onCertificateResponseProcessed(modifiedNativeResponse);\n } else {\n NativeContentProtectionModule.onCertificateResponseProcessed(response);\n }\n };\n\n private onLicenseRequest = async (request: NativeLicenseRequest) => {\n const { requestId, integrationId, keySystemId } = request;\n console.log('NativeContentProtectionModule', `onLicenseRequest ${integrationId} ${keySystemId}`);\n const integration = this.getIntegration(integrationId, keySystemId);\n // Optionally let the custom integration modify the request.\n if (integration?.onLicenseRequest) {\n const result = await integration.onLicenseRequest(fromNativeLicenseRequest(request));\n // TODO: we also want to support ArrayBufferView results\n if (isBufferSource(result)) {\n const nativeResponse = toNativeLicenseResponseResult(requestId, integrationId, keySystemId, result as ArrayBuffer);\n NativeContentProtectionModule.onLicenseRequestProcessedAsLicense(nativeResponse);\n } else if (result as LicenseRequest) {\n const modifiedNativeRequest = toNativeLicenseRequest(requestId, integrationId, keySystemId, result as LicenseRequest);\n NativeContentProtectionModule.onLicenseRequestProcessedAsRequest(modifiedNativeRequest);\n }\n } else {\n NativeContentProtectionModule.onLicenseRequestProcessedAsRequest(request);\n }\n };\n\n private onLicenseResponse = async (response: NativeLicenseResponse) => {\n const { requestId, integrationId, keySystemId } = response;\n console.log('NativeContentProtectionModule', `onLicenseResponse ${integrationId} ${keySystemId}`);\n const integration = this.getIntegration(integrationId, keySystemId);\n if (integration?.onLicenseResponse) {\n const responseResult = await integration.onLicenseResponse(fromNativeLicenseResponse(response));\n // TODO: we also want to support ArrayBufferView results\n const modifiedNativeResponse = toNativeLicenseResponseResult(requestId, integrationId, keySystemId, responseResult as ArrayBuffer);\n NativeContentProtectionModule.onLicenseResponseProcessed(modifiedNativeResponse);\n } else {\n NativeContentProtectionModule.onLicenseResponseProcessed(response);\n }\n };\n\n private onExtractFairplayContentId = async (event: ExtractFaiplayContentIdEvent) => {\n const { integrationId, keySystemId, fairplaySkdUrl, requestId } = event;\n console.log('NativeContentProtectionModule', `onExtractFairplayContentId ${integrationId} ${keySystemId}`);\n const integration = this.getIntegration(integrationId, keySystemId);\n if (integration?.extractFairplayContentId) {\n const contentId = await integration.extractFairplayContentId(fairplaySkdUrl);\n NativeContentProtectionModule.onExtractFairplayContentIdProcessed({\n requestId,\n contentId,\n });\n } else {\n const contentId = fairplaySkdUrl;\n NativeContentProtectionModule.onExtractFairplayContentIdProcessed({\n requestId,\n contentId,\n });\n }\n };\n}\n\nexport const ContentProtectionRegistry = new NativeContentProtectionRegistry();\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAAoD,SAAAM,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC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EC,WAAmB,EAAmD;IAAA,IAAAmD,qBAAA;IAC9G,QAAAA,qBAAA,GAAO,IAAI,CAACF,mBAAmB,CAACG,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACtD,aAAa,KAAKA,aAAa,IAAIsD,IAAI,CAACrD,WAAW,KAAKA,WAAW,CAAC,cAAAmD,qBAAA,uBAAjHA,qBAAA,CAAmHH,kBAAkB;EAC9I;EAEQpC,cAAcA,CAACb,aAAqB,EAAEC,WAAmB,EAA4C;IAAA,IAAAsD,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA;IAC3G,OAAO,EAAAF,qBAAA,OAAI,CAAChD,kBAAkB,cAAAgD,qBAAA,uBAAvBA,qBAAA,CAAyBvD,aAAa,MAAKA,aAAa,IAAI,EAAAwD,sBAAA,OAAI,CAACjD,kBAAkB,cAAAiD,sBAAA,uBAAvBA,sBAAA,CAAyBvD,WAAW,MAAKA,WAAW,IAAAwD,sBAAA,GACnH,IAAI,CAAClD,kBAAkB,cAAAkD,sBAAA,uBAAvBA,sBAAA,CAAyBjD,WAAW,GACpCpB,SAAS;EACf;AA0GF;AAACsE,OAAA,CAAA9D,+BAAA,GAAAA,+BAAA;AAEM,MAAM+D,yBAAyB,GAAAD,OAAA,CAAAC,yBAAA,GAAG,IAAI/D,+BAA+B,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["PlayerConfiguration.ts"],"sourcesContent":["import type { AdsConfiguration } from '../ads/AdsConfiguration';\nimport type { CastConfiguration } from '../cast/CastConfiguration';\nimport type { MediaControlConfiguration } from '../media/MediaControlConfiguration';\nimport type { RetryConfiguration } from '../utils/RetryConfiguration';\nimport type { UIConfiguration } from '../ui/UIConfiguration';\n\nexport interface PlayerConfiguration {\n /**\n * The directory in which the THEOplayer library worker files are located.\n * These worker files are THEOplayer.transmux.*\n *\n * @remarks\n * <br/> - This parameter is required when using a HLS source and has no default.\n *\n * @example\n * `'/lib/theoplayer/'`\n */\n libraryLocation?: string;\n\n /**\n * The muted autoplay policy for web.\n *\n * @remarks\n * <br/> - The muted autoplay policy is impacted by this property and {@link SourceConfiguration.mutedAutoplay}.\n *\n * @defaultValue `'none'`.\n */\n mutedAutoplay?: MutedAutoplayConfiguration;\n\n /**\n * The ads configuration for the player.\n */\n ads?: AdsConfiguration;\n\n /**\n * The cast configuration for the player.\n */\n cast?: CastConfiguration;\n\n /**\n * The ui configuration for the underlying native player. Applies to Ad UI.\n */\n ui?: UIConfiguration;\n\n /**\n * The configuration of media controls and media sessions across platforms.\n */\n mediaControl?: MediaControlConfiguration;\n\n /**\n * The license for the player\n */\n readonly license?: string;\n\n /**\n * The url to fetch the license for the player\n */\n readonly licenseUrl?: string;\n\n /**\n * Sets whether the native player is chromeless (without UI).\n *\n * @remarks\n * <br/> - This parameter only applies to Web platforms.\n */\n readonly chromeless?: boolean;\n\n /**\n * Sets whether DateRange tags from the playlists should be imported as a textTrack.\n */\n readonly hlsDateRange?: boolean;\n\n /**\n * The retry configuration for the player.\n *\n * @remarks\n * <br/> - This parameter only applies to Web and Android platforms.\n */\n readonly retryConfiguration?: RetryConfiguration;\n}\n\n/**\n * The muted autoplay policy of a player for web.\n * <br/> - `'none'`: Disallow muted autoplay. If the player is requested to autoplay while unmuted, and the platform does not support unmuted autoplay, the player will not start playback.\n * <br/> - `'all'`: Allow muted autoplay. If the player is requested to autoplay while unmuted, and the platform supports muted autoplay, the player will start muted playback.\n * <br/> - `'content'`: Allow muted autoplay only for the main content. Disallow muted autoplay for e.g. advertisements. (Not yet supported.)\n *\n * @public\n */\nexport type MutedAutoplayConfiguration = 'none' | 'all' | 'content';\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["PlayerConfiguration.ts"],"sourcesContent":["import type { AdsConfiguration } from '../ads/AdsConfiguration';\nimport type { CastConfiguration } from '../cast/CastConfiguration';\nimport type { MediaControlConfiguration } from '../media/MediaControlConfiguration';\nimport type { RetryConfiguration } from '../utils/RetryConfiguration';\nimport type { UIConfiguration } from '../ui/UIConfiguration';\n\nexport interface PlayerConfiguration {\n /**\n * The directory in which the THEOplayer library worker files are located.\n * These worker files are THEOplayer.transmux.*\n *\n * @remarks\n * <br/> - This parameter is required when using a HLS source and has no default.\n *\n * @example\n * `'/lib/theoplayer/'`\n */\n libraryLocation?: string;\n\n /**\n * The muted autoplay policy for web.\n *\n * @remarks\n * <br/> - The muted autoplay policy is impacted by this property and {@link SourceConfiguration.mutedAutoplay}.\n *\n * @defaultValue `'none'`.\n */\n mutedAutoplay?: MutedAutoplayConfiguration;\n\n /**\n * The ads configuration for the player.\n */\n ads?: AdsConfiguration;\n\n /**\n * The cast configuration for the player.\n */\n cast?: CastConfiguration;\n\n /**\n * The ui configuration for the underlying native player. Applies to Ad UI.\n */\n ui?: UIConfiguration;\n\n /**\n * The configuration of media controls and media sessions across platforms.\n */\n mediaControl?: MediaControlConfiguration;\n\n /**\n * The license for the player\n */\n readonly license?: string;\n\n /**\n * The url to fetch the license for the player\n */\n readonly licenseUrl?: string;\n\n /**\n * Sets whether the native player is chromeless (without UI).\n *\n * @remarks\n * <br/> - This parameter only applies to Web platforms.\n */\n readonly chromeless?: boolean;\n\n /**\n * Sets whether DateRange tags from the playlists should be imported as a textTrack.\n */\n readonly hlsDateRange?: boolean;\n\n /**\n * The retry configuration for the player.\n *\n * @remarks\n * <br/> - This parameter only applies to Web and Android platforms.\n */\n readonly retryConfiguration?: RetryConfiguration;\n\n /**\n * The offset in seconds used to determine the live point.\n * This live point is the end of the manifest minus the provided offset.\n *\n * @defaultValue Three times the target duration of a segment, as specified by the manifest.\n *\n * @remarks\n * <br/> - This parameter only applies to Web and Android platforms.\n */\n liveOffset?: number;\n}\n\n/**\n * The muted autoplay policy of a player for web.\n * <br/> - `'none'`: Disallow muted autoplay. If the player is requested to autoplay while unmuted, and the platform does not support unmuted autoplay, the player will not start playback.\n * <br/> - `'all'`: Allow muted autoplay. If the player is requested to autoplay while unmuted, and the platform supports muted autoplay, the player will start muted playback.\n * <br/> - `'content'`: Allow muted autoplay only for the main content. Disallow muted autoplay for e.g. advertisements. (Not yet supported.)\n *\n * @public\n */\nexport type MutedAutoplayConfiguration = 'none' | 'all' | 'content';\n"],"mappings":""}