bitmovin-player-react-native 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.9.0] - 2026-02-13
4
+
5
+ ### Changed
6
+
7
+ - Android/iOS: Bitmovin Player Web UI integration migrates to v4 (checkout [What's new in UI v4](https://developer.bitmovin.com/playback/docs/whats-new-in-ui-v4))
8
+ - `WebUiConfig.variant` now resolves to v4 UIFactory names:
9
+ - `SmallScreenUi` -> `bitmovin.playerui.UIFactory.buildSmallScreenUI`
10
+ - `TvUi` -> `bitmovin.playerui.UIFactory.buildTvUI`
11
+ - UIFactory v3 names were renamed in v4. For example:
12
+ - `buildDefaultSmallScreenUI` / `buildModernSmallScreenUI` -> `buildSmallScreenUI`
13
+ - `buildDefaultTvUI` / `buildModernTvUI` -> `buildTvUI`
14
+ - If you have no UI customizations, no action is required; the new UI is used automatically
15
+ - If you ship a custom v3 bundle (even if it still uses the legacy v3 factory names), [migrate to UI v4](https://developer.bitmovin.com/playback/reference/migration-guide-v3-to-v4) or set a legacy factory explicitly via `new CustomUi('<legacy UIFactory function>')` and keep loading the v3 bundle
16
+ - iOS: When re-attaching a different Player to an existing PlayerView, fullscreen and Picture-in-Picture are exited before the swap
17
+ - Update Bitmovin's native iOS SDK version to `3.107.0`
18
+ - Update Bitmovin's native Android SDK version to `3.141.0+jason`
19
+
20
+ ### Fixed
21
+
22
+ - Event handlers could fail to fire in some setups, notably on Android with Paper (old architecture)
23
+ - iOS: Re-attaching a new Player to an existing PlayerView now cleanly resets state
24
+ - iOS: some valid FairPlay configurations could fail during source loading with an "Unsupported URL" playback error
25
+
3
26
  ## [1.8.0] - 2026-02-03
4
27
 
5
28
  ### Changed
@@ -108,6 +108,6 @@ dependencies {
108
108
 
109
109
  // Bitmovin
110
110
  implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
111
- implementation 'com.bitmovin.player:player:3.140.1+jason'
112
- implementation 'com.bitmovin.player:player-media-session:3.140.1+jason'
111
+ implementation 'com.bitmovin.player:player:3.141.0+jason'
112
+ implementation 'com.bitmovin.player:player-media-session:3.141.0+jason'
113
113
  }
@@ -751,8 +751,8 @@ private fun Map<String, Any?>.toVariant(): UiConfig.WebUi.Variant? {
751
751
  val uiManagerFactoryFunction = getMap("variant")?.getString("uiManagerFactoryFunction") ?: return null
752
752
 
753
753
  return when (uiManagerFactoryFunction) {
754
- "bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI" -> UiConfig.WebUi.Variant.SmallScreenUi
755
- "bitmovin.playerui.UIFactory.buildDefaultTvUI" -> UiConfig.WebUi.Variant.TvUi
754
+ "bitmovin.playerui.UIFactory.buildSmallScreenUI" -> UiConfig.WebUi.Variant.SmallScreenUi
755
+ "bitmovin.playerui.UIFactory.buildTvUI" -> UiConfig.WebUi.Variant.TvUi
756
756
  else -> UiConfig.WebUi.Variant.Custom(uiManagerFactoryFunction)
757
757
  }
758
758
  }
@@ -25,7 +25,7 @@ export function PlayerView({ viewRef, style, player, config, fullscreenHandler,
25
25
  useKeepAwake();
26
26
  const nativeView = useRef(viewRef?.current || null);
27
27
  // Native events proxy helper.
28
- const proxy = useProxy(nativeView);
28
+ const proxy = useProxy();
29
29
  // Style resulting from merging `baseStyle` and `props.style`.
30
30
  const nativeViewStyle = StyleSheet.flatten([styles.baseStyle, style]);
31
31
  const fullscreenBridge = useRef(undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PlayerView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAg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K,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CACjD,eAAe,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAC3C,iBAAiB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAC/C,iBAAiB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAC/C,kBAAkB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CACjD,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CACrD,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CACrD,gBAAgB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAC7C,YAAY,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CACrC,gCAAgC,CAAC,CAAC,KAAK,CACrC,KAAK,CAAC,6BAA6B,CACpC,CAAC,CACF,gCAAgC,CAAC,CAAC,KAAK,CACrC,KAAK,CAAC,6BAA6B,CACpC,CAAC,CACF,qBAAqB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,EACvD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { RefObject, useEffect, useRef, useState } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { useKeepAwake } from 'expo-keep-awake';\nimport { NativePlayerView, NativePlayerViewConfig } from './native';\nimport { useProxy } from '../../hooks/useProxy';\nimport { FullscreenHandlerBridge } from '../../ui/fullscreenhandlerbridge';\nimport { CustomMessageHandlerBridge } from '../../ui/custommessagehandlerbridge';\nimport { PlayerViewProps } from './properties';\nimport { PictureInPictureAction } from './pictureInPictureAction';\nimport { addPlatformToMetadataEvent } from '../../utils/metadataPlatform';\n\n/**\n * Base style that initializes the native view frame when no width/height prop has been set.\n */\nconst styles = StyleSheet.create({\n baseStyle: {\n alignSelf: 'stretch',\n },\n});\n\n/**\n * Component that provides the Bitmovin Player UI and default UI handling to an attached `Player` instance.\n * This component needs a `Player` instance to work properly so make sure one is passed to it as a prop.\n *\n * @param options configuration options\n */\nexport function PlayerView({\n viewRef,\n style,\n player,\n config,\n fullscreenHandler,\n customMessageHandler,\n isFullscreenRequested = false,\n scalingMode,\n isPictureInPictureRequested = false,\n pictureInPictureActions,\n ...props\n}: PlayerViewProps) {\n // Keep the device awake while the PlayerView is mounted\n useKeepAwake();\n\n const nativeView = useRef<InternalPlayerViewRef>(viewRef?.current || null);\n\n // Native events proxy helper.\n const proxy = useProxy(nativeView);\n // Style resulting from merging `baseStyle` and `props.style`.\n const nativeViewStyle = StyleSheet.flatten([styles.baseStyle, style]);\n\n const fullscreenBridge: React.RefObject<FullscreenHandlerBridge | undefined> =\n useRef(undefined);\n if (fullscreenHandler && !fullscreenBridge.current) {\n fullscreenBridge.current = new FullscreenHandlerBridge();\n }\n if (fullscreenBridge.current) {\n fullscreenBridge.current.setFullscreenHandler(fullscreenHandler);\n }\n\n const customMessageHandlerBridge: React.RefObject<\n CustomMessageHandlerBridge | undefined\n > = useRef(undefined);\n if (customMessageHandler && !customMessageHandlerBridge.current) {\n customMessageHandlerBridge.current = new CustomMessageHandlerBridge();\n }\n if (customMessageHandlerBridge.current && customMessageHandler) {\n customMessageHandlerBridge.current.setCustomMessageHandler(\n customMessageHandler\n );\n }\n\n const nativePlayerViewConfig: NativePlayerViewConfig = {\n playerId: player.nativeId,\n customMessageHandlerBridgeId: customMessageHandlerBridge.current?.nativeId,\n enableBackgroundPlayback:\n player.config?.playbackConfig?.isBackgroundPlaybackEnabled,\n isPictureInPictureEnabledOnPlayer:\n player.config?.playbackConfig?.isPictureInPictureEnabled,\n userInterfaceTypeName: player.config?.styleConfig?.userInterfaceType,\n playerViewConfig: config,\n };\n\n const [isPlayerInitialized, setIsPlayerInitialized] = useState(false);\n\n useEffect(() => {\n player.initialize().then(() => {\n setIsPlayerInitialized(true);\n // call attach player on native view if switched to AsyncFunction for RNPlayerViewExpo\n });\n\n return () => {\n fullscreenBridge.current?.destroy();\n fullscreenBridge.current = undefined;\n customMessageHandlerBridge.current?.destroy();\n customMessageHandlerBridge.current = undefined;\n };\n }, [player, fullscreenBridge, customMessageHandlerBridge]);\n\n useEffect(() => {\n if (isPlayerInitialized && viewRef) {\n viewRef.current = nativeView.current;\n }\n }, [isPlayerInitialized, viewRef, nativeView]);\n\n useEffect(() => {\n if (isPlayerInitialized && pictureInPictureActions != null) {\n nativeView.current?.updatePictureInPictureActions(\n pictureInPictureActions\n );\n }\n }, [isPlayerInitialized, pictureInPictureActions]);\n\n if (!isPlayerInitialized) {\n return null;\n }\n\n return (\n <NativePlayerView\n ref={nativeView}\n style={nativeViewStyle}\n config={nativePlayerViewConfig}\n isFullscreenRequested={isFullscreenRequested}\n isPictureInPictureRequested={isPictureInPictureRequested}\n scalingMode={scalingMode}\n fullscreenBridgeId={fullscreenBridge.current?.nativeId}\n onBmpAdBreakFinished={proxy(props.onAdBreakFinished)}\n onBmpAdBreakStarted={proxy(props.onAdBreakStarted)}\n onBmpAdClicked={proxy(props.onAdClicked)}\n onBmpAdError={proxy(props.onAdError)}\n onBmpAdFinished={proxy(props.onAdFinished)}\n onBmpAdManifestLoad={proxy(props.onAdManifestLoad)}\n onBmpAdManifestLoaded={proxy(props.onAdManifestLoaded)}\n onBmpAdQuartile={proxy(props.onAdQuartile)}\n onBmpAdScheduled={proxy(props.onAdScheduled)}\n onBmpAdSkipped={proxy(props.onAdSkipped)}\n onBmpAdStarted={proxy(props.onAdStarted)}\n onBmpCastAvailable={proxy(props.onCastAvailable)}\n onBmpCastPaused={proxy(props.onCastPaused)}\n onBmpCastPlaybackFinished={proxy(props.onCastPlaybackFinished)}\n onBmpCastPlaying={proxy(props.onCastPlaying)}\n onBmpCastStarted={proxy(props.onCastStarted)}\n onBmpCastStart={proxy(props.onCastStart)}\n onBmpCastStopped={proxy(props.onCastStopped)}\n onBmpCastTimeUpdated={proxy(props.onCastTimeUpdated)}\n onBmpCastWaitingForDevice={proxy(props.onCastWaitingForDevice)}\n onBmpCueEnter={proxy(props.onCueEnter)}\n onBmpCueExit={proxy(props.onCueExit)}\n onBmpMetadata={\n props.onMetadata\n ? (e) => props.onMetadata?.(addPlatformToMetadataEvent(e.nativeEvent))\n : undefined\n }\n onBmpMetadataParsed={\n props.onMetadataParsed\n ? (e) =>\n props.onMetadataParsed?.(\n addPlatformToMetadataEvent(e.nativeEvent)\n )\n : undefined\n }\n onBmpDestroy={proxy(props.onDestroy)}\n onBmpEvent={proxy(props.onEvent)}\n onBmpFullscreenEnabled={proxy(props.onFullscreenEnabled)}\n onBmpFullscreenDisabled={proxy(props.onFullscreenDisabled)}\n onBmpFullscreenEnter={proxy(props.onFullscreenEnter)}\n onBmpFullscreenExit={proxy(props.onFullscreenExit)}\n onBmpMuted={proxy(props.onMuted)}\n onBmpPaused={proxy(props.onPaused)}\n onBmpPictureInPictureAvailabilityChanged={proxy(\n props.onPictureInPictureAvailabilityChanged\n )}\n onBmpPictureInPictureEnter={proxy(props.onPictureInPictureEnter)}\n onBmpPictureInPictureEntered={proxy(props.onPictureInPictureEntered)}\n onBmpPictureInPictureExit={proxy(props.onPictureInPictureExit)}\n onBmpPictureInPictureExited={proxy(props.onPictureInPictureExited)}\n onBmpPlay={proxy(props.onPlay)}\n onBmpPlaybackFinished={proxy(props.onPlaybackFinished)}\n onBmpPlaybackSpeedChanged={proxy(props.onPlaybackSpeedChanged)}\n onBmpPlayerActive={proxy(props.onPlayerActive)}\n onBmpPlayerError={proxy(props.onPlayerError)}\n onBmpPlayerWarning={proxy(props.onPlayerWarning)}\n onBmpPlaying={proxy(props.onPlaying)}\n onBmpReady={proxy(props.onReady)}\n onBmpSeek={proxy(props.onSeek)}\n onBmpSeeked={proxy(props.onSeeked)}\n onBmpTimeShift={proxy(props.onTimeShift)}\n onBmpTimeShifted={proxy(props.onTimeShifted)}\n onBmpStallStarted={proxy(props.onStallStarted)}\n onBmpStallEnded={proxy(props.onStallEnded)}\n onBmpSourceError={proxy(props.onSourceError)}\n onBmpSourceLoad={proxy(props.onSourceLoad)}\n onBmpSourceLoaded={proxy(props.onSourceLoaded)}\n onBmpSourceUnloaded={proxy(props.onSourceUnloaded)}\n onBmpSourceWarning={proxy(props.onSourceWarning)}\n onBmpAudioAdded={proxy(props.onAudioAdded)}\n onBmpAudioChanged={proxy(props.onAudioChanged)}\n onBmpAudioRemoved={proxy(props.onAudioRemoved)}\n onBmpSubtitleAdded={proxy(props.onSubtitleAdded)}\n onBmpSubtitleChanged={proxy(props.onSubtitleChanged)}\n onBmpSubtitleRemoved={proxy(props.onSubtitleRemoved)}\n onBmpTimeChanged={proxy(props.onTimeChanged)}\n onBmpUnmuted={proxy(props.onUnmuted)}\n onBmpVideoDownloadQualityChanged={proxy(\n props.onVideoDownloadQualityChanged\n )}\n onBmpVideoPlaybackQualityChanged={proxy(\n props.onVideoPlaybackQualityChanged\n )}\n onBmpDownloadFinished={proxy(props.onDownloadFinished)}\n />\n );\n}\n\ninterface InternalPlayerViewRef extends RefObject<any> {\n /**\n * Update Picture in Picture actions that should be displayed on the Picture in Picture window.\n * Ideally we would just pass the props to the `NativePlayerView`, but due to a React Native limitation,\n * the props aren't passed to the native module when PiP is active on Android.\n */\n updatePictureInPictureActions: (\n actions: PictureInPictureAction[]\n ) => Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PlayerView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAA0B,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,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AC,KAAK,CAAC,YAAY,CAAC,CAAC,CAC3C,iBAAiB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAC/C,iBAAiB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAC/C,kBAAkB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CACjD,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CACrD,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CACrD,gBAAgB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAC7C,YAAY,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CACrC,gCAAgC,CAAC,CAAC,KAAK,CACrC,KAAK,CAAC,6BAA6B,CACpC,CAAC,CACF,gCAAgC,CAAC,CAAC,KAAK,CACrC,KAAK,CAAC,6BAA6B,CACpC,CAAC,CACF,qBAAqB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,EACvD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { RefObject, useEffect, useRef, useState } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { useKeepAwake } from 'expo-keep-awake';\nimport { NativePlayerView, NativePlayerViewConfig } from './native';\nimport { useProxy } from '../../hooks/useProxy';\nimport { FullscreenHandlerBridge } from '../../ui/fullscreenhandlerbridge';\nimport { CustomMessageHandlerBridge } from '../../ui/custommessagehandlerbridge';\nimport { PlayerViewProps } from './properties';\nimport { PictureInPictureAction } from './pictureInPictureAction';\nimport { addPlatformToMetadataEvent } from '../../utils/metadataPlatform';\n\n/**\n * Base style that initializes the native view frame when no width/height prop has been set.\n */\nconst styles = StyleSheet.create({\n baseStyle: {\n alignSelf: 'stretch',\n },\n});\n\n/**\n * Component that provides the Bitmovin Player UI and default UI handling to an attached `Player` instance.\n * This component needs a `Player` instance to work properly so make sure one is passed to it as a prop.\n *\n * @param options configuration options\n */\nexport function PlayerView({\n viewRef,\n style,\n player,\n config,\n fullscreenHandler,\n customMessageHandler,\n isFullscreenRequested = false,\n scalingMode,\n isPictureInPictureRequested = false,\n pictureInPictureActions,\n ...props\n}: PlayerViewProps) {\n // Keep the device awake while the PlayerView is mounted\n useKeepAwake();\n\n const nativeView = useRef<InternalPlayerViewRef>(viewRef?.current || null);\n\n // Native events proxy helper.\n const proxy = useProxy();\n // Style resulting from merging `baseStyle` and `props.style`.\n const nativeViewStyle = StyleSheet.flatten([styles.baseStyle, style]);\n\n const fullscreenBridge: React.RefObject<FullscreenHandlerBridge | undefined> =\n useRef(undefined);\n if (fullscreenHandler && !fullscreenBridge.current) {\n fullscreenBridge.current = new FullscreenHandlerBridge();\n }\n if (fullscreenBridge.current) {\n fullscreenBridge.current.setFullscreenHandler(fullscreenHandler);\n }\n\n const customMessageHandlerBridge: React.RefObject<\n CustomMessageHandlerBridge | undefined\n > = useRef(undefined);\n if (customMessageHandler && !customMessageHandlerBridge.current) {\n customMessageHandlerBridge.current = new CustomMessageHandlerBridge();\n }\n if (customMessageHandlerBridge.current && customMessageHandler) {\n customMessageHandlerBridge.current.setCustomMessageHandler(\n customMessageHandler\n );\n }\n\n const nativePlayerViewConfig: NativePlayerViewConfig = {\n playerId: player.nativeId,\n customMessageHandlerBridgeId: customMessageHandlerBridge.current?.nativeId,\n enableBackgroundPlayback:\n player.config?.playbackConfig?.isBackgroundPlaybackEnabled,\n isPictureInPictureEnabledOnPlayer:\n player.config?.playbackConfig?.isPictureInPictureEnabled,\n userInterfaceTypeName: player.config?.styleConfig?.userInterfaceType,\n playerViewConfig: config,\n };\n\n const [isPlayerInitialized, setIsPlayerInitialized] = useState(false);\n\n useEffect(() => {\n player.initialize().then(() => {\n setIsPlayerInitialized(true);\n // call attach player on native view if switched to AsyncFunction for RNPlayerViewExpo\n });\n\n return () => {\n fullscreenBridge.current?.destroy();\n fullscreenBridge.current = undefined;\n customMessageHandlerBridge.current?.destroy();\n customMessageHandlerBridge.current = undefined;\n };\n }, [player, fullscreenBridge, customMessageHandlerBridge]);\n\n useEffect(() => {\n if (isPlayerInitialized && viewRef) {\n viewRef.current = nativeView.current;\n }\n }, [isPlayerInitialized, viewRef, nativeView]);\n\n useEffect(() => {\n if (isPlayerInitialized && pictureInPictureActions != null) {\n nativeView.current?.updatePictureInPictureActions(\n pictureInPictureActions\n );\n }\n }, [isPlayerInitialized, pictureInPictureActions]);\n\n if (!isPlayerInitialized) {\n return null;\n }\n\n return (\n <NativePlayerView\n ref={nativeView}\n style={nativeViewStyle}\n config={nativePlayerViewConfig}\n isFullscreenRequested={isFullscreenRequested}\n isPictureInPictureRequested={isPictureInPictureRequested}\n scalingMode={scalingMode}\n fullscreenBridgeId={fullscreenBridge.current?.nativeId}\n onBmpAdBreakFinished={proxy(props.onAdBreakFinished)}\n onBmpAdBreakStarted={proxy(props.onAdBreakStarted)}\n onBmpAdClicked={proxy(props.onAdClicked)}\n onBmpAdError={proxy(props.onAdError)}\n onBmpAdFinished={proxy(props.onAdFinished)}\n onBmpAdManifestLoad={proxy(props.onAdManifestLoad)}\n onBmpAdManifestLoaded={proxy(props.onAdManifestLoaded)}\n onBmpAdQuartile={proxy(props.onAdQuartile)}\n onBmpAdScheduled={proxy(props.onAdScheduled)}\n onBmpAdSkipped={proxy(props.onAdSkipped)}\n onBmpAdStarted={proxy(props.onAdStarted)}\n onBmpCastAvailable={proxy(props.onCastAvailable)}\n onBmpCastPaused={proxy(props.onCastPaused)}\n onBmpCastPlaybackFinished={proxy(props.onCastPlaybackFinished)}\n onBmpCastPlaying={proxy(props.onCastPlaying)}\n onBmpCastStarted={proxy(props.onCastStarted)}\n onBmpCastStart={proxy(props.onCastStart)}\n onBmpCastStopped={proxy(props.onCastStopped)}\n onBmpCastTimeUpdated={proxy(props.onCastTimeUpdated)}\n onBmpCastWaitingForDevice={proxy(props.onCastWaitingForDevice)}\n onBmpCueEnter={proxy(props.onCueEnter)}\n onBmpCueExit={proxy(props.onCueExit)}\n onBmpMetadata={\n props.onMetadata\n ? (e) => props.onMetadata?.(addPlatformToMetadataEvent(e.nativeEvent))\n : undefined\n }\n onBmpMetadataParsed={\n props.onMetadataParsed\n ? (e) =>\n props.onMetadataParsed?.(\n addPlatformToMetadataEvent(e.nativeEvent)\n )\n : undefined\n }\n onBmpDestroy={proxy(props.onDestroy)}\n onBmpEvent={proxy(props.onEvent)}\n onBmpFullscreenEnabled={proxy(props.onFullscreenEnabled)}\n onBmpFullscreenDisabled={proxy(props.onFullscreenDisabled)}\n onBmpFullscreenEnter={proxy(props.onFullscreenEnter)}\n onBmpFullscreenExit={proxy(props.onFullscreenExit)}\n onBmpMuted={proxy(props.onMuted)}\n onBmpPaused={proxy(props.onPaused)}\n onBmpPictureInPictureAvailabilityChanged={proxy(\n props.onPictureInPictureAvailabilityChanged\n )}\n onBmpPictureInPictureEnter={proxy(props.onPictureInPictureEnter)}\n onBmpPictureInPictureEntered={proxy(props.onPictureInPictureEntered)}\n onBmpPictureInPictureExit={proxy(props.onPictureInPictureExit)}\n onBmpPictureInPictureExited={proxy(props.onPictureInPictureExited)}\n onBmpPlay={proxy(props.onPlay)}\n onBmpPlaybackFinished={proxy(props.onPlaybackFinished)}\n onBmpPlaybackSpeedChanged={proxy(props.onPlaybackSpeedChanged)}\n onBmpPlayerActive={proxy(props.onPlayerActive)}\n onBmpPlayerError={proxy(props.onPlayerError)}\n onBmpPlayerWarning={proxy(props.onPlayerWarning)}\n onBmpPlaying={proxy(props.onPlaying)}\n onBmpReady={proxy(props.onReady)}\n onBmpSeek={proxy(props.onSeek)}\n onBmpSeeked={proxy(props.onSeeked)}\n onBmpTimeShift={proxy(props.onTimeShift)}\n onBmpTimeShifted={proxy(props.onTimeShifted)}\n onBmpStallStarted={proxy(props.onStallStarted)}\n onBmpStallEnded={proxy(props.onStallEnded)}\n onBmpSourceError={proxy(props.onSourceError)}\n onBmpSourceLoad={proxy(props.onSourceLoad)}\n onBmpSourceLoaded={proxy(props.onSourceLoaded)}\n onBmpSourceUnloaded={proxy(props.onSourceUnloaded)}\n onBmpSourceWarning={proxy(props.onSourceWarning)}\n onBmpAudioAdded={proxy(props.onAudioAdded)}\n onBmpAudioChanged={proxy(props.onAudioChanged)}\n onBmpAudioRemoved={proxy(props.onAudioRemoved)}\n onBmpSubtitleAdded={proxy(props.onSubtitleAdded)}\n onBmpSubtitleChanged={proxy(props.onSubtitleChanged)}\n onBmpSubtitleRemoved={proxy(props.onSubtitleRemoved)}\n onBmpTimeChanged={proxy(props.onTimeChanged)}\n onBmpUnmuted={proxy(props.onUnmuted)}\n onBmpVideoDownloadQualityChanged={proxy(\n props.onVideoDownloadQualityChanged\n )}\n onBmpVideoPlaybackQualityChanged={proxy(\n props.onVideoPlaybackQualityChanged\n )}\n onBmpDownloadFinished={proxy(props.onDownloadFinished)}\n />\n );\n}\n\ninterface InternalPlayerViewRef extends RefObject<any> {\n /**\n * Update Picture in Picture actions that should be displayed on the Picture in Picture window.\n * Ideally we would just pass the props to the `NativePlayerView`, but due to a React Native limitation,\n * the props aren't passed to the native module when PiP is active on Android.\n */\n updatePictureInPictureActions: (\n actions: PictureInPictureAction[]\n ) => Promise<void>;\n}\n"]}
@@ -85,8 +85,8 @@ export declare abstract class Variant {
85
85
  * Example:
86
86
  * When you added a new function or want to use a different function of our `UIFactory`,
87
87
  * you can specify the full qualifier name including namespaces.
88
- * e.g. `bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI` for the SmallScreenUi.
89
- * @see UIFactory https://github.com/bitmovin/bitmovin-player-ui/blob/develop/src/ts/uifactory.ts#L60
88
+ * e.g. `bitmovin.playerui.UIFactory.buildSmallScreenUI` for the SmallScreenUi.
89
+ * @see UIFactory https://github.com/bitmovin/bitmovin-player-ui/blob/develop/src/ts/UIFactory.ts
90
90
  *
91
91
  * Notes:
92
92
  * - It's not necessary to use our `UIFactory`. Any static function can be specified.
@@ -10,8 +10,8 @@ export class Variant {
10
10
  * Example:
11
11
  * When you added a new function or want to use a different function of our `UIFactory`,
12
12
  * you can specify the full qualifier name including namespaces.
13
- * e.g. `bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI` for the SmallScreenUi.
14
- * @see UIFactory https://github.com/bitmovin/bitmovin-player-ui/blob/develop/src/ts/uifactory.ts#L60
13
+ * e.g. `bitmovin.playerui.UIFactory.buildSmallScreenUI` for the SmallScreenUi.
14
+ * @see UIFactory https://github.com/bitmovin/bitmovin-player-ui/blob/develop/src/ts/UIFactory.ts
15
15
  *
16
16
  * Notes:
17
17
  * - It's not necessary to use our `UIFactory`. Any static function can be specified.
@@ -22,12 +22,12 @@ export class Variant {
22
22
  }
23
23
  export class SmallScreenUi extends Variant {
24
24
  constructor() {
25
- super('bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI');
25
+ super('bitmovin.playerui.UIFactory.buildSmallScreenUI');
26
26
  }
27
27
  }
28
28
  export class TvUi extends Variant {
29
29
  constructor() {
30
- super('bitmovin.playerui.UIFactory.buildDefaultTvUI');
30
+ super('bitmovin.playerui.UIFactory.buildTvUI');
31
31
  }
32
32
  }
33
33
  export class CustomUi extends Variant {
@@ -1 +1 @@
1
- {"version":3,"file":"playerViewConfig.js","sourceRoot":"","sources":["../../../src/components/PlayerView/playerViewConfig.ts"],"names":[],"mappings":"AAkFA,MAAM,OAAgB,OAAO;IAiBC;IAhB5B;;;;;;;;;;;;;;;OAeG;IACH,YAA4B,wBAAgC;QAAhC,6BAAwB,GAAxB,wBAAwB,CAAQ;IAAG,CAAC;CACjE;AAED,MAAM,OAAO,aAAc,SAAQ,OAAO;IACxC;QACE,KAAK,CAAC,uDAAuD,CAAC,CAAC;IACjE,CAAC;CACF;AAED,MAAM,OAAO,IAAK,SAAQ,OAAO;IAC/B;QACE,KAAK,CAAC,8CAA8C,CAAC,CAAC;IACxD,CAAC;CACF;AAED,MAAM,OAAO,QAAS,SAAQ,OAAO;CAAG;AAExC;;;;;GAKG;AACH,MAAM,CAAN,IAAY,WAQX;AARD,WAAY,WAAW;IACrB;;;OAGG;IACH,0CAA2B,CAAA;IAC3B,4DAA4D;IAC5D,0CAA2B,CAAA;AAC7B,CAAC,EARW,WAAW,KAAX,WAAW,QAQtB","sourcesContent":["import { PictureInPictureConfig } from './pictureInPictureConfig';\n\n/**\n * Configures the visual presentation and behaviour of the `PlayerView`.\n */\nexport interface PlayerViewConfig {\n /**\n * Configures the visual presentation and behaviour of the Bitmovin Player UI.\n * A {@link WebUiConfig} can be used to configure the default Bitmovin Player Web UI.\n *\n * Default is {@link WebUiConfig}.\n *\n * Limitations:\n * Configuring the `uiConfig` only has an effect if the {@link StyleConfig.userInterfaceType} is set to {@link UserInterfaceType.Bitmovin}.\n */\n uiConfig?: UiConfig;\n\n /**\n * Provides options to configure Picture in Picture playback.\n */\n pictureInPictureConfig?: PictureInPictureConfig;\n\n /**\n * When set to `true`, the first frame of the main content will not be rendered before playback starts. Default is `false`.\n * This configuration has no effect for the {@link UserInterfaceType.Subtitle} on iOS/tvOS.\n *\n * To reliably hide the first frame before a pre-roll ad, please ensure that you are using the {@link AdvertisingConfig} to schedule ads and not the {@link Player.scheduleAd} API call.\n */\n hideFirstFrame?: boolean;\n\n /**\n * Specify on which surface type the video should be rendered.\n *\n * See {@link https://developer.android.com/guide/topics/media/ui/playerview#surfacetype|Choosing a surface type}\n * for more information.\n *\n * Default is {@link SurfaceType.SurfaceView}.\n *\n * @platform Android\n */\n surfaceType?: SurfaceType;\n}\n\n/**\n * Configures the visual presentation and behaviour of the Bitmovin Player UI.\n */\nexport type UiConfig = object;\n\n/**\n * Configures the visual presentation and behaviour of the Bitmovin Web UI.\n */\nexport interface WebUiConfig extends UiConfig {\n /**\n * Whether the Bitmovin Web UI will show playback speed selection options in the settings menu.\n * Default is `true`.\n */\n playbackSpeedSelectionEnabled?: boolean;\n /**\n * The UI variant to use for the Bitmovin Player Web UI.\n *\n * Default is {@link SmallScreenUi}\n */\n variant?: Variant;\n /**\n * Whether the WebView should be focused on initialization.\n *\n * By default this is enabled only for the TV UI variant, as it's needed there to\n * initiate spatial navigation using the remote control.\n *\n * @platform Android\n */\n focusUiOnInitialization?: boolean;\n /**\n * When set to true the WKWebView used for the Bitmovin Player Web UI can be inspected using the Safari Web Inspector. See [Enabling the Inspection of Web Content in Apps](https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps/) for details.\n *\n * Please note that the React Native DevTools won't show the View, you will need to use Safari and connect its remote inspector to the Player UI WebView.\n *\n * @platform iOS\n */\n enableWebViewInspecting?: boolean;\n}\n\nexport abstract class Variant {\n /**\n * Specifies the function name that will be used to initialize the `UIManager`\n * for the Bitmovin Player Web UI.\n *\n * The function is called on the `window` object with the `Player` as the first argument and\n * the `UIConfig` as the second argument.\n *\n * Example:\n * When you added a new function or want to use a different function of our `UIFactory`,\n * you can specify the full qualifier name including namespaces.\n * e.g. `bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI` for the SmallScreenUi.\n * @see UIFactory https://github.com/bitmovin/bitmovin-player-ui/blob/develop/src/ts/uifactory.ts#L60\n *\n * Notes:\n * - It's not necessary to use our `UIFactory`. Any static function can be specified.\n */\n constructor(public readonly uiManagerFactoryFunction: string) {}\n}\n\nexport class SmallScreenUi extends Variant {\n constructor() {\n super('bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI');\n }\n}\n\nexport class TvUi extends Variant {\n constructor() {\n super('bitmovin.playerui.UIFactory.buildDefaultTvUI');\n }\n}\n\nexport class CustomUi extends Variant {}\n\n/**\n * The type of surface on which to render video.\n *\n * See {@link https://developer.android.com/guide/topics/media/ui/playerview#surfacetype|Choosing a surface type}\n * for more information.\n */\nexport enum SurfaceType {\n /**\n * SurfaceView generally causes lower battery consumption,\n * and has better handling for HDR and secure content.\n */\n SurfaceView = 'SurfaceView',\n /** TextureView is sometime needed for smooth animations. */\n TextureView = 'TextureView',\n}\n"]}
1
+ {"version":3,"file":"playerViewConfig.js","sourceRoot":"","sources":["../../../src/components/PlayerView/playerViewConfig.ts"],"names":[],"mappings":"AAkFA,MAAM,OAAgB,OAAO;IAiBC;IAhB5B;;;;;;;;;;;;;;;OAeG;IACH,YAA4B,wBAAgC;QAAhC,6BAAwB,GAAxB,wBAAwB,CAAQ;IAAG,CAAC;CACjE;AAED,MAAM,OAAO,aAAc,SAAQ,OAAO;IACxC;QACE,KAAK,CAAC,gDAAgD,CAAC,CAAC;IAC1D,CAAC;CACF;AAED,MAAM,OAAO,IAAK,SAAQ,OAAO;IAC/B;QACE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACjD,CAAC;CACF;AAED,MAAM,OAAO,QAAS,SAAQ,OAAO;CAAG;AAExC;;;;;GAKG;AACH,MAAM,CAAN,IAAY,WAQX;AARD,WAAY,WAAW;IACrB;;;OAGG;IACH,0CAA2B,CAAA;IAC3B,4DAA4D;IAC5D,0CAA2B,CAAA;AAC7B,CAAC,EARW,WAAW,KAAX,WAAW,QAQtB","sourcesContent":["import { PictureInPictureConfig } from './pictureInPictureConfig';\n\n/**\n * Configures the visual presentation and behaviour of the `PlayerView`.\n */\nexport interface PlayerViewConfig {\n /**\n * Configures the visual presentation and behaviour of the Bitmovin Player UI.\n * A {@link WebUiConfig} can be used to configure the default Bitmovin Player Web UI.\n *\n * Default is {@link WebUiConfig}.\n *\n * Limitations:\n * Configuring the `uiConfig` only has an effect if the {@link StyleConfig.userInterfaceType} is set to {@link UserInterfaceType.Bitmovin}.\n */\n uiConfig?: UiConfig;\n\n /**\n * Provides options to configure Picture in Picture playback.\n */\n pictureInPictureConfig?: PictureInPictureConfig;\n\n /**\n * When set to `true`, the first frame of the main content will not be rendered before playback starts. Default is `false`.\n * This configuration has no effect for the {@link UserInterfaceType.Subtitle} on iOS/tvOS.\n *\n * To reliably hide the first frame before a pre-roll ad, please ensure that you are using the {@link AdvertisingConfig} to schedule ads and not the {@link Player.scheduleAd} API call.\n */\n hideFirstFrame?: boolean;\n\n /**\n * Specify on which surface type the video should be rendered.\n *\n * See {@link https://developer.android.com/guide/topics/media/ui/playerview#surfacetype|Choosing a surface type}\n * for more information.\n *\n * Default is {@link SurfaceType.SurfaceView}.\n *\n * @platform Android\n */\n surfaceType?: SurfaceType;\n}\n\n/**\n * Configures the visual presentation and behaviour of the Bitmovin Player UI.\n */\nexport type UiConfig = object;\n\n/**\n * Configures the visual presentation and behaviour of the Bitmovin Web UI.\n */\nexport interface WebUiConfig extends UiConfig {\n /**\n * Whether the Bitmovin Web UI will show playback speed selection options in the settings menu.\n * Default is `true`.\n */\n playbackSpeedSelectionEnabled?: boolean;\n /**\n * The UI variant to use for the Bitmovin Player Web UI.\n *\n * Default is {@link SmallScreenUi}\n */\n variant?: Variant;\n /**\n * Whether the WebView should be focused on initialization.\n *\n * By default this is enabled only for the TV UI variant, as it's needed there to\n * initiate spatial navigation using the remote control.\n *\n * @platform Android\n */\n focusUiOnInitialization?: boolean;\n /**\n * When set to true the WKWebView used for the Bitmovin Player Web UI can be inspected using the Safari Web Inspector. See [Enabling the Inspection of Web Content in Apps](https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps/) for details.\n *\n * Please note that the React Native DevTools won't show the View, you will need to use Safari and connect its remote inspector to the Player UI WebView.\n *\n * @platform iOS\n */\n enableWebViewInspecting?: boolean;\n}\n\nexport abstract class Variant {\n /**\n * Specifies the function name that will be used to initialize the `UIManager`\n * for the Bitmovin Player Web UI.\n *\n * The function is called on the `window` object with the `Player` as the first argument and\n * the `UIConfig` as the second argument.\n *\n * Example:\n * When you added a new function or want to use a different function of our `UIFactory`,\n * you can specify the full qualifier name including namespaces.\n * e.g. `bitmovin.playerui.UIFactory.buildSmallScreenUI` for the SmallScreenUi.\n * @see UIFactory https://github.com/bitmovin/bitmovin-player-ui/blob/develop/src/ts/UIFactory.ts\n *\n * Notes:\n * - It's not necessary to use our `UIFactory`. Any static function can be specified.\n */\n constructor(public readonly uiManagerFactoryFunction: string) {}\n}\n\nexport class SmallScreenUi extends Variant {\n constructor() {\n super('bitmovin.playerui.UIFactory.buildSmallScreenUI');\n }\n}\n\nexport class TvUi extends Variant {\n constructor() {\n super('bitmovin.playerui.UIFactory.buildTvUI');\n }\n}\n\nexport class CustomUi extends Variant {}\n\n/**\n * The type of surface on which to render video.\n *\n * See {@link https://developer.android.com/guide/topics/media/ui/playerview#surfacetype|Choosing a surface type}\n * for more information.\n */\nexport enum SurfaceType {\n /**\n * SurfaceView generally causes lower battery consumption,\n * and has better handling for HDR and secure content.\n */\n SurfaceView = 'SurfaceView',\n /** TextureView is sometime needed for smooth animations. */\n TextureView = 'TextureView',\n}\n"]}
@@ -1,4 +1,3 @@
1
- import { RefObject } from 'react';
2
1
  import { Event } from '../events';
3
2
  /**
4
3
  * A function that takes a generic event as argument.
@@ -13,6 +12,6 @@ type NativeCallback<E> = (event: {
13
12
  /**
14
13
  * Create a proxy function that unwraps native events.
15
14
  */
16
- export declare function useProxy(viewRef: RefObject<any>): <E extends Event>(callback?: Callback<E>) => NativeCallback<E>;
15
+ export declare function useProxy(): <E extends Event>(callback?: Callback<E>) => NativeCallback<E>;
17
16
  export {};
18
17
  //# sourceMappingURL=useProxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProxy.d.ts","sourceRoot":"","sources":["../../src/hooks/useProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAIlC;;GAEG;AACH,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAEtC;;GAEG;AACH,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE;IAAE,WAAW,EAAE,CAAC,CAAA;CAAE,KAAK,IAAI,CAAC;AAE7D;;GAEG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,GACtB,CAAC,CAAC,SAAS,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,CAchE"}
1
+ {"version":3,"file":"useProxy.d.ts","sourceRoot":"","sources":["../../src/hooks/useProxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC;;GAEG;AACH,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAEtC;;GAEG;AACH,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE;IAAE,WAAW,EAAE,CAAC,CAAA;CAAE,KAAK,IAAI,CAAC;AAE7D;;GAEG;AACH,wBAAgB,QAAQ,IAAI,CAAC,CAAC,SAAS,KAAK,EAC1C,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KACnB,cAAc,CAAC,CAAC,CAAC,CAYrB"}
@@ -1,18 +1,14 @@
1
1
  import { useCallback } from 'react';
2
- import { findNodeHandle } from 'react-native';
3
2
  import { normalizeNonFinite } from '../utils/normalizeNonFinite';
4
3
  /**
5
4
  * Create a proxy function that unwraps native events.
6
5
  */
7
- export function useProxy(viewRef) {
6
+ export function useProxy() {
8
7
  return useCallback((callback) => (event) => {
9
- const eventTargetNodeHandle = event.nativeEvent.target;
10
- if (eventTargetNodeHandle !== findNodeHandle(viewRef.current)) {
11
- return;
12
- }
13
- const { target, ...eventWithoutTarget } = event.nativeEvent;
8
+ // Remove the target field from the event as it's React Native internal metadata
9
+ const { target: _target, ...eventWithoutTarget } = event.nativeEvent;
14
10
  const sanitized = normalizeNonFinite(eventWithoutTarget);
15
11
  callback?.(sanitized);
16
- }, [viewRef]);
12
+ }, []);
17
13
  }
18
14
  //# sourceMappingURL=useProxy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProxy.js","sourceRoot":"","sources":["../../src/hooks/useProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAYjE;;GAEG;AACH,MAAM,UAAU,QAAQ,CACtB,OAAuB;IAEvB,OAAO,WAAW,CAChB,CAAkB,QAAsB,EAAE,EAAE,CAC1C,CAAC,KAAyB,EAAE,EAAE;QAC5B,MAAM,qBAAqB,GAAY,KAAK,CAAC,WAAmB,CAAC,MAAM,CAAC;QACxE,IAAI,qBAAqB,KAAK,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9D,OAAO;QACT,CAAC;QACD,MAAM,EAAE,MAAM,EAAE,GAAG,kBAAkB,EAAE,GAAG,KAAK,CAAC,WAAkB,CAAC;QACnE,MAAM,SAAS,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;QACzD,QAAQ,EAAE,CAAC,SAAc,CAAC,CAAC;IAC7B,CAAC,EACH,CAAC,OAAO,CAAC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { RefObject, useCallback } from 'react';\nimport { Event } from '../events';\nimport { findNodeHandle } from 'react-native';\nimport { normalizeNonFinite } from '../utils/normalizeNonFinite';\n\n/**\n * A function that takes a generic event as argument.\n */\ntype Callback<E> = (event: E) => void;\n\n/**\n * A function that takes the synthetic version of a generic event as argument.\n */\ntype NativeCallback<E> = (event: { nativeEvent: E }) => void;\n\n/**\n * Create a proxy function that unwraps native events.\n */\nexport function useProxy(\n viewRef: RefObject<any>\n): <E extends Event>(callback?: Callback<E>) => NativeCallback<E> {\n return useCallback(\n <E extends Event>(callback?: Callback<E>) =>\n (event: { nativeEvent: E }) => {\n const eventTargetNodeHandle: number = (event.nativeEvent as any).target;\n if (eventTargetNodeHandle !== findNodeHandle(viewRef.current)) {\n return;\n }\n const { target, ...eventWithoutTarget } = event.nativeEvent as any;\n const sanitized = normalizeNonFinite(eventWithoutTarget);\n callback?.(sanitized as E);\n },\n [viewRef]\n );\n}\n"]}
1
+ {"version":3,"file":"useProxy.js","sourceRoot":"","sources":["../../src/hooks/useProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAYjE;;GAEG;AACH,MAAM,UAAU,QAAQ;IAGtB,OAAO,WAAW,CAChB,CAAkB,QAAsB,EAAE,EAAE,CAC1C,CAAC,KAAyB,EAAE,EAAE;QAC5B,gFAAgF;QAChF,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,kBAAkB,EAAE,GAC9C,KAAK,CAAC,WAAkB,CAAC;QAC3B,MAAM,SAAS,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;QACzD,QAAQ,EAAE,CAAC,SAAc,CAAC,CAAC;IAC7B,CAAC,EACH,EAAE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback } from 'react';\nimport { Event } from '../events';\nimport { normalizeNonFinite } from '../utils/normalizeNonFinite';\n\n/**\n * A function that takes a generic event as argument.\n */\ntype Callback<E> = (event: E) => void;\n\n/**\n * A function that takes the synthetic version of a generic event as argument.\n */\ntype NativeCallback<E> = (event: { nativeEvent: E }) => void;\n\n/**\n * Create a proxy function that unwraps native events.\n */\nexport function useProxy(): <E extends Event>(\n callback?: Callback<E>\n) => NativeCallback<E> {\n return useCallback(\n <E extends Event>(callback?: Callback<E>) =>\n (event: { nativeEvent: E }) => {\n // Remove the target field from the event as it's React Native internal metadata\n const { target: _target, ...eventWithoutTarget } =\n event.nativeEvent as any;\n const sanitized = normalizeNonFinite(eventWithoutTarget);\n callback?.(sanitized as E);\n },\n []\n );\n}\n"]}
package/build/source.js CHANGED
@@ -87,7 +87,7 @@ export class Source extends NativeInstance {
87
87
  const sourceMetadata = this.config?.analyticsSourceMetadata;
88
88
  if (this.config?.drmConfig) {
89
89
  this.drm = new Drm(this.config.drmConfig);
90
- this.drm.initialize();
90
+ await this.drm.initialize();
91
91
  }
92
92
  if (sourceMetadata) {
93
93
  await SourceModule.initializeWithAnalyticsConfig(this.nativeId, this.drm?.nativeId, this.config, this.remoteControl || undefined, sourceMetadata);
@@ -1 +1 @@
1
- {"version":3,"file":"source.js","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAa,MAAM,OAAO,CAAC;AACvC,OAAO,cAAwC,MAAM,kBAAkB,CAAC;AAIxE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAElD;;GAEG;AACH,MAAM,CAAN,IAAY,UAiBX;AAjBD,WAAY,UAAU;IACpB;;OAEG;IACH,2BAAa,CAAA;IACb;;OAEG;IACH,yBAAW,CAAA;IACX;;OAEG;IACH,2BAAa,CAAA;IACb;;OAEG;IACH,yCAA2B,CAAA;AAC7B,CAAC,EAjBW,UAAU,KAAV,UAAU,QAiBrB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB;;OAEG;IACH,uDAAY,CAAA;IACZ;;OAEG;IACH,qDAAW,CAAA;IACX;;OAEG;IACH,mDAAU,CAAA;AACZ,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AAqBD;;;GAGG;AACH,MAAM,CAAN,IAAY,sBASX;AATD,WAAY,sBAAsB;IAChC;;OAEG;IACH,yCAAe,CAAA;IACf;;OAEG;IACH,qCAAW,CAAA;AACb,CAAC,EATW,sBAAsB,KAAtB,sBAAsB,QASjC;AAwED;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,cAA4B;IACtD;;OAEG;IACK,GAAG,CAAO;IAClB;;;;;OAKG;IACH,aAAa,GAAqC,IAAI,CAAC;IACvD;;OAEG;IACH,aAAa,GAAG,KAAK,CAAC;IACtB;;OAEG;IACH,WAAW,GAAG,KAAK,CAAC;IAEpB;;OAEG;IACH,UAAU,GAAG,KAAK,IAAmB,EAAE;QACrC,IAAI,CA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C,IAAI,CAAC,CAAC;IAC3D,CAAC,CAAC;IAEF;;;OAGG;IACH,QAAQ,GAAG,KAAK,IAAsB,EAAE;QACtC,OAAO,CAAC,MAAM,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC;IAC/D,CAAC,CAAC;IAEF;;OAEG;IACH,kBAAkB,GAAG,KAAK,IAAsB,EAAE;QAChD,OAAO,CAAC,MAAM,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC;IACzE,CAAC,CAAC;IAEF;;OAEG;IACH,QAAQ,GAAG,KAAK,IAAyC,EAAE;QACzD,OAAO,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CAAC;IAEF;;;;;OAKG;IACH,WAAW,GAAG,CAAC,QAAoC,EAAQ,EAAE;QAC3D,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC,CAAC;IAEF;;OAEG;IACH,YAAY,GAAG,KAAK,IAA2B,EAAE;QAC/C,OAAO,CACL,CAAC,MAAM,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,YAAY,CAAC,QAAQ,CAC1E,CAAC;IACJ,CAAC,CAAC;IAEF;;;;;;;;;OASG;IACH,YAAY,GAAG,KAAK,EAAE,IAAY,EAA6B,EAAE;QAC/D,OAAO,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC,CAAC;CACH","sourcesContent":["import { Drm, DrmConfig } from './drm';\nimport NativeInstance, { NativeInstanceConfig } from './nativeInstance';\nimport { SideLoadedSubtitleTrack } from './subtitleTrack';\nimport { Thumbnail } from './thumbnail';\nimport { SourceMetadata } from './analytics';\nimport SourceModule from './modules/SourceModule';\n\n/**\n * Types of media that can be handled by the player.\n */\nexport enum SourceType {\n /**\n * Indicates a missing source type.\n */\n NONE = 'none',\n /**\n * Indicates media type HLS.\n */\n HLS = 'hls',\n /**\n * Indicates media type DASH.\n */\n DASH = 'dash',\n /**\n * Indicates media type Progressive MP4.\n */\n PROGRESSIVE = 'progressive',\n}\n\n/**\n * The different loading states a {@link Source} instance can be in.\n */\nexport enum LoadingState {\n /**\n * The source is unloaded.\n */\n UNLOADED = 0,\n /**\n * The source is currently loading.\n */\n LOADING = 1,\n /**\n * The source is loaded.\n */\n LOADED = 2,\n}\n\n/**\n * Types of SourceOptions.\n */\nexport interface SourceOptions {\n /**\n * The position where the stream should be started.\n * Number can be positive or negative depending on the used `TimelineReferencePoint`.\n * Invalid numbers will be corrected according to the stream boundaries.\n * For VOD this is applied at the time the stream is loaded, for LIVE when playback starts.\n */\n startOffset?: number;\n /**\n * Sets the Timeline reference point to calculate the startOffset from.\n * Default for live: `TimelineReferencePoint.END`.\n * Default for VOD: `TimelineReferencePoint.START`.\n */\n startOffsetTimelineReference?: TimelineReferencePoint;\n}\n\n/**\n Timeline reference point to calculate SourceOptions.startOffset from.\n Default for live: TimelineReferencePoint.EBD Default for VOD: TimelineReferencePoint.START.\n */\nexport enum TimelineReferencePoint {\n /**\n * Relative offset will be calculated from the beginning of the stream or DVR window.\n */\n START = 'start',\n /**\n * Relative offset will be calculated from the end of the stream or the live edge in case of a live stream with DVR window.\n */\n END = 'end',\n}\n\n/**\n * Represents a source configuration that be loaded into a player instance.\n */\nexport interface SourceConfig extends NativeInstanceConfig {\n /**\n * The url for this source configuration.\n */\n url: string;\n /**\n * The `SourceType` for this configuration.\n */\n type?: SourceType;\n /**\n * The title of the video source.\n */\n title?: string;\n /**\n * The description of the video source.\n */\n description?: string;\n /**\n * The URL to a preview image displayed until the video starts.\n */\n poster?: string;\n /**\n * Indicates whether to show the poster image during playback.\n * Useful, for example, for audio-only streams.\n */\n isPosterPersistent?: boolean;\n /**\n * The DRM config for the source.\n */\n drmConfig?: DrmConfig;\n /**\n * External subtitle tracks to be added into the player.\n */\n subtitleTracks?: SideLoadedSubtitleTrack[];\n /**\n * External thumbnails to be added into the player.\n */\n thumbnailTrack?: string;\n /**\n * The optional custom metadata. Also sent to the cast receiver when loading the Source.\n */\n metadata?: Record<string, string>;\n /**\n * The `SourceOptions` for this configuration.\n */\n options?: SourceOptions;\n /**\n * The `SourceMetadata` for the {@link Source} to setup custom analytics tracking\n */\n analyticsSourceMetadata?: SourceMetadata;\n}\n\n/**\n * The remote control config for a source.\n * @platform iOS\n */\nexport interface SourceRemoteControlConfig {\n /**\n * The `SourceConfig` for casting.\n * Enables to play different content when casting.\n * This can be useful when the remote playback device supports different streaming formats,\n * DRM systems, etc. than the local device.\n * If not set, the local source config will be used for casting.\n */\n castSourceConfig?: SourceConfig | null;\n}\n\n/**\n * Represents audio and video content that can be loaded into a player.\n */\nexport class Source extends NativeInstance<SourceConfig> {\n /**\n * The native DRM config reference of this source.\n */\n private drm?: Drm;\n /**\n * The remote control config for this source.\n * This is only supported on iOS.\n *\n * @platform iOS\n */\n remoteControl: SourceRemoteControlConfig | null = null;\n /**\n * Whether the native {@link Source} object has been created.\n */\n isInitialized = false;\n /**\n * Whether the native {@link Source} object has been disposed.\n */\n isDestroyed = false;\n\n /**\n * Allocates the native {@link Source} instance and its resources natively.\n */\n initialize = async (): Promise<void> => {\n if (!this.isInitialized) {\n const sourceMetadata = this.config?.analyticsSourceMetadata;\n if (this.config?.drmConfig) {\n this.drm = new Drm(this.config.drmConfig);\n this.drm.initialize();\n }\n if (sourceMetadata) {\n await SourceModule.initializeWithAnalyticsConfig(\n this.nativeId,\n this.drm?.nativeId,\n this.config,\n this.remoteControl || undefined,\n sourceMetadata\n );\n } else {\n await SourceModule.initializeWithConfig(\n this.nativeId,\n this.drm?.nativeId,\n this.config,\n this.remoteControl || undefined\n );\n }\n this.isInitialized = true;\n }\n return Promise.resolve();\n };\n\n /**\n * Destroys the native {@link Source} and releases all of its allocated resources.\n */\n destroy = () => {\n if (!this.isDestroyed) {\n SourceModule.destroy(this.nativeId);\n this.drm?.destroy();\n this.isDestroyed = true;\n }\n };\n\n /**\n * The duration of the source in seconds if it’s a VoD or `INFINITY` if it’s a live stream.\n * Default value is `0` if the duration is not available or not known.\n */\n duration = async (): Promise<number> => {\n return (await SourceModule.duration(this.nativeId)) || 0;\n };\n\n /**\n * Whether the source is currently active in a player (i.e. playing back or paused).\n * Only one source can be active in the same player instance at any time.\n */\n isActive = async (): Promise<boolean> => {\n return (await SourceModule.isActive(this.nativeId)) ?? false;\n };\n\n /**\n * Whether the source is currently attached to a player instance.\n */\n isAttachedToPlayer = async (): Promise<boolean> => {\n return (await SourceModule.isAttachedToPlayer(this.nativeId)) ?? false;\n };\n\n /**\n * Metadata for the currently loaded source.\n */\n metadata = async (): Promise<Record<string, any> | null> => {\n return SourceModule.getMetadata(this.nativeId);\n };\n\n /**\n * Set metadata for the currently loaded source.\n * Setting the metadata to `null` clears the metadata object in native source.\n *\n * @param metadata metadata to be set.\n */\n setMetadata = (metadata: Record<string, any> | null): void => {\n SourceModule.setMetadata(this.nativeId, metadata);\n };\n\n /**\n * The current `LoadingState` of the source.\n */\n loadingState = async (): Promise<LoadingState> => {\n return (\n (await SourceModule.loadingState(this.nativeId)) || LoadingState.UNLOADED\n );\n };\n\n /**\n * @returns a `Thumbnail` for the specified playback time if available.\n * Supported thumbnail formats are:\n * - `WebVtt` configured via {@link SourceConfig.thumbnailTrack}, on all supported platforms\n * - HLS `Image Media Playlist` in the multivariant playlist, Android-only\n * - DASH `Image Adaptation Set` as specified in DASH-IF IOP, Android-only\n * If a `WebVtt` thumbnail track is provided, any potential in-manifest thumbnails are ignored on Android.\n *\n * @param time - The time in seconds for which to retrieve the thumbnail.\n */\n getThumbnail = async (time: number): Promise<Thumbnail | null> => {\n return SourceModule.getThumbnail(this.nativeId, time);\n };\n}\n"]}
1
+ {"version":3,"file":"source.js","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,O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AAkB,GAAG,KAAK,IAAsB,EAAE;QAChD,OAAO,CAAC,MAAM,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC;IACzE,CAAC,CAAC;IAEF;;OAEG;IACH,QAAQ,GAAG,KAAK,IAAyC,EAAE;QACzD,OAAO,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CAAC;IAEF;;;;;OAKG;IACH,WAAW,GAAG,CAAC,QAAoC,EAAQ,EAAE;QAC3D,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC,CAAC;IAEF;;OAEG;IACH,YAAY,GAAG,KAAK,IAA2B,EAAE;QAC/C,OAAO,CACL,CAAC,MAAM,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,YAAY,CAAC,QAAQ,CAC1E,CAAC;IACJ,CAAC,CAAC;IAEF;;;;;;;;;OASG;IACH,YAAY,GAAG,KAAK,EAAE,IAAY,EAA6B,EAAE;QAC/D,OAAO,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC,CAAC;CACH","sourcesContent":["import { Drm, DrmConfig } from './drm';\nimport NativeInstance, { NativeInstanceConfig } from './nativeInstance';\nimport { SideLoadedSubtitleTrack } from './subtitleTrack';\nimport { Thumbnail } from './thumbnail';\nimport { SourceMetadata } from './analytics';\nimport SourceModule from './modules/SourceModule';\n\n/**\n * Types of media that can be handled by the player.\n */\nexport enum SourceType {\n /**\n * Indicates a missing source type.\n */\n NONE = 'none',\n /**\n * Indicates media type HLS.\n */\n HLS = 'hls',\n /**\n * Indicates media type DASH.\n */\n DASH = 'dash',\n /**\n * Indicates media type Progressive MP4.\n */\n PROGRESSIVE = 'progressive',\n}\n\n/**\n * The different loading states a {@link Source} instance can be in.\n */\nexport enum LoadingState {\n /**\n * The source is unloaded.\n */\n UNLOADED = 0,\n /**\n * The source is currently loading.\n */\n LOADING = 1,\n /**\n * The source is loaded.\n */\n LOADED = 2,\n}\n\n/**\n * Types of SourceOptions.\n */\nexport interface SourceOptions {\n /**\n * The position where the stream should be started.\n * Number can be positive or negative depending on the used `TimelineReferencePoint`.\n * Invalid numbers will be corrected according to the stream boundaries.\n * For VOD this is applied at the time the stream is loaded, for LIVE when playback starts.\n */\n startOffset?: number;\n /**\n * Sets the Timeline reference point to calculate the startOffset from.\n * Default for live: `TimelineReferencePoint.END`.\n * Default for VOD: `TimelineReferencePoint.START`.\n */\n startOffsetTimelineReference?: TimelineReferencePoint;\n}\n\n/**\n Timeline reference point to calculate SourceOptions.startOffset from.\n Default for live: TimelineReferencePoint.EBD Default for VOD: TimelineReferencePoint.START.\n */\nexport enum TimelineReferencePoint {\n /**\n * Relative offset will be calculated from the beginning of the stream or DVR window.\n */\n START = 'start',\n /**\n * Relative offset will be calculated from the end of the stream or the live edge in case of a live stream with DVR window.\n */\n END = 'end',\n}\n\n/**\n * Represents a source configuration that be loaded into a player instance.\n */\nexport interface SourceConfig extends NativeInstanceConfig {\n /**\n * The url for this source configuration.\n */\n url: string;\n /**\n * The `SourceType` for this configuration.\n */\n type?: SourceType;\n /**\n * The title of the video source.\n */\n title?: string;\n /**\n * The description of the video source.\n */\n description?: string;\n /**\n * The URL to a preview image displayed until the video starts.\n */\n poster?: string;\n /**\n * Indicates whether to show the poster image during playback.\n * Useful, for example, for audio-only streams.\n */\n isPosterPersistent?: boolean;\n /**\n * The DRM config for the source.\n */\n drmConfig?: DrmConfig;\n /**\n * External subtitle tracks to be added into the player.\n */\n subtitleTracks?: SideLoadedSubtitleTrack[];\n /**\n * External thumbnails to be added into the player.\n */\n thumbnailTrack?: string;\n /**\n * The optional custom metadata. Also sent to the cast receiver when loading the Source.\n */\n metadata?: Record<string, string>;\n /**\n * The `SourceOptions` for this configuration.\n */\n options?: SourceOptions;\n /**\n * The `SourceMetadata` for the {@link Source} to setup custom analytics tracking\n */\n analyticsSourceMetadata?: SourceMetadata;\n}\n\n/**\n * The remote control config for a source.\n * @platform iOS\n */\nexport interface SourceRemoteControlConfig {\n /**\n * The `SourceConfig` for casting.\n * Enables to play different content when casting.\n * This can be useful when the remote playback device supports different streaming formats,\n * DRM systems, etc. than the local device.\n * If not set, the local source config will be used for casting.\n */\n castSourceConfig?: SourceConfig | null;\n}\n\n/**\n * Represents audio and video content that can be loaded into a player.\n */\nexport class Source extends NativeInstance<SourceConfig> {\n /**\n * The native DRM config reference of this source.\n */\n private drm?: Drm;\n /**\n * The remote control config for this source.\n * This is only supported on iOS.\n *\n * @platform iOS\n */\n remoteControl: SourceRemoteControlConfig | null = null;\n /**\n * Whether the native {@link Source} object has been created.\n */\n isInitialized = false;\n /**\n * Whether the native {@link Source} object has been disposed.\n */\n isDestroyed = false;\n\n /**\n * Allocates the native {@link Source} instance and its resources natively.\n */\n initialize = async (): Promise<void> => {\n if (!this.isInitialized) {\n const sourceMetadata = this.config?.analyticsSourceMetadata;\n if (this.config?.drmConfig) {\n this.drm = new Drm(this.config.drmConfig);\n await this.drm.initialize();\n }\n if (sourceMetadata) {\n await SourceModule.initializeWithAnalyticsConfig(\n this.nativeId,\n this.drm?.nativeId,\n this.config,\n this.remoteControl || undefined,\n sourceMetadata\n );\n } else {\n await SourceModule.initializeWithConfig(\n this.nativeId,\n this.drm?.nativeId,\n this.config,\n this.remoteControl || undefined\n );\n }\n this.isInitialized = true;\n }\n return Promise.resolve();\n };\n\n /**\n * Destroys the native {@link Source} and releases all of its allocated resources.\n */\n destroy = () => {\n if (!this.isDestroyed) {\n SourceModule.destroy(this.nativeId);\n this.drm?.destroy();\n this.isDestroyed = true;\n }\n };\n\n /**\n * The duration of the source in seconds if it’s a VoD or `INFINITY` if it’s a live stream.\n * Default value is `0` if the duration is not available or not known.\n */\n duration = async (): Promise<number> => {\n return (await SourceModule.duration(this.nativeId)) || 0;\n };\n\n /**\n * Whether the source is currently active in a player (i.e. playing back or paused).\n * Only one source can be active in the same player instance at any time.\n */\n isActive = async (): Promise<boolean> => {\n return (await SourceModule.isActive(this.nativeId)) ?? false;\n };\n\n /**\n * Whether the source is currently attached to a player instance.\n */\n isAttachedToPlayer = async (): Promise<boolean> => {\n return (await SourceModule.isAttachedToPlayer(this.nativeId)) ?? false;\n };\n\n /**\n * Metadata for the currently loaded source.\n */\n metadata = async (): Promise<Record<string, any> | null> => {\n return SourceModule.getMetadata(this.nativeId);\n };\n\n /**\n * Set metadata for the currently loaded source.\n * Setting the metadata to `null` clears the metadata object in native source.\n *\n * @param metadata metadata to be set.\n */\n setMetadata = (metadata: Record<string, any> | null): void => {\n SourceModule.setMetadata(this.nativeId, metadata);\n };\n\n /**\n * The current `LoadingState` of the source.\n */\n loadingState = async (): Promise<LoadingState> => {\n return (\n (await SourceModule.loadingState(this.nativeId)) || LoadingState.UNLOADED\n );\n };\n\n /**\n * @returns a `Thumbnail` for the specified playback time if available.\n * Supported thumbnail formats are:\n * - `WebVtt` configured via {@link SourceConfig.thumbnailTrack}, on all supported platforms\n * - HLS `Image Media Playlist` in the multivariant playlist, Android-only\n * - DASH `Image Adaptation Set` as specified in DASH-IF IOP, Android-only\n * If a `WebVtt` thumbnail track is provided, any potential in-manifest thumbnails are ignored on Android.\n *\n * @param time - The time in seconds for which to retrieve the thumbnail.\n */\n getThumbnail = async (time: number): Promise<Thumbnail | null> => {\n return SourceModule.getThumbnail(this.nativeId, time);\n };\n}\n"]}
@@ -1056,7 +1056,7 @@ extension RCTConvert {
1056
1056
  }
1057
1057
  let variant = json["variant"] as? [String: Any?]
1058
1058
  let uiManagerFactoryFunction = variant?["uiManagerFactoryFunction"] as? String
1059
- let defaultUiManagerFactoryFunction = "bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI"
1059
+ let defaultUiManagerFactoryFunction = "bitmovin.playerui.UIFactory.buildSmallScreenUI"
1060
1060
 
1061
1061
  return RNUiConfig(
1062
1062
  playbackSpeedSelectionEnabled: json["playbackSpeedSelectionEnabled"] as? Bool ?? true,
@@ -28,7 +28,7 @@ Pod::Spec.new do |s|
28
28
  s.static_framework = true
29
29
 
30
30
  s.dependency 'ExpoModulesCore'
31
- s.dependency "BitmovinPlayer", "3.106.0"
31
+ s.dependency "BitmovinPlayer", "3.107.0"
32
32
  s.ios.dependency "GoogleAds-IMA-iOS-SDK", "3.26.1"
33
33
  s.tvos.dependency "GoogleAds-IMA-tvOS-SDK", "4.15.1"
34
34
 
@@ -126,13 +126,16 @@ public class RNPlayerView: ExpoView {
126
126
  ) {
127
127
  self.playerId = playerId
128
128
  guard let playerId else {
129
- playerView?.player?.remove(listener: self)
130
- playerView?.player = nil
129
+ detachCurrentPlayer()
131
130
  return
132
131
  }
133
132
  guard let player = self.appContext?.moduleRegistry.get(PlayerModule.self)?.retrieve(playerId) else {
134
133
  return
135
134
  }
135
+ if let playerView, let currentPlayer = playerView.player, currentPlayer === player {
136
+ // Player is already attached to the PlayerView
137
+ return
138
+ }
136
139
 
137
140
  if let userInterfaceConfig = maybeCreateUserInterfaceConfig(
138
141
  styleConfig: player.config.styleConfig,
@@ -142,18 +145,15 @@ public class RNPlayerView: ExpoView {
142
145
  player.config.styleConfig.userInterfaceConfig = userInterfaceConfig
143
146
  }
144
147
 
145
- let previousPictureInPictureAvailableValue: Bool
146
- if let playerView {
147
- playerView.player = player
148
- previousPictureInPictureAvailableValue = playerView.isPictureInPictureAvailable
149
- } else {
150
- self.playerView = PlayerView(
151
- player: player,
152
- frame: bounds,
153
- playerViewConfig: playerViewConfigWrapper?.playerViewConfig ?? PlayerViewConfig()
154
- )
155
- previousPictureInPictureAvailableValue = false
148
+ let previousPictureInPictureAvailableValue = playerView?.isPictureInPictureAvailable ?? false
149
+ if playerView?.player != nil {
150
+ prepareForNewPlayerAttachment()
156
151
  }
152
+ self.playerView = PlayerView(
153
+ player: player,
154
+ frame: bounds,
155
+ playerViewConfig: playerViewConfigWrapper?.playerViewConfig ?? PlayerViewConfig()
156
+ )
157
157
 
158
158
  player.add(listener: self)
159
159
  playerView?.add(listener: self)
@@ -236,7 +236,35 @@ public class RNPlayerView: ExpoView {
236
236
  }
237
237
 
238
238
  private extension RNPlayerView {
239
- // Helper methods no longer needed - using EventDispatcher properties directly
239
+ func detachCurrentPlayer() {
240
+ guard let playerView else {
241
+ return
242
+ }
243
+ playerView.player?.remove(listener: self)
244
+ playerView.remove(listener: self)
245
+ playerView.player = nil
246
+ }
247
+
248
+ func prepareForNewPlayerAttachment() {
249
+ guard let playerView else {
250
+ return
251
+ }
252
+
253
+ // Avoid carrying over fullscreen/PiP state to a new player.
254
+ // Native PlayerView replaces its UI controller when the player instance changes, and does not
255
+ // support preserving fullscreen/PiP state across that swap. We tear down first to avoid stale state.
256
+ if playerView.isFullscreen {
257
+ playerView.exitFullscreen()
258
+ }
259
+ if playerView.isPictureInPicture {
260
+ playerView.exitPictureInPicture()
261
+ }
262
+
263
+ detachCurrentPlayer()
264
+
265
+ // Force a fresh PlayerView on next attach.
266
+ self.playerView = nil
267
+ }
240
268
  }
241
269
 
242
270
  private extension Event {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitmovin-player-react-native",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Official React Native bindings for Bitmovin's mobile Player SDKs.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -43,7 +43,7 @@ export function PlayerView({
43
43
  const nativeView = useRef<InternalPlayerViewRef>(viewRef?.current || null);
44
44
 
45
45
  // Native events proxy helper.
46
- const proxy = useProxy(nativeView);
46
+ const proxy = useProxy();
47
47
  // Style resulting from merging `baseStyle` and `props.style`.
48
48
  const nativeViewStyle = StyleSheet.flatten([styles.baseStyle, style]);
49
49
 
@@ -91,8 +91,8 @@ export abstract class Variant {
91
91
  * Example:
92
92
  * When you added a new function or want to use a different function of our `UIFactory`,
93
93
  * you can specify the full qualifier name including namespaces.
94
- * e.g. `bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI` for the SmallScreenUi.
95
- * @see UIFactory https://github.com/bitmovin/bitmovin-player-ui/blob/develop/src/ts/uifactory.ts#L60
94
+ * e.g. `bitmovin.playerui.UIFactory.buildSmallScreenUI` for the SmallScreenUi.
95
+ * @see UIFactory https://github.com/bitmovin/bitmovin-player-ui/blob/develop/src/ts/UIFactory.ts
96
96
  *
97
97
  * Notes:
98
98
  * - It's not necessary to use our `UIFactory`. Any static function can be specified.
@@ -102,13 +102,13 @@ export abstract class Variant {
102
102
 
103
103
  export class SmallScreenUi extends Variant {
104
104
  constructor() {
105
- super('bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI');
105
+ super('bitmovin.playerui.UIFactory.buildSmallScreenUI');
106
106
  }
107
107
  }
108
108
 
109
109
  export class TvUi extends Variant {
110
110
  constructor() {
111
- super('bitmovin.playerui.UIFactory.buildDefaultTvUI');
111
+ super('bitmovin.playerui.UIFactory.buildTvUI');
112
112
  }
113
113
  }
114
114
 
@@ -1,6 +1,5 @@
1
- import { RefObject, useCallback } from 'react';
1
+ import { useCallback } from 'react';
2
2
  import { Event } from '../events';
3
- import { findNodeHandle } from 'react-native';
4
3
  import { normalizeNonFinite } from '../utils/normalizeNonFinite';
5
4
 
6
5
  /**
@@ -16,20 +15,18 @@ type NativeCallback<E> = (event: { nativeEvent: E }) => void;
16
15
  /**
17
16
  * Create a proxy function that unwraps native events.
18
17
  */
19
- export function useProxy(
20
- viewRef: RefObject<any>
21
- ): <E extends Event>(callback?: Callback<E>) => NativeCallback<E> {
18
+ export function useProxy(): <E extends Event>(
19
+ callback?: Callback<E>
20
+ ) => NativeCallback<E> {
22
21
  return useCallback(
23
22
  <E extends Event>(callback?: Callback<E>) =>
24
23
  (event: { nativeEvent: E }) => {
25
- const eventTargetNodeHandle: number = (event.nativeEvent as any).target;
26
- if (eventTargetNodeHandle !== findNodeHandle(viewRef.current)) {
27
- return;
28
- }
29
- const { target, ...eventWithoutTarget } = event.nativeEvent as any;
24
+ // Remove the target field from the event as it's React Native internal metadata
25
+ const { target: _target, ...eventWithoutTarget } =
26
+ event.nativeEvent as any;
30
27
  const sanitized = normalizeNonFinite(eventWithoutTarget);
31
28
  callback?.(sanitized as E);
32
29
  },
33
- [viewRef]
30
+ []
34
31
  );
35
32
  }
package/src/source.ts CHANGED
@@ -181,7 +181,7 @@ export class Source extends NativeInstance<SourceConfig> {
181
181
  const sourceMetadata = this.config?.analyticsSourceMetadata;
182
182
  if (this.config?.drmConfig) {
183
183
  this.drm = new Drm(this.config.drmConfig);
184
- this.drm.initialize();
184
+ await this.drm.initialize();
185
185
  }
186
186
  if (sourceMetadata) {
187
187
  await SourceModule.initializeWithAnalyticsConfig(