bitmovin-player-react-native 1.14.0 → 1.15.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 +15 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/converter/JsonConverter.kt +1 -0
- package/build/components/PlayerView/index.d.ts +1 -1
- package/build/components/PlayerView/index.d.ts.map +1 -1
- package/build/components/PlayerView/index.js +9 -2
- package/build/components/PlayerView/index.js.map +1 -1
- package/build/components/PlayerView/properties.d.ts +9 -0
- package/build/components/PlayerView/properties.d.ts.map +1 -1
- package/build/components/PlayerView/properties.js.map +1 -1
- package/build/playbackConfig.d.ts +7 -0
- package/build/playbackConfig.d.ts.map +1 -1
- package/build/playbackConfig.js.map +1 -1
- package/ios/Event+JSON.swift +2 -2
- package/ios/RNBitmovinPlayer.podspec +1 -1
- package/ios/RNPlayerView.swift +9 -0
- package/ios/RNPlayerViewManager.swift +3 -0
- package/package.json +1 -1
- package/src/components/PlayerView/index.tsx +19 -1
- package/src/components/PlayerView/properties.ts +10 -0
- package/src/playbackConfig.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.15.0] - 2026-03-27
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Android: `PlaybackConfig.handleAudioFocus` to control whether the player pauses playback when audio focus is lost
|
|
8
|
+
- iOS: `PlayerView.isPictureInPictureEnabled` to enable or disable Picture in Picture availability dynamically after player initialization
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Update Bitmovin's native iOS SDK version to `3.110.0`
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- iOS, tvOS: Error/Warning code not forwarded to the React Native bridge on error and warning events
|
|
17
|
+
|
|
3
18
|
## [1.14.0] - 2026-03-20
|
|
4
19
|
|
|
5
20
|
### Added
|
|
@@ -165,6 +165,7 @@ fun Map<String, Any?>.toPlaybackConfig(): PlaybackConfig = PlaybackConfig().appl
|
|
|
165
165
|
withBoolean("isAutoplayEnabled") { isAutoplayEnabled = it }
|
|
166
166
|
withBoolean("isMuted") { isMuted = it }
|
|
167
167
|
withBoolean("isTimeShiftEnabled") { isTimeShiftEnabled = it }
|
|
168
|
+
withBoolean("handleAudioFocus") { handleAudioFocus = it }
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
fun Map<String, Any?>.toStyleConfig(): StyleConfig = StyleConfig().apply {
|
|
@@ -6,5 +6,5 @@ import { PlayerViewProps } from './properties';
|
|
|
6
6
|
*
|
|
7
7
|
* @param options configuration options
|
|
8
8
|
*/
|
|
9
|
-
export declare function PlayerView({ viewRef, style, player, config, fullscreenHandler, customMessageHandler, isFullscreenRequested, scalingMode, isPictureInPictureRequested, pictureInPictureActions, ...props }: PlayerViewProps): React.JSX.Element | null;
|
|
9
|
+
export declare function PlayerView({ viewRef, style, player, config, fullscreenHandler, customMessageHandler, isFullscreenRequested, scalingMode, isPictureInPictureRequested, pictureInPictureActions, isPictureInPictureEnabled, ...props }: PlayerViewProps): React.JSX.Element | null;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PlayerView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAOtE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAa/C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,oBAAoB,EACpB,qBAA6B,EAC7B,WAAW,EACX,2BAAmC,EACnC,uBAAuB,EACvB,GAAG,KAAK,EACT,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PlayerView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAOtE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAa/C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,oBAAoB,EACpB,qBAA6B,EAC7B,WAAW,EACX,2BAAmC,EACnC,uBAAuB,EACvB,yBAAyB,EACzB,GAAG,KAAK,EACT,EAAE,eAAe,4BAyLjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
3
3
|
import { useKeepAwake } from 'expo-keep-awake';
|
|
4
4
|
import { NativePlayerView } from './native';
|
|
5
5
|
import { useProxy } from '../../hooks/useProxy';
|
|
@@ -20,7 +20,7 @@ const styles = StyleSheet.create({
|
|
|
20
20
|
*
|
|
21
21
|
* @param options configuration options
|
|
22
22
|
*/
|
|
23
|
-
export function PlayerView({ viewRef, style, player, config, fullscreenHandler, customMessageHandler, isFullscreenRequested = false, scalingMode, isPictureInPictureRequested = false, pictureInPictureActions, ...props }) {
|
|
23
|
+
export function PlayerView({ viewRef, style, player, config, fullscreenHandler, customMessageHandler, isFullscreenRequested = false, scalingMode, isPictureInPictureRequested = false, pictureInPictureActions, isPictureInPictureEnabled, ...props }) {
|
|
24
24
|
// Keep the device awake while the PlayerView is mounted
|
|
25
25
|
useKeepAwake();
|
|
26
26
|
const nativeView = useRef(viewRef?.current || null);
|
|
@@ -73,6 +73,13 @@ export function PlayerView({ viewRef, style, player, config, fullscreenHandler,
|
|
|
73
73
|
void nativeView.current?.updatePictureInPictureActions(pictureInPictureActions);
|
|
74
74
|
}
|
|
75
75
|
}, [isPlayerInitialized, pictureInPictureActions]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (isPlayerInitialized &&
|
|
78
|
+
isPictureInPictureEnabled != null &&
|
|
79
|
+
Platform.OS === 'ios') {
|
|
80
|
+
void nativeView.current?.setIsPictureInPictureEnabled(isPictureInPictureEnabled);
|
|
81
|
+
}
|
|
82
|
+
}, [isPlayerInitialized, isPictureInPictureEnabled]);
|
|
76
83
|
if (!isPlayerInitialized) {
|
|
77
84
|
return null;
|
|
78
85
|
}
|
|
@@ -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,gBAAgB,EAA0B,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAGjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,SAAS,EAAE,SAAS;KACrB;CACF,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GAAG,KAAK,EAC7B,WAAW,EACX,2BAA2B,GAAG,KAAK,EACnC,uBAAuB,EACvB,GAAG,KAAK,EACQ;IAChB,wDAAwD;IACxD,YAAY,EAAE,CAAC;IAEf,MAAM,UAAU,GAAG,MA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,CAAC,CACF,gCAAgC,CAAC,CAAC,KAAK,CACrC,KAAK,CAAC,6BAA6B,CACpC,CAAC,CACF,qBAAqB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CACvD,4BAA4B,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC,EACrE,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 void 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 void 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 onBmpFairplayLicenseAcquired={proxy(props.onFairplayLicenseAcquired)}\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,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAA0B,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAGjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,SAAS,EAAE,SAAS;KACrB;CACF,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GAAG,KAAK,EAC7B,WAAW,EACX,2BAA2B,GAAG,KAAK,EACnC,uBAAuB,EACvB,yBAAyB,E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AAe,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,CACvD,4BAA4B,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC,EACrE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { RefObject, useEffect, useRef, useState } from 'react';\nimport { Platform, 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 isPictureInPictureEnabled,\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 void 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 void nativeView.current?.updatePictureInPictureActions(\n pictureInPictureActions\n );\n }\n }, [isPlayerInitialized, pictureInPictureActions]);\n\n useEffect(() => {\n if (\n isPlayerInitialized &&\n isPictureInPictureEnabled != null &&\n Platform.OS === 'ios'\n ) {\n void nativeView.current?.setIsPictureInPictureEnabled(\n isPictureInPictureEnabled\n );\n }\n }, [isPlayerInitialized, isPictureInPictureEnabled]);\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 onBmpFairplayLicenseAcquired={proxy(props.onFairplayLicenseAcquired)}\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 * Enables or disables Picture in Picture mode availability.\n * Only applicable on iOS — `isPictureInPictureRequested` has no effect when disabled.\n */\n setIsPictureInPictureEnabled: (isEnabled: boolean) => Promise<void>;\n}\n"]}
|
|
@@ -65,6 +65,15 @@ export interface BasePlayerViewProps {
|
|
|
65
65
|
* - iOS: All actions enabled
|
|
66
66
|
*/
|
|
67
67
|
pictureInPictureActions?: PictureInPictureAction[];
|
|
68
|
+
/**
|
|
69
|
+
* Enables or disables Picture in Picture mode availability.
|
|
70
|
+
* When disabled, `isPictureInPictureRequested` property has no effect.
|
|
71
|
+
*
|
|
72
|
+
* Can be changed dynamically after the player is initialized.
|
|
73
|
+
*
|
|
74
|
+
* @platform iOS, tvOS
|
|
75
|
+
*/
|
|
76
|
+
isPictureInPictureEnabled?: boolean;
|
|
68
77
|
}
|
|
69
78
|
/**
|
|
70
79
|
* {@link PlayerView} component props.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/components/PlayerView/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IACtB;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC;;OAEG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAE5C;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;OAGG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B;;;;;;;;;;;;;;;OAeG;IACH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AC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IACzB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/components/PlayerView/properties.ts"],"names":[],"mappings":"","sourcesContent":["import { PlayerViewEvents } from './events';\nimport { Player } from '../../player';\nimport { FullscreenHandler, CustomMessageHandler } from '../../ui';\nimport { ScalingMode } from '../../styleConfig';\nimport { ViewStyle } from 'react-native';\nimport { PlayerViewConfig } from './playerViewConfig';\nimport { PictureInPictureAction } from './pictureInPictureAction';\nimport { RefObject } from 'react';\n\n/**\n * Base `PlayerView` component props.\n * Used to establish common props between `NativePlayerView` and {@link PlayerView}.\n */\nexport interface BasePlayerViewProps {\n ref?: RefObject<null>;\n /**\n * The {@link FullscreenHandler} that is used by the {@link PlayerView} to control the fullscreen mode.\n */\n fullscreenHandler?: FullscreenHandler;\n\n /**\n * The {@link CustomMessageHandler} that can be used to directly communicate with the embedded Bitmovin Web UI.\n */\n customMessageHandler?: CustomMessageHandler;\n\n /**\n * Can be set to `true` to request fullscreen mode, or `false` to request exit of fullscreen mode.\n * Should not be used to get the current fullscreen state. Use {@link PlayerViewEvents.onFullscreenEnter} and {@link PlayerViewEvents.onFullscreenExit}\n * or the {@link FullscreenHandler.isFullscreenActive} property to get the current state.\n * Using this property to change the fullscreen state, it is ensured that the embedded Player UI is also aware\n * of potential fullscreen state changes.\n * To use this property, a {@link FullscreenHandler} must be set.\n */\n isFullscreenRequested?: boolean;\n\n /**\n * A value defining how the video is displayed within the parent container's bounds.\n * Possible values are defined in {@link ScalingMode}.\n */\n scalingMode?: ScalingMode;\n\n /**\n * Can be set to `true` to request Picture in Picture mode, or `false` to request exit of Picture in Picture mode.\n * Should not be used to get the current Picture in Picture state. Use {@link PlayerViewEvents.onPictureInPictureEnter} and {@link PlayerViewEvents.onPictureInPictureExit}.\n */\n isPictureInPictureRequested?: boolean;\n\n /**\n * Style of the {@link PlayerView}.\n */\n style?: ViewStyle;\n\n /**\n * Configures the visual presentation and behaviour of the {@link PlayerView}.\n * The value must not be altered after setting it initially.\n */\n config?: PlayerViewConfig;\n\n /**\n * Picture in Picture actions that should be displayed on the Picture in Picture window.\n *\n * Limitations:\n * - On Android if an empty list is passed and {@link MediaControlConfig.isEnabled} is set to true\n * play, pause, next, and previous controls will appear, due to the default Android Picture in Picture implementation:\n * https://developer.android.com/develop/ui/views/picture-in-picture#add_controls\n * Set {@link MediaControlConfig.isEnabled} to false if this is\n * not the desired behaviour.\n * - on iOS/tvOS if {@link PictureInPictureAction.TogglePlayback} is not specified also other actions are\n * disabled due to OS limitations.\n *\n * Default value is `undefined`, which translates to:\n * - Android: No actions, unless {@link MediaControlConfig.isEnabled} is set to true\n * - iOS: All actions enabled\n */\n pictureInPictureActions?: PictureInPictureAction[];\n}\n\n/**\n * {@link PlayerView} component props.\n */\nexport interface PlayerViewProps extends BasePlayerViewProps, PlayerViewEvents {\n viewRef?: RefObject<any>;\n /**\n * {@link Player} instance (generally returned from {@link usePlayer} hook) that will control\n * and render audio/video inside the {@link PlayerView}.\n */\n player: Player;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/components/PlayerView/properties.ts"],"names":[],"mappings":"","sourcesContent":["import { PlayerViewEvents } from './events';\nimport { Player } from '../../player';\nimport { FullscreenHandler, CustomMessageHandler } from '../../ui';\nimport { ScalingMode } from '../../styleConfig';\nimport { ViewStyle } from 'react-native';\nimport { PlayerViewConfig } from './playerViewConfig';\nimport { PictureInPictureAction } from './pictureInPictureAction';\nimport { RefObject } from 'react';\n\n/**\n * Base `PlayerView` component props.\n * Used to establish common props between `NativePlayerView` and {@link PlayerView}.\n */\nexport interface BasePlayerViewProps {\n ref?: RefObject<null>;\n /**\n * The {@link FullscreenHandler} that is used by the {@link PlayerView} to control the fullscreen mode.\n */\n fullscreenHandler?: FullscreenHandler;\n\n /**\n * The {@link CustomMessageHandler} that can be used to directly communicate with the embedded Bitmovin Web UI.\n */\n customMessageHandler?: CustomMessageHandler;\n\n /**\n * Can be set to `true` to request fullscreen mode, or `false` to request exit of fullscreen mode.\n * Should not be used to get the current fullscreen state. Use {@link PlayerViewEvents.onFullscreenEnter} and {@link PlayerViewEvents.onFullscreenExit}\n * or the {@link FullscreenHandler.isFullscreenActive} property to get the current state.\n * Using this property to change the fullscreen state, it is ensured that the embedded Player UI is also aware\n * of potential fullscreen state changes.\n * To use this property, a {@link FullscreenHandler} must be set.\n */\n isFullscreenRequested?: boolean;\n\n /**\n * A value defining how the video is displayed within the parent container's bounds.\n * Possible values are defined in {@link ScalingMode}.\n */\n scalingMode?: ScalingMode;\n\n /**\n * Can be set to `true` to request Picture in Picture mode, or `false` to request exit of Picture in Picture mode.\n * Should not be used to get the current Picture in Picture state. Use {@link PlayerViewEvents.onPictureInPictureEnter} and {@link PlayerViewEvents.onPictureInPictureExit}.\n */\n isPictureInPictureRequested?: boolean;\n\n /**\n * Style of the {@link PlayerView}.\n */\n style?: ViewStyle;\n\n /**\n * Configures the visual presentation and behaviour of the {@link PlayerView}.\n * The value must not be altered after setting it initially.\n */\n config?: PlayerViewConfig;\n\n /**\n * Picture in Picture actions that should be displayed on the Picture in Picture window.\n *\n * Limitations:\n * - On Android if an empty list is passed and {@link MediaControlConfig.isEnabled} is set to true\n * play, pause, next, and previous controls will appear, due to the default Android Picture in Picture implementation:\n * https://developer.android.com/develop/ui/views/picture-in-picture#add_controls\n * Set {@link MediaControlConfig.isEnabled} to false if this is\n * not the desired behaviour.\n * - on iOS/tvOS if {@link PictureInPictureAction.TogglePlayback} is not specified also other actions are\n * disabled due to OS limitations.\n *\n * Default value is `undefined`, which translates to:\n * - Android: No actions, unless {@link MediaControlConfig.isEnabled} is set to true\n * - iOS: All actions enabled\n */\n pictureInPictureActions?: PictureInPictureAction[];\n\n /**\n * Enables or disables Picture in Picture mode availability.\n * When disabled, `isPictureInPictureRequested` property has no effect.\n *\n * Can be changed dynamically after the player is initialized.\n *\n * @platform iOS, tvOS\n */\n isPictureInPictureEnabled?: boolean;\n}\n\n/**\n * {@link PlayerView} component props.\n */\nexport interface PlayerViewProps extends BasePlayerViewProps, PlayerViewEvents {\n viewRef?: RefObject<any>;\n /**\n * {@link Player} instance (generally returned from {@link usePlayer} hook) that will control\n * and render audio/video inside the {@link PlayerView}.\n */\n player: Player;\n}\n"]}
|
|
@@ -65,6 +65,13 @@ export interface PlaybackConfig {
|
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
67
67
|
isBackgroundPlaybackEnabled?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Whether to automate audio focus management, allowing the player to pause when other apps request focus.
|
|
70
|
+
*
|
|
71
|
+
* @defaultValue `false`
|
|
72
|
+
* @platform Android
|
|
73
|
+
*/
|
|
74
|
+
handleAudioFocus?: boolean;
|
|
68
75
|
/**
|
|
69
76
|
* Whether the Picture in Picture mode option is enabled or not. Default is `false`.
|
|
70
77
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playbackConfig.d.ts","sourceRoot":"","sources":["../src/playbackConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;;;;;;;OAWG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B"}
|
|
1
|
+
{"version":3,"file":"playbackConfig.d.ts","sourceRoot":"","sources":["../src/playbackConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;;;;;OAWG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playbackConfig.js","sourceRoot":"","sources":["../src/playbackConfig.ts"],"names":[],"mappings":"","sourcesContent":["import { DecoderConfig } from './decoder/decoderConfig';\n\n/**\n * Configures the playback behaviour of the player.\n */\nexport interface PlaybackConfig {\n /**\n * Whether the player starts playing automatically after loading a source or not. Default is `false`.\n * @example\n * ```\n * const player = new Player({\n * playbackConfig: {\n * isAutoplayEnabled: true,\n * },\n * });\n * ```\n */\n isAutoplayEnabled?: boolean;\n /**\n * Whether the sound is muted on startup or not. Default value is `false`.\n * @example\n * ```\n * const player = new Player({\n * playbackConfig: {\n * isMuted: true,\n * },\n * });\n * ```\n */\n isMuted?: boolean;\n /**\n * Whether time shift / DVR for live streams is enabled or not. Default is `true`.\n * @example\n * ```\n * const player = new Player({\n * playbackConfig: {\n * isTimeShiftEnabled: false,\n * },\n * });\n * ```\n */\n isTimeShiftEnabled?: boolean;\n /**\n * Whether background playback is enabled or not.\n * Default is `false`.\n *\n * When set to `true`, playback is not automatically paused\n * anymore when the app moves to the background.\n * When set to `true`, also make sure to properly configure your app to allow\n * background playback.\n *\n * Default is `false`.\n *\n * @remarks\n * - On Android, {@link MediaControlConfig.isEnabled} has to be `true` for\n * background playback to work.\n * - On tvOS, background playback is only supported for audio-only content.\n *\n * @example\n * ```\n * const player = new Player({\n * playbackConfig: {\n * isBackgroundPlaybackEnabled: true,\n * },\n * });\n * ```\n */\n isBackgroundPlaybackEnabled?: boolean;\n /**\n * Whether the Picture in Picture mode option is enabled or not. Default is `false`.\n * @example\n * ```\n * const player = new Player({\n * playbackConfig: {\n * isPictureInPictureEnabled: true,\n * },\n * });\n * ```\n * @deprecated Use {@link PictureInPictureConfig.isEnabled} instead.\n */\n isPictureInPictureEnabled?: boolean;\n\n /**\n * Configures decoder behaviour.\n *\n * @platform Android\n */\n decoderConfig?: DecoderConfig;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"playbackConfig.js","sourceRoot":"","sources":["../src/playbackConfig.ts"],"names":[],"mappings":"","sourcesContent":["import { DecoderConfig } from './decoder/decoderConfig';\n\n/**\n * Configures the playback behaviour of the player.\n */\nexport interface PlaybackConfig {\n /**\n * Whether the player starts playing automatically after loading a source or not. Default is `false`.\n * @example\n * ```\n * const player = new Player({\n * playbackConfig: {\n * isAutoplayEnabled: true,\n * },\n * });\n * ```\n */\n isAutoplayEnabled?: boolean;\n /**\n * Whether the sound is muted on startup or not. Default value is `false`.\n * @example\n * ```\n * const player = new Player({\n * playbackConfig: {\n * isMuted: true,\n * },\n * });\n * ```\n */\n isMuted?: boolean;\n /**\n * Whether time shift / DVR for live streams is enabled or not. Default is `true`.\n * @example\n * ```\n * const player = new Player({\n * playbackConfig: {\n * isTimeShiftEnabled: false,\n * },\n * });\n * ```\n */\n isTimeShiftEnabled?: boolean;\n /**\n * Whether background playback is enabled or not.\n * Default is `false`.\n *\n * When set to `true`, playback is not automatically paused\n * anymore when the app moves to the background.\n * When set to `true`, also make sure to properly configure your app to allow\n * background playback.\n *\n * Default is `false`.\n *\n * @remarks\n * - On Android, {@link MediaControlConfig.isEnabled} has to be `true` for\n * background playback to work.\n * - On tvOS, background playback is only supported for audio-only content.\n *\n * @example\n * ```\n * const player = new Player({\n * playbackConfig: {\n * isBackgroundPlaybackEnabled: true,\n * },\n * });\n * ```\n */\n isBackgroundPlaybackEnabled?: boolean;\n /**\n * Whether to automate audio focus management, allowing the player to pause when other apps request focus.\n *\n * @defaultValue `false`\n * @platform Android\n */\n handleAudioFocus?: boolean;\n /**\n * Whether the Picture in Picture mode option is enabled or not. Default is `false`.\n * @example\n * ```\n * const player = new Player({\n * playbackConfig: {\n * isPictureInPictureEnabled: true,\n * },\n * });\n * ```\n * @deprecated Use {@link PictureInPictureConfig.isEnabled} instead.\n */\n isPictureInPictureEnabled?: boolean;\n\n /**\n * Configures decoder behaviour.\n *\n * @platform Android\n */\n decoderConfig?: DecoderConfig;\n}\n"]}
|
package/ios/Event+JSON.swift
CHANGED
|
@@ -90,7 +90,7 @@ extension TimeChangedEvent: JsonConvertible {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
private protocol ErrorEventType: Event, JsonConvertible {
|
|
93
|
-
associatedtype Code
|
|
93
|
+
associatedtype Code: RawRepresentable where Code.RawValue == Int
|
|
94
94
|
var code: Code { get }
|
|
95
95
|
var data: DeficiencyData? { get }
|
|
96
96
|
var message: String { get }
|
|
@@ -100,7 +100,7 @@ extension ErrorEventType {
|
|
|
100
100
|
func toJSON() -> [AnyHashable: Any] {
|
|
101
101
|
toEventJSON {
|
|
102
102
|
var json: [AnyHashable: Any] = [
|
|
103
|
-
"code": code,
|
|
103
|
+
"code": code.rawValue,
|
|
104
104
|
"message": message
|
|
105
105
|
]
|
|
106
106
|
if let data {
|
|
@@ -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.
|
|
31
|
+
s.dependency "BitmovinPlayer", "3.110.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
|
|
package/ios/RNPlayerView.swift
CHANGED
|
@@ -30,6 +30,9 @@ public class RNPlayerView: ExpoView {
|
|
|
30
30
|
if let requestedPictureInPictureValue {
|
|
31
31
|
setPictureInPicture(enterPictureInPicture: requestedPictureInPictureValue)
|
|
32
32
|
}
|
|
33
|
+
if let isPictureInPictureEnabledValue {
|
|
34
|
+
playerView.pictureInPicture.isEnabled = isPictureInPictureEnabledValue
|
|
35
|
+
}
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -39,6 +42,7 @@ public class RNPlayerView: ExpoView {
|
|
|
39
42
|
private var scalingMode: ScalingMode?
|
|
40
43
|
private var requestedFullscreenValue: Bool?
|
|
41
44
|
private var requestedPictureInPictureValue: Bool?
|
|
45
|
+
private var isPictureInPictureEnabledValue: Bool?
|
|
42
46
|
private var avPlayerViewControllerTransitionForced = false
|
|
43
47
|
|
|
44
48
|
let onBmpEvent = EventDispatcher()
|
|
@@ -234,6 +238,11 @@ public class RNPlayerView: ExpoView {
|
|
|
234
238
|
playerView.tweaks.hidePlaybackControlsInPictureInPicture = !actions.contains(.togglePlayback)
|
|
235
239
|
#endif
|
|
236
240
|
}
|
|
241
|
+
|
|
242
|
+
internal func setIsPictureInPictureEnabled(_ isEnabled: Bool) {
|
|
243
|
+
isPictureInPictureEnabledValue = isEnabled
|
|
244
|
+
playerView?.pictureInPicture.isEnabled = isEnabled
|
|
245
|
+
}
|
|
237
246
|
}
|
|
238
247
|
|
|
239
248
|
private extension RNPlayerView {
|
|
@@ -32,6 +32,9 @@ public class RNPlayerViewManager: Module {
|
|
|
32
32
|
AsyncFunction("updatePictureInPictureActions") { (view: RNPlayerView, pictureInPictureActions: [String]) in
|
|
33
33
|
view.updatePictureInPictureActions(actions: RCTConvert.pictureInPictureActions(pictureInPictureActions))
|
|
34
34
|
}
|
|
35
|
+
AsyncFunction("setIsPictureInPictureEnabled") { (view: RNPlayerView, isEnabled: Bool) in
|
|
36
|
+
view.setIsPictureInPictureEnabled(isEnabled)
|
|
37
|
+
}
|
|
35
38
|
Events(
|
|
36
39
|
"onBmpEvent",
|
|
37
40
|
"onBmpPlayerActive",
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { RefObject, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
3
3
|
import { useKeepAwake } from 'expo-keep-awake';
|
|
4
4
|
import { NativePlayerView, NativePlayerViewConfig } from './native';
|
|
5
5
|
import { useProxy } from '../../hooks/useProxy';
|
|
@@ -35,6 +35,7 @@ export function PlayerView({
|
|
|
35
35
|
scalingMode,
|
|
36
36
|
isPictureInPictureRequested = false,
|
|
37
37
|
pictureInPictureActions,
|
|
38
|
+
isPictureInPictureEnabled,
|
|
38
39
|
...props
|
|
39
40
|
}: PlayerViewProps) {
|
|
40
41
|
// Keep the device awake while the PlayerView is mounted
|
|
@@ -109,6 +110,18 @@ export function PlayerView({
|
|
|
109
110
|
}
|
|
110
111
|
}, [isPlayerInitialized, pictureInPictureActions]);
|
|
111
112
|
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (
|
|
115
|
+
isPlayerInitialized &&
|
|
116
|
+
isPictureInPictureEnabled != null &&
|
|
117
|
+
Platform.OS === 'ios'
|
|
118
|
+
) {
|
|
119
|
+
void nativeView.current?.setIsPictureInPictureEnabled(
|
|
120
|
+
isPictureInPictureEnabled
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}, [isPlayerInitialized, isPictureInPictureEnabled]);
|
|
124
|
+
|
|
112
125
|
if (!isPlayerInitialized) {
|
|
113
126
|
return null;
|
|
114
127
|
}
|
|
@@ -220,4 +233,9 @@ interface InternalPlayerViewRef extends RefObject<any> {
|
|
|
220
233
|
updatePictureInPictureActions: (
|
|
221
234
|
actions: PictureInPictureAction[]
|
|
222
235
|
) => Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Enables or disables Picture in Picture mode availability.
|
|
238
|
+
* Only applicable on iOS — `isPictureInPictureRequested` has no effect when disabled.
|
|
239
|
+
*/
|
|
240
|
+
setIsPictureInPictureEnabled: (isEnabled: boolean) => Promise<void>;
|
|
223
241
|
}
|
|
@@ -73,6 +73,16 @@ export interface BasePlayerViewProps {
|
|
|
73
73
|
* - iOS: All actions enabled
|
|
74
74
|
*/
|
|
75
75
|
pictureInPictureActions?: PictureInPictureAction[];
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Enables or disables Picture in Picture mode availability.
|
|
79
|
+
* When disabled, `isPictureInPictureRequested` property has no effect.
|
|
80
|
+
*
|
|
81
|
+
* Can be changed dynamically after the player is initialized.
|
|
82
|
+
*
|
|
83
|
+
* @platform iOS, tvOS
|
|
84
|
+
*/
|
|
85
|
+
isPictureInPictureEnabled?: boolean;
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
/**
|
package/src/playbackConfig.ts
CHANGED
|
@@ -66,6 +66,13 @@ export interface PlaybackConfig {
|
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
68
|
isBackgroundPlaybackEnabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to automate audio focus management, allowing the player to pause when other apps request focus.
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue `false`
|
|
73
|
+
* @platform Android
|
|
74
|
+
*/
|
|
75
|
+
handleAudioFocus?: boolean;
|
|
69
76
|
/**
|
|
70
77
|
* Whether the Picture in Picture mode option is enabled or not. Default is `false`.
|
|
71
78
|
* @example
|