diff --git a/build/Video.d.ts b/build/Video.d.ts index 08b886548c8269..e921a33efc5a29 100644 --- a/build/Video.d.ts +++ b/build/Video.d.ts @@ -26,7 +26,7 @@ export default class Video extends React.Component imple static propTypes: { hitSlop?: PropTypes.Validator | undefined; onLayout?: PropTypes.Validator<((event: import("react-native").LayoutChangeEvent) => void) | undefined> | undefined; - pointerEvents?: PropTypes.Validator<"box-none" | "none" | "box-only" | "auto" | undefined> | undefined; + pointerEvents?: PropTypes.Validator<"none" | "box-none" | "box-only" | "auto" | undefined> | undefined; removeClippedSubviews?: PropTypes.Validator | undefined; style?: PropTypes.Validator> | undefined; testID?: PropTypes.Validator | undefined; @@ -64,14 +64,14 @@ export default class Video extends React.Component imple onTouchEndCapture?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined; accessible?: PropTypes.Validator | undefined; accessibilityLabel?: PropTypes.Validator | undefined; - accessibilityRole?: PropTypes.Validator<"button" | "header" | "link" | "summary" | "image" | "text" | "none" | "search" | "keyboardkey" | "adjustable" | "imagebutton" | undefined> | undefined; + accessibilityRole?: PropTypes.Validator<"none" | "button" | "header" | "link" | "summary" | "image" | "text" | "search" | "keyboardkey" | "adjustable" | "imagebutton" | undefined> | undefined; accessibilityStates?: PropTypes.Validator | undefined; accessibilityHint?: PropTypes.Validator | undefined; - accessibilityComponentType?: PropTypes.Validator<"button" | "none" | "radiobutton_checked" | "radiobutton_unchecked" | undefined> | undefined; + accessibilityComponentType?: PropTypes.Validator<"none" | "button" | "radiobutton_checked" | "radiobutton_unchecked" | undefined> | undefined; accessibilityLiveRegion?: PropTypes.Validator<"none" | "polite" | "assertive" | undefined> | undefined; importantForAccessibility?: PropTypes.Validator<"auto" | "yes" | "no" | "no-hide-descendants" | undefined> | undefined; accessibilityElementsHidden?: PropTypes.Validator | undefined; - accessibilityTraits?: PropTypes.Validator<"button" | "header" | "link" | "summary" | "image" | "text" | "none" | "search" | "adjustable" | "selected" | "disabled" | "plays" | "key" | "frequentUpdates" | "startsMedia" | "allowsDirectInteraction" | "pageTurn" | import("react-native").AccessibilityTrait[] | undefined> | undefined; + accessibilityTraits?: PropTypes.Validator<"key" | "none" | "button" | "header" | "link" | "summary" | "image" | "text" | "search" | "adjustable" | "selected" | "disabled" | "plays" | "frequentUpdates" | "startsMedia" | "allowsDirectInteraction" | "pageTurn" | import("react-native").AccessibilityTrait[] | undefined> | undefined; onAccessibilityTap?: PropTypes.Validator<(() => void) | undefined> | undefined; onMagicTap?: PropTypes.Validator<(() => void) | undefined> | undefined; accessibilityIgnoresInvertColors?: PropTypes.Validator | undefined; @@ -82,6 +82,7 @@ export default class Video extends React.Component imple posterSource: PropTypes.Requireable; }>>; + posterStyle: PropTypes.Validator> | undefined; onPlaybackStatusUpdate: PropTypes.Requireable<(...args: any[]) => any>; onLoadStart: PropTypes.Requireable<(...args: any[]) => any>; onLoad: PropTypes.Requireable<(...args: any[]) => any>; diff --git a/build/Video.js b/build/Video.js index 625cff2058245e..597103b9c07593 100644 --- a/build/Video.js +++ b/build/Video.js @@ -162,7 +162,7 @@ export default class Video extends React.Component { }; this._renderPoster = () => this.props.usePoster && this.state.showPoster ? ( // @ts-ignore: the react-native type declarations are overly restrictive - ) : null; + ) : null; this.state = { showPoster: !!props.usePoster, }; @@ -249,6 +249,7 @@ Video.propTypes = { }), PropTypes.number, ]), + posterStyle: ViewPropTypes.style, // Callbacks onPlaybackStatusUpdate: PropTypes.func, onLoadStart: PropTypes.func, diff --git a/build/Video.js.map b/build/Video.js.map index 2c110816ae7f89..5c592be8574cfd 100644 --- a/build/Video.js.map +++ b/build/Video.js.map @@ -1 +1 @@ -{"version":3,"file":"Video.js","sourceRoot":"","sources":["../src/Video.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OA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iBAAiB,EAAE,SAAS,CAAC,IAAI;IAEjC,WAAW;IACX,iBAAiB,EAAE,SAAS,CAAC,IAAI;IACjC,UAAU,EAAE,SAAS,CAAC,MAAM;IAC5B,SAAS,EAAE,SAAS,CAAC,IAAI;IAEzB,eAAe;IACf,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC;QACtB,4BAA4B,EAAE,SAAS,CAAC,MAAM;QAC9C,cAAc,EAAE,SAAS,CAAC,MAAM;QAChC,UAAU,EAAE,SAAS,CAAC,IAAI;QAC1B,IAAI,EAAE,SAAS,CAAC,MAAM;QACtB,kBAAkB,EAAE,SAAS,CAAC,IAAI;QAClC,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,OAAO,EAAE,SAAS,CAAC,IAAI;QACvB,SAAS,EAAE,SAAS,CAAC,IAAI;KAC1B,CAAC;IACF,4BAA4B,EAAE,SAAS,CAAC,MAAM;IAC9C,cAAc,EAAE,SAAS,CAAC,MAAM;IAChC,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,IAAI,EAAE,SAAS,CAAC,MAAM;IACtB,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,SAAS,EAAE,SAAS,CAAC,IAAI;IAEzB,2BAA2B;IAC3B,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,UAAU,EAAE,SAAS,CAAC,MAAM;IAC5B,UAAU,EAAE,SAAS,CAAC,MAAM;IAC5B,QAAQ,EAAE,SAAS,CAAC,MAAM;IAC1B,GAAG,aAAa;CACjB,CAAC;AAoRJ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import omit from 'lodash.omit';\nimport nullthrows from 'nullthrows';\nimport PropTypes from 'prop-types';\nimport * as React from 'react';\nimport { findNodeHandle, Image, NativeComponent, StyleSheet, View, ViewPropTypes } from 'react-native';\n\nimport {\n assertStatusValuesInBounds,\n getNativeSourceAndFullInitialStatusForLoadAsync,\n getNativeSourceFromSource,\n getUnloadedStatus,\n Playback,\n PlaybackMixin,\n PlaybackSource,\n PlaybackStatus,\n PlaybackStatusToSet,\n} from './AV';\nimport ExponentAV from './ExponentAV';\nimport ExponentVideo from './ExponentVideo';\nimport ExpoVideoManager from './ExpoVideoManager';\nimport {\n ExponentVideoComponent,\n FullscreenUpdateEvent,\n NativeProps,\n NaturalSize,\n VideoProps,\n ReadyForDisplayEvent,\n ResizeMode,\n VideoState,\n} from './Video.types';\n\nexport {\n ExponentVideoComponent,\n FullscreenUpdateEvent,\n NativeProps,\n NaturalSize,\n VideoProps,\n ReadyForDisplayEvent,\n ResizeMode,\n VideoState,\n}\n\nexport const FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT = 0;\nexport const FULLSCREEN_UPDATE_PLAYER_DID_PRESENT = 1;\nexport const FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS = 2;\nexport const FULLSCREEN_UPDATE_PLAYER_DID_DISMISS = 3;\n\nexport const IOS_FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT = FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT;\nexport const IOS_FULLSCREEN_UPDATE_PLAYER_DID_PRESENT = FULLSCREEN_UPDATE_PLAYER_DID_PRESENT;\nexport const IOS_FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS = FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS;\nexport const IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS = FULLSCREEN_UPDATE_PLAYER_DID_DISMISS;\n\nconst _STYLES = StyleSheet.create({\n base: {\n overflow: 'hidden',\n },\n poster: {\n position: 'absolute',\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n resizeMode: 'contain',\n },\n video: {\n position: 'absolute',\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n },\n});\n\n// On a real device UIManager should be present, however when running offline tests with jest-expo\n// we have to use the provided native module mock to access constants\nconst ExpoVideoManagerConstants = ExpoVideoManager;\nconst ExpoVideoViewManager = ExpoVideoManager;\n\nexport default class Video extends React.Component implements Playback {\n static RESIZE_MODE_CONTAIN = ResizeMode.CONTAIN;\n static RESIZE_MODE_COVER = ResizeMode.COVER;\n static RESIZE_MODE_STRETCH = ResizeMode.STRETCH;\n\n static IOS_FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT = IOS_FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT;\n static IOS_FULLSCREEN_UPDATE_PLAYER_DID_PRESENT = IOS_FULLSCREEN_UPDATE_PLAYER_DID_PRESENT;\n static IOS_FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS = IOS_FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS;\n static IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS = IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS;\n\n static FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT = FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT;\n static FULLSCREEN_UPDATE_PLAYER_DID_PRESENT = FULLSCREEN_UPDATE_PLAYER_DID_PRESENT;\n static FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS = FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS;\n static FULLSCREEN_UPDATE_PLAYER_DID_DISMISS = FULLSCREEN_UPDATE_PLAYER_DID_DISMISS;\n\n static propTypes = {\n // Source stuff\n source: PropTypes.oneOfType([\n PropTypes.shape({\n uri: PropTypes.string,\n overrideFileExtensionAndroid: PropTypes.string,\n }), // remote URI like { uri: 'http://foo/bar.mp4' }\n PropTypes.number, // asset module like require('./foo/bar.mp4')\n ]),\n posterSource: PropTypes.oneOfType([\n PropTypes.shape({\n uri: PropTypes.string,\n }), // remote URI like { uri: 'http://foo/bar.mp4' }\n PropTypes.number, // asset module like require('./foo/bar.mp4')\n ]),\n\n // Callbacks\n onPlaybackStatusUpdate: PropTypes.func,\n onLoadStart: PropTypes.func,\n onLoad: PropTypes.func,\n onError: PropTypes.func,\n onIOSFullscreenUpdate: PropTypes.func,\n onFullscreenUpdate: PropTypes.func,\n onReadyForDisplay: PropTypes.func,\n\n // UI stuff\n useNativeControls: PropTypes.bool,\n resizeMode: PropTypes.string,\n usePoster: PropTypes.bool,\n\n // Playback API\n status: PropTypes.shape({\n progressUpdateIntervalMillis: PropTypes.number,\n positionMillis: PropTypes.number,\n shouldPlay: PropTypes.bool,\n rate: PropTypes.number,\n shouldCorrectPitch: PropTypes.bool,\n volume: PropTypes.number,\n isMuted: PropTypes.bool,\n isLooping: PropTypes.bool,\n }),\n progressUpdateIntervalMillis: PropTypes.number,\n positionMillis: PropTypes.number,\n shouldPlay: PropTypes.bool,\n rate: PropTypes.number,\n shouldCorrectPitch: PropTypes.bool,\n volume: PropTypes.number,\n isMuted: PropTypes.bool,\n isLooping: PropTypes.bool,\n\n // Required by react-native\n scaleX: PropTypes.number,\n scaleY: PropTypes.number,\n translateX: PropTypes.number,\n translateY: PropTypes.number,\n rotation: PropTypes.number,\n ...ViewPropTypes,\n };\n\n _nativeRef = React.createRef & NativeComponent>();\n\n // componentOrHandle: null | number | React.Component | React.ComponentClass\n\n constructor(props: VideoProps) {\n super(props);\n this.state = {\n showPoster: !!props.usePoster,\n };\n }\n\n setNativeProps(nativeProps: NativeProps) {\n const nativeVideo = nullthrows(this._nativeRef.current);\n nativeVideo.setNativeProps(nativeProps);\n }\n\n // Internal methods\n\n _handleNewStatus = (status: PlaybackStatus) => {\n if (\n this.state.showPoster &&\n status.isLoaded &&\n (status.isPlaying || status.positionMillis !== 0)\n ) {\n this.setState({ showPoster: false });\n }\n\n if (this.props.onPlaybackStatusUpdate) {\n this.props.onPlaybackStatusUpdate(status);\n }\n };\n\n _performOperationAndHandleStatusAsync = async (\n operation: (tag: number) => Promise\n ): Promise => {\n const video = this._nativeRef.current;\n if (!video) {\n throw new Error(`Cannot complete operation because the Video component has not yet loaded`);\n }\n\n const handle = findNodeHandle(this._nativeRef.current)!;\n const status: PlaybackStatus = await operation(handle);\n this._handleNewStatus(status);\n return status;\n };\n\n // ### iOS Fullscreening API ###\n\n _setFullscreen = async (value: boolean) => {\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExpoVideoViewManager.setFullscreen(tag, value)\n );\n };\n\n presentFullscreenPlayer = async () => {\n return this._setFullscreen(true);\n };\n\n presentIOSFullscreenPlayer = () => {\n console.warn(\n \"You're using `presentIOSFullscreenPlayer`. Please migrate your code to use `presentFullscreenPlayer` instead.\"\n );\n return this.presentFullscreenPlayer();\n };\n\n presentFullscreenPlayerAsync = async () => {\n return await this.presentFullscreenPlayer();\n };\n\n dismissFullscreenPlayer = async () => {\n return this._setFullscreen(false);\n };\n\n dismissIOSFullscreenPlayer = () => {\n console.warn(\n \"You're using `dismissIOSFullscreenPlayer`. Please migrate your code to use `dismissFullscreenPlayer` instead.\"\n );\n this.dismissFullscreenPlayer();\n };\n\n // ### Unified playback API ### (consistent with Audio.js)\n // All calls automatically call onPlaybackStatusUpdate as a side effect.\n\n // Get status API\n\n getStatusAsync = async (): Promise => {\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExponentAV.getStatusForVideo(tag)\n );\n };\n\n // Loading / unloading API\n\n loadAsync = async (\n source: PlaybackSource,\n initialStatus: PlaybackStatusToSet = {},\n downloadFirst: boolean = true\n ): Promise => {\n const {\n nativeSource,\n fullInitialStatus,\n } = await getNativeSourceAndFullInitialStatusForLoadAsync(source, initialStatus, downloadFirst);\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExponentAV.loadForVideo(tag, nativeSource, fullInitialStatus)\n );\n };\n\n // Equivalent to setting URI to null.\n unloadAsync = async (): Promise => {\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExponentAV.unloadForVideo(tag)\n );\n };\n\n // Set status API (only available while isLoaded = true)\n\n setStatusAsync = async (status: PlaybackStatusToSet): Promise => {\n assertStatusValuesInBounds(status);\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExponentAV.setStatusForVideo(tag, status)\n );\n };\n\n replayAsync = async (status: PlaybackStatusToSet = {}): Promise => {\n if (status.positionMillis && status.positionMillis !== 0) {\n throw new Error('Requested position after replay has to be 0.');\n }\n\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExponentAV.replayVideo(tag, {\n ...status,\n positionMillis: 0,\n shouldPlay: true,\n })\n );\n };\n\n // Methods of the Playback interface that are set via PlaybackMixin\n playAsync!: () => Promise;\n playFromPositionAsync!: (\n positionMillis: number,\n tolerances?: { toleranceMillisBefore?: number; toleranceMillisAfter?: number }\n ) => Promise;\n pauseAsync!: () => Promise;\n stopAsync!: () => Promise;\n setPositionAsync!: (\n positionMillis: number,\n tolerances?: { toleranceMillisBefore?: number; toleranceMillisAfter?: number }\n ) => Promise;\n setRateAsync!: (rate: number, shouldCorrectPitch: boolean) => Promise;\n setVolumeAsync!: (volume: number) => Promise;\n setIsMutedAsync!: (isMuted: boolean) => Promise;\n setIsLoopingAsync!: (isLooping: boolean) => Promise;\n setProgressUpdateIntervalAsync!: (\n progressUpdateIntervalMillis: number\n ) => Promise;\n\n // ### Callback wrappers ###\n\n _nativeOnPlaybackStatusUpdate = (event: { nativeEvent: PlaybackStatus }) => {\n this._handleNewStatus(event.nativeEvent);\n };\n\n // TODO make sure we are passing the right stuff\n _nativeOnLoadStart = () => {\n if (this.props.onLoadStart) {\n this.props.onLoadStart();\n }\n };\n\n _nativeOnLoad = (event: { nativeEvent: PlaybackStatus }) => {\n if (this.props.onLoad) {\n this.props.onLoad(event.nativeEvent);\n }\n this._handleNewStatus(event.nativeEvent);\n };\n\n _nativeOnError = (event: { nativeEvent: { error: string } }) => {\n const error: string = event.nativeEvent.error;\n if (this.props.onError) {\n this.props.onError(error);\n }\n this._handleNewStatus(getUnloadedStatus(error));\n };\n\n _nativeOnReadyForDisplay = (event: { nativeEvent: ReadyForDisplayEvent }) => {\n if (this.props.onReadyForDisplay) {\n this.props.onReadyForDisplay(event.nativeEvent);\n }\n };\n\n _nativeOnFullscreenUpdate = (event: { nativeEvent: FullscreenUpdateEvent }) => {\n if (this.props.onIOSFullscreenUpdate && this.props.onFullscreenUpdate) {\n console.warn(\n \"You've supplied both `onIOSFullscreenUpdate` and `onFullscreenUpdate`. You're going to receive updates on both the callbacks.\"\n );\n } else if (this.props.onIOSFullscreenUpdate) {\n console.warn(\n \"You're using `onIOSFullscreenUpdate`. Please migrate your code to use `onFullscreenUpdate` instead.\"\n );\n }\n\n if (this.props.onIOSFullscreenUpdate) {\n this.props.onIOSFullscreenUpdate(event.nativeEvent);\n }\n\n if (this.props.onFullscreenUpdate) {\n this.props.onFullscreenUpdate(event.nativeEvent);\n }\n };\n\n _renderPoster = () =>\n this.props.usePoster && this.state.showPoster ? (\n // @ts-ignore: the react-native type declarations are overly restrictive\n \n ) : null;\n\n render() {\n const source = getNativeSourceFromSource(this.props.source || null);\n\n let nativeResizeMode = ExpoVideoManagerConstants.ScaleNone;\n if (this.props.resizeMode) {\n let resizeMode = this.props.resizeMode;\n if (resizeMode === ResizeMode.STRETCH) {\n nativeResizeMode = ExpoVideoManagerConstants.ScaleToFill;\n } else if (resizeMode === ResizeMode.CONTAIN) {\n nativeResizeMode = ExpoVideoManagerConstants.ScaleAspectFit;\n } else if (resizeMode === ResizeMode.COVER) {\n nativeResizeMode = ExpoVideoManagerConstants.ScaleAspectFill;\n }\n }\n\n // Set status via individual props\n const status: PlaybackStatusToSet = { ...this.props.status };\n [\n 'progressUpdateIntervalMillis',\n 'positionMillis',\n 'shouldPlay',\n 'rate',\n 'shouldCorrectPitch',\n 'volume',\n 'isMuted',\n 'isLooping',\n ].forEach(prop => {\n if (prop in this.props) {\n status[prop] = this.props[prop];\n }\n });\n\n // Replace selected native props\n // @ts-ignore: TypeScript thinks \"children\" is not in the list of props\n const nativeProps: NativeProps = {\n ...omit(this.props, 'source', 'onPlaybackStatusUpdate', ...Object.keys(status)),\n style: StyleSheet.flatten([_STYLES.base, this.props.style]),\n source,\n resizeMode: nativeResizeMode,\n status,\n onStatusUpdate: this._nativeOnPlaybackStatusUpdate,\n onLoadStart: this._nativeOnLoadStart,\n onLoad: this._nativeOnLoad,\n onError: this._nativeOnError,\n onReadyForDisplay: this._nativeOnReadyForDisplay,\n onFullscreenUpdate: this._nativeOnFullscreenUpdate,\n };\n\n return (\n \n \n {this._renderPoster()}\n \n );\n }\n}\n\nObject.assign(Video.prototype, PlaybackMixin);\n"]} \ No newline at end of file +{"version":3,"file":"Video.js","sourceRoot":"","sources":["../src/Video.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,KAAK,EAAmB,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvG,OAAO,EACL,0BAA0B,EAC1B,+CAA+C,EAC/C,yBAAyB,EACzB,iBAAiB,EAEjB,aAAa,GAId,MAAM,MAAM,CAAC;AACd,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAOL,UAAU,GAEX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAOL,UAAU,GAEX,CAAA;AAED,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,yCAAyC,GAAG,qCAAqC,CAAC;AAC/F,MAAM,CAAC,MAAM,wCAAwC,GAAG,oCAA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SAAS,CAAC,IAAI;IAC1B,IAAI,EAAE,SAAS,CAAC,MAAM;IACtB,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,SAAS,EAAE,SAAS,CAAC,IAAI;IAEzB,2BAA2B;IAC3B,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,UAAU,EAAE,SAAS,CAAC,MAAM;IAC5B,UAAU,EAAE,SAAS,CAAC,MAAM;IAC5B,QAAQ,EAAE,SAAS,CAAC,MAAM;IAC1B,GAAG,aAAa;CACjB,CAAC;AAoRJ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import omit from 'lodash.omit';\nimport nullthrows from 'nullthrows';\nimport PropTypes from 'prop-types';\nimport * as React from 'react';\nimport { findNodeHandle, Image, NativeComponent, StyleSheet, View, ViewPropTypes } from 'react-native';\n\nimport {\n assertStatusValuesInBounds,\n getNativeSourceAndFullInitialStatusForLoadAsync,\n getNativeSourceFromSource,\n getUnloadedStatus,\n Playback,\n PlaybackMixin,\n PlaybackSource,\n PlaybackStatus,\n PlaybackStatusToSet,\n} from './AV';\nimport ExponentAV from './ExponentAV';\nimport ExponentVideo from './ExponentVideo';\nimport ExpoVideoManager from './ExpoVideoManager';\nimport {\n ExponentVideoComponent,\n FullscreenUpdateEvent,\n NativeProps,\n NaturalSize,\n VideoProps,\n ReadyForDisplayEvent,\n ResizeMode,\n VideoState,\n} from './Video.types';\n\nexport {\n ExponentVideoComponent,\n FullscreenUpdateEvent,\n NativeProps,\n NaturalSize,\n VideoProps,\n ReadyForDisplayEvent,\n ResizeMode,\n VideoState,\n}\n\nexport const FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT = 0;\nexport const FULLSCREEN_UPDATE_PLAYER_DID_PRESENT = 1;\nexport const FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS = 2;\nexport const FULLSCREEN_UPDATE_PLAYER_DID_DISMISS = 3;\n\nexport const IOS_FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT = FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT;\nexport const IOS_FULLSCREEN_UPDATE_PLAYER_DID_PRESENT = FULLSCREEN_UPDATE_PLAYER_DID_PRESENT;\nexport const IOS_FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS = FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS;\nexport const IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS = FULLSCREEN_UPDATE_PLAYER_DID_DISMISS;\n\nconst _STYLES = StyleSheet.create({\n base: {\n overflow: 'hidden',\n },\n poster: {\n position: 'absolute',\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n resizeMode: 'contain',\n },\n video: {\n position: 'absolute',\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n },\n});\n\n// On a real device UIManager should be present, however when running offline tests with jest-expo\n// we have to use the provided native module mock to access constants\nconst ExpoVideoManagerConstants = ExpoVideoManager;\nconst ExpoVideoViewManager = ExpoVideoManager;\n\nexport default class Video extends React.Component implements Playback {\n static RESIZE_MODE_CONTAIN = ResizeMode.CONTAIN;\n static RESIZE_MODE_COVER = ResizeMode.COVER;\n static RESIZE_MODE_STRETCH = ResizeMode.STRETCH;\n\n static IOS_FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT = IOS_FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT;\n static IOS_FULLSCREEN_UPDATE_PLAYER_DID_PRESENT = IOS_FULLSCREEN_UPDATE_PLAYER_DID_PRESENT;\n static IOS_FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS = IOS_FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS;\n static IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS = IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS;\n\n static FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT = FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT;\n static FULLSCREEN_UPDATE_PLAYER_DID_PRESENT = FULLSCREEN_UPDATE_PLAYER_DID_PRESENT;\n static FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS = FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS;\n static FULLSCREEN_UPDATE_PLAYER_DID_DISMISS = FULLSCREEN_UPDATE_PLAYER_DID_DISMISS;\n\n static propTypes = {\n // Source stuff\n source: PropTypes.oneOfType([\n PropTypes.shape({\n uri: PropTypes.string,\n overrideFileExtensionAndroid: PropTypes.string,\n }), // remote URI like { uri: 'http://foo/bar.mp4' }\n PropTypes.number, // asset module like require('./foo/bar.mp4')\n ]),\n posterSource: PropTypes.oneOfType([\n PropTypes.shape({\n uri: PropTypes.string,\n }), // remote URI like { uri: 'http://foo/bar.mp4' }\n PropTypes.number, // asset module like require('./foo/bar.mp4')\n ]),\n posterStyle: ViewPropTypes.style,\n\n // Callbacks\n onPlaybackStatusUpdate: PropTypes.func,\n onLoadStart: PropTypes.func,\n onLoad: PropTypes.func,\n onError: PropTypes.func,\n onIOSFullscreenUpdate: PropTypes.func,\n onFullscreenUpdate: PropTypes.func,\n onReadyForDisplay: PropTypes.func,\n\n // UI stuff\n useNativeControls: PropTypes.bool,\n resizeMode: PropTypes.string,\n usePoster: PropTypes.bool,\n\n // Playback API\n status: PropTypes.shape({\n progressUpdateIntervalMillis: PropTypes.number,\n positionMillis: PropTypes.number,\n shouldPlay: PropTypes.bool,\n rate: PropTypes.number,\n shouldCorrectPitch: PropTypes.bool,\n volume: PropTypes.number,\n isMuted: PropTypes.bool,\n isLooping: PropTypes.bool,\n }),\n progressUpdateIntervalMillis: PropTypes.number,\n positionMillis: PropTypes.number,\n shouldPlay: PropTypes.bool,\n rate: PropTypes.number,\n shouldCorrectPitch: PropTypes.bool,\n volume: PropTypes.number,\n isMuted: PropTypes.bool,\n isLooping: PropTypes.bool,\n\n // Required by react-native\n scaleX: PropTypes.number,\n scaleY: PropTypes.number,\n translateX: PropTypes.number,\n translateY: PropTypes.number,\n rotation: PropTypes.number,\n ...ViewPropTypes,\n };\n\n _nativeRef = React.createRef & NativeComponent>();\n\n // componentOrHandle: null | number | React.Component | React.ComponentClass\n\n constructor(props: VideoProps) {\n super(props);\n this.state = {\n showPoster: !!props.usePoster,\n };\n }\n\n setNativeProps(nativeProps: NativeProps) {\n const nativeVideo = nullthrows(this._nativeRef.current);\n nativeVideo.setNativeProps(nativeProps);\n }\n\n // Internal methods\n\n _handleNewStatus = (status: PlaybackStatus) => {\n if (\n this.state.showPoster &&\n status.isLoaded &&\n (status.isPlaying || status.positionMillis !== 0)\n ) {\n this.setState({ showPoster: false });\n }\n\n if (this.props.onPlaybackStatusUpdate) {\n this.props.onPlaybackStatusUpdate(status);\n }\n };\n\n _performOperationAndHandleStatusAsync = async (\n operation: (tag: number) => Promise\n ): Promise => {\n const video = this._nativeRef.current;\n if (!video) {\n throw new Error(`Cannot complete operation because the Video component has not yet loaded`);\n }\n\n const handle = findNodeHandle(this._nativeRef.current)!;\n const status: PlaybackStatus = await operation(handle);\n this._handleNewStatus(status);\n return status;\n };\n\n // ### iOS Fullscreening API ###\n\n _setFullscreen = async (value: boolean) => {\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExpoVideoViewManager.setFullscreen(tag, value)\n );\n };\n\n presentFullscreenPlayer = async () => {\n return this._setFullscreen(true);\n };\n\n presentIOSFullscreenPlayer = () => {\n console.warn(\n \"You're using `presentIOSFullscreenPlayer`. Please migrate your code to use `presentFullscreenPlayer` instead.\"\n );\n return this.presentFullscreenPlayer();\n };\n\n presentFullscreenPlayerAsync = async () => {\n return await this.presentFullscreenPlayer();\n };\n\n dismissFullscreenPlayer = async () => {\n return this._setFullscreen(false);\n };\n\n dismissIOSFullscreenPlayer = () => {\n console.warn(\n \"You're using `dismissIOSFullscreenPlayer`. Please migrate your code to use `dismissFullscreenPlayer` instead.\"\n );\n this.dismissFullscreenPlayer();\n };\n\n // ### Unified playback API ### (consistent with Audio.js)\n // All calls automatically call onPlaybackStatusUpdate as a side effect.\n\n // Get status API\n\n getStatusAsync = async (): Promise => {\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExponentAV.getStatusForVideo(tag)\n );\n };\n\n // Loading / unloading API\n\n loadAsync = async (\n source: PlaybackSource,\n initialStatus: PlaybackStatusToSet = {},\n downloadFirst: boolean = true\n ): Promise => {\n const {\n nativeSource,\n fullInitialStatus,\n } = await getNativeSourceAndFullInitialStatusForLoadAsync(source, initialStatus, downloadFirst);\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExponentAV.loadForVideo(tag, nativeSource, fullInitialStatus)\n );\n };\n\n // Equivalent to setting URI to null.\n unloadAsync = async (): Promise => {\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExponentAV.unloadForVideo(tag)\n );\n };\n\n // Set status API (only available while isLoaded = true)\n\n setStatusAsync = async (status: PlaybackStatusToSet): Promise => {\n assertStatusValuesInBounds(status);\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExponentAV.setStatusForVideo(tag, status)\n );\n };\n\n replayAsync = async (status: PlaybackStatusToSet = {}): Promise => {\n if (status.positionMillis && status.positionMillis !== 0) {\n throw new Error('Requested position after replay has to be 0.');\n }\n\n return this._performOperationAndHandleStatusAsync((tag: number) =>\n ExponentAV.replayVideo(tag, {\n ...status,\n positionMillis: 0,\n shouldPlay: true,\n })\n );\n };\n\n // Methods of the Playback interface that are set via PlaybackMixin\n playAsync!: () => Promise;\n playFromPositionAsync!: (\n positionMillis: number,\n tolerances?: { toleranceMillisBefore?: number; toleranceMillisAfter?: number }\n ) => Promise;\n pauseAsync!: () => Promise;\n stopAsync!: () => Promise;\n setPositionAsync!: (\n positionMillis: number,\n tolerances?: { toleranceMillisBefore?: number; toleranceMillisAfter?: number }\n ) => Promise;\n setRateAsync!: (rate: number, shouldCorrectPitch: boolean) => Promise;\n setVolumeAsync!: (volume: number) => Promise;\n setIsMutedAsync!: (isMuted: boolean) => Promise;\n setIsLoopingAsync!: (isLooping: boolean) => Promise;\n setProgressUpdateIntervalAsync!: (\n progressUpdateIntervalMillis: number\n ) => Promise;\n\n // ### Callback wrappers ###\n\n _nativeOnPlaybackStatusUpdate = (event: { nativeEvent: PlaybackStatus }) => {\n this._handleNewStatus(event.nativeEvent);\n };\n\n // TODO make sure we are passing the right stuff\n _nativeOnLoadStart = () => {\n if (this.props.onLoadStart) {\n this.props.onLoadStart();\n }\n };\n\n _nativeOnLoad = (event: { nativeEvent: PlaybackStatus }) => {\n if (this.props.onLoad) {\n this.props.onLoad(event.nativeEvent);\n }\n this._handleNewStatus(event.nativeEvent);\n };\n\n _nativeOnError = (event: { nativeEvent: { error: string } }) => {\n const error: string = event.nativeEvent.error;\n if (this.props.onError) {\n this.props.onError(error);\n }\n this._handleNewStatus(getUnloadedStatus(error));\n };\n\n _nativeOnReadyForDisplay = (event: { nativeEvent: ReadyForDisplayEvent }) => {\n if (this.props.onReadyForDisplay) {\n this.props.onReadyForDisplay(event.nativeEvent);\n }\n };\n\n _nativeOnFullscreenUpdate = (event: { nativeEvent: FullscreenUpdateEvent }) => {\n if (this.props.onIOSFullscreenUpdate && this.props.onFullscreenUpdate) {\n console.warn(\n \"You've supplied both `onIOSFullscreenUpdate` and `onFullscreenUpdate`. You're going to receive updates on both the callbacks.\"\n );\n } else if (this.props.onIOSFullscreenUpdate) {\n console.warn(\n \"You're using `onIOSFullscreenUpdate`. Please migrate your code to use `onFullscreenUpdate` instead.\"\n );\n }\n\n if (this.props.onIOSFullscreenUpdate) {\n this.props.onIOSFullscreenUpdate(event.nativeEvent);\n }\n\n if (this.props.onFullscreenUpdate) {\n this.props.onFullscreenUpdate(event.nativeEvent);\n }\n };\n\n _renderPoster = () =>\n this.props.usePoster && this.state.showPoster ? (\n // @ts-ignore: the react-native type declarations are overly restrictive\n \n ) : null;\n\n render() {\n const source = getNativeSourceFromSource(this.props.source || null);\n\n let nativeResizeMode = ExpoVideoManagerConstants.ScaleNone;\n if (this.props.resizeMode) {\n let resizeMode = this.props.resizeMode;\n if (resizeMode === ResizeMode.STRETCH) {\n nativeResizeMode = ExpoVideoManagerConstants.ScaleToFill;\n } else if (resizeMode === ResizeMode.CONTAIN) {\n nativeResizeMode = ExpoVideoManagerConstants.ScaleAspectFit;\n } else if (resizeMode === ResizeMode.COVER) {\n nativeResizeMode = ExpoVideoManagerConstants.ScaleAspectFill;\n }\n }\n\n // Set status via individual props\n const status: PlaybackStatusToSet = { ...this.props.status };\n [\n 'progressUpdateIntervalMillis',\n 'positionMillis',\n 'shouldPlay',\n 'rate',\n 'shouldCorrectPitch',\n 'volume',\n 'isMuted',\n 'isLooping',\n ].forEach(prop => {\n if (prop in this.props) {\n status[prop] = this.props[prop];\n }\n });\n\n // Replace selected native props\n // @ts-ignore: TypeScript thinks \"children\" is not in the list of props\n const nativeProps: NativeProps = {\n ...omit(this.props, 'source', 'onPlaybackStatusUpdate', ...Object.keys(status)),\n style: StyleSheet.flatten([_STYLES.base, this.props.style]),\n source,\n resizeMode: nativeResizeMode,\n status,\n onStatusUpdate: this._nativeOnPlaybackStatusUpdate,\n onLoadStart: this._nativeOnLoadStart,\n onLoad: this._nativeOnLoad,\n onError: this._nativeOnError,\n onReadyForDisplay: this._nativeOnReadyForDisplay,\n onFullscreenUpdate: this._nativeOnFullscreenUpdate,\n };\n\n return (\n \n \n {this._renderPoster()}\n \n );\n }\n}\n\nObject.assign(Video.prototype, PlaybackMixin);\n"]} \ No newline at end of file diff --git a/build/Video.types.d.ts b/build/Video.types.d.ts index 209cb3b2719d1c..5d8dbf3f59b4f7 100644 --- a/build/Video.types.d.ts +++ b/build/Video.types.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import { View } from 'react-native'; +import { View, StyleProp, ViewStyle } from 'react-native'; import { PlaybackNativeSource, PlaybackSource, PlaybackStatus, PlaybackStatusToSet } from './AV'; export declare type NaturalSize = { width: number; @@ -24,6 +24,7 @@ export declare type VideoProps = { posterSource?: { uri: string; } | number; + posterStyle?: StyleProp; onPlaybackStatusUpdate?: (status: PlaybackStatus) => void; onLoadStart?: () => void; onLoad?: (status: PlaybackStatus) => void; diff --git a/build/Video.types.js.map b/build/Video.types.js.map index 18c40a8066ea6e..790b73a17b3cd7 100644 --- a/build/Video.types.js.map +++ b/build/Video.types.js.map @@ -1 +1 @@ -{"version":3,"file":"Video.types.js","sourceRoot":"","sources":["../src/Video.types.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,6BAAe,CAAA;IACf,iCAAmB,CAAA;AACrB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB","sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\n\nimport { PlaybackNativeSource, PlaybackSource, PlaybackStatus, PlaybackStatusToSet } from './AV';\nexport type NaturalSize = {\n width: number;\n height: number;\n orientation: 'portrait' | 'landscape';\n};\n\nexport enum ResizeMode {\n CONTAIN = 'contain',\n COVER = 'cover',\n STRETCH = 'stretch',\n}\n\nexport type ReadyForDisplayEvent = {\n naturalSize: NaturalSize;\n status: PlaybackStatus;\n};\n\nexport type FullscreenUpdateEvent = {\n fullscreenUpdate: 0 | 1 | 2 | 3;\n status: PlaybackStatus;\n};\n\nexport type VideoProps = {\n // Source stuff\n source?: PlaybackSource; // { uri: 'http://foo/bar.mp4' }, Asset, or require('./foo/bar.mp4')\n posterSource?: { uri: string } | number; // { uri: 'http://foo/bar.mp4' } or require('./foo/bar.mp4')\n\n // Callbacks\n onPlaybackStatusUpdate?: (status: PlaybackStatus) => void;\n onLoadStart?: () => void;\n onLoad?: (status: PlaybackStatus) => void;\n onError?: (error: string) => void;\n onReadyForDisplay?: (event: ReadyForDisplayEvent) => void;\n onFullscreenUpdate?: (event: FullscreenUpdateEvent) => void;\n onIOSFullscreenUpdate?: (event: FullscreenUpdateEvent) => void;\n\n // UI stuff\n useNativeControls?: boolean;\n // NOTE(ide): This should just be ResizeMode. We have the explicit strings for now since we don't\n // currently the ResizeMode enum.\n resizeMode?: ResizeMode | 'stretch' | 'cover' | 'contain';\n usePoster?: boolean;\n\n // Playback API\n status?: PlaybackStatusToSet;\n progressUpdateIntervalMillis?: number;\n positionMillis?: number;\n shouldPlay?: boolean;\n rate?: number;\n shouldCorrectPitch?: boolean;\n volume?: number;\n isMuted?: boolean;\n isLooping?: boolean;\n\n // Required by react-native\n scaleX?: number;\n scaleY?: number;\n translateX?: number;\n translateY?: number;\n rotation?: number;\n} & React.ComponentProps;\n\nexport type NativeProps = {\n source: PlaybackNativeSource | null;\n resizeMode?: unknown;\n status?: PlaybackStatusToSet;\n onLoadStart?: () => void;\n onLoad?: (event: { nativeEvent: PlaybackStatus }) => void;\n onError?: (event: { nativeEvent: { error: string } }) => void;\n onStatusUpdate?: (event: { nativeEvent: PlaybackStatus }) => void;\n onReadyForDisplay?: (event: { nativeEvent: ReadyForDisplayEvent }) => void;\n onFullscreenUpdate?: (event: { nativeEvent: FullscreenUpdateEvent }) => void;\n useNativeControls?: boolean;\n} & React.ComponentProps;\n\nexport type VideoState = {\n showPoster: boolean;\n};\nexport type ExponentVideoComponent = React.ComponentClass;\n"]} \ No newline at end of file +{"version":3,"file":"Video.types.js","sourceRoot":"","sources":["../src/Video.types.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,6BAAe,CAAA;IACf,iCAAmB,CAAA;AACrB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB","sourcesContent":["import * as React from 'react';\nimport { View, StyleProp, ViewStyle } from 'react-native';\n\nimport { PlaybackNativeSource, PlaybackSource, PlaybackStatus, PlaybackStatusToSet } from './AV';\nexport type NaturalSize = {\n width: number;\n height: number;\n orientation: 'portrait' | 'landscape';\n};\n\nexport enum ResizeMode {\n CONTAIN = 'contain',\n COVER = 'cover',\n STRETCH = 'stretch',\n}\n\nexport type ReadyForDisplayEvent = {\n naturalSize: NaturalSize;\n status: PlaybackStatus;\n};\n\nexport type FullscreenUpdateEvent = {\n fullscreenUpdate: 0 | 1 | 2 | 3;\n status: PlaybackStatus;\n};\n\nexport type VideoProps = {\n // Source stuff\n source?: PlaybackSource; // { uri: 'http://foo/bar.mp4' }, Asset, or require('./foo/bar.mp4')\n posterSource?: { uri: string } | number; // { uri: 'http://foo/bar.mp4' } or require('./foo/bar.mp4')\n posterStyle?: StyleProp;\n\n // Callbacks\n onPlaybackStatusUpdate?: (status: PlaybackStatus) => void;\n onLoadStart?: () => void;\n onLoad?: (status: PlaybackStatus) => void;\n onError?: (error: string) => void;\n onReadyForDisplay?: (event: ReadyForDisplayEvent) => void;\n onFullscreenUpdate?: (event: FullscreenUpdateEvent) => void;\n onIOSFullscreenUpdate?: (event: FullscreenUpdateEvent) => void;\n\n // UI stuff\n useNativeControls?: boolean;\n // NOTE(ide): This should just be ResizeMode. We have the explicit strings for now since we don't\n // currently the ResizeMode enum.\n resizeMode?: ResizeMode | 'stretch' | 'cover' | 'contain';\n usePoster?: boolean;\n\n // Playback API\n status?: PlaybackStatusToSet;\n progressUpdateIntervalMillis?: number;\n positionMillis?: number;\n shouldPlay?: boolean;\n rate?: number;\n shouldCorrectPitch?: boolean;\n volume?: number;\n isMuted?: boolean;\n isLooping?: boolean;\n\n // Required by react-native\n scaleX?: number;\n scaleY?: number;\n translateX?: number;\n translateY?: number;\n rotation?: number;\n} & React.ComponentProps;\n\nexport type NativeProps = {\n source: PlaybackNativeSource | null;\n resizeMode?: unknown;\n status?: PlaybackStatusToSet;\n onLoadStart?: () => void;\n onLoad?: (event: { nativeEvent: PlaybackStatus }) => void;\n onError?: (event: { nativeEvent: { error: string } }) => void;\n onStatusUpdate?: (event: { nativeEvent: PlaybackStatus }) => void;\n onReadyForDisplay?: (event: { nativeEvent: ReadyForDisplayEvent }) => void;\n onFullscreenUpdate?: (event: { nativeEvent: FullscreenUpdateEvent }) => void;\n useNativeControls?: boolean;\n} & React.ComponentProps;\n\nexport type VideoState = {\n showPoster: boolean;\n};\nexport type ExponentVideoComponent = React.ComponentClass;\n"]} \ No newline at end of file diff --git a/src/Video.tsx b/src/Video.tsx index 7bf4b34ec5747a..fe5fa3f8506943 100644 --- a/src/Video.tsx +++ b/src/Video.tsx @@ -106,6 +106,7 @@ export default class Video extends React.Component imple }), // remote URI like { uri: 'http://foo/bar.mp4' } PropTypes.number, // asset module like require('./foo/bar.mp4') ]), + posterStyle: ViewPropTypes.style, // Callbacks onPlaybackStatusUpdate: PropTypes.func, @@ -364,7 +365,7 @@ export default class Video extends React.Component imple _renderPoster = () => this.props.usePoster && this.state.showPoster ? ( // @ts-ignore: the react-native type declarations are overly restrictive - + ) : null; render() { diff --git a/src/Video.types.ts b/src/Video.types.ts index 23da3d12736622..143da0dc872aad 100644 --- a/src/Video.types.ts +++ b/src/Video.types.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import { View } from 'react-native'; +import { View, StyleProp, ViewStyle } from 'react-native'; import { PlaybackNativeSource, PlaybackSource, PlaybackStatus, PlaybackStatusToSet } from './AV'; export type NaturalSize = { @@ -28,6 +28,7 @@ export type VideoProps = { // Source stuff source?: PlaybackSource; // { uri: 'http://foo/bar.mp4' }, Asset, or require('./foo/bar.mp4') posterSource?: { uri: string } | number; // { uri: 'http://foo/bar.mp4' } or require('./foo/bar.mp4') + posterStyle?: StyleProp; // Callbacks onPlaybackStatusUpdate?: (status: PlaybackStatus) => void;