1 | import * as React from 'react';
|
2 | import { ImageProps, View } from 'react-native';
|
3 |
|
4 | import {
|
5 | AVPlaybackNativeSource,
|
6 | AVPlaybackSource,
|
7 | AVPlaybackStatus,
|
8 | AVPlaybackStatusToSet,
|
9 | } from './AV';
|
10 |
|
11 | export type VideoNaturalSize = {
|
12 | width: number;
|
13 | height: number;
|
14 | orientation: 'portrait' | 'landscape';
|
15 | };
|
16 |
|
17 | export enum ResizeMode {
|
18 | CONTAIN = 'contain',
|
19 | COVER = 'cover',
|
20 | STRETCH = 'stretch',
|
21 | }
|
22 |
|
23 | export type VideoReadyForDisplayEvent = {
|
24 | naturalSize: VideoNaturalSize;
|
25 | status: AVPlaybackStatus;
|
26 | };
|
27 |
|
28 | export type VideoFullscreenUpdateEvent = {
|
29 | fullscreenUpdate: 0 | 1 | 2 | 3;
|
30 | status: AVPlaybackStatus;
|
31 | };
|
32 |
|
33 | export type VideoProps = {
|
34 |
|
35 | source?: AVPlaybackSource;
|
36 | posterSource?: ImageProps['source'];
|
37 | posterStyle?: ImageProps['style'];
|
38 |
|
39 |
|
40 | onPlaybackStatusUpdate?: (status: AVPlaybackStatus) => void;
|
41 | onLoadStart?: () => void;
|
42 | onLoad?: (status: AVPlaybackStatus) => void;
|
43 | onError?: (error: string) => void;
|
44 | onReadyForDisplay?: (event: VideoReadyForDisplayEvent) => void;
|
45 | onFullscreenUpdate?: (event: VideoFullscreenUpdateEvent) => void;
|
46 | onIOSFullscreenUpdate?: (event: VideoFullscreenUpdateEvent) => void;
|
47 |
|
48 |
|
49 | useNativeControls?: boolean;
|
50 |
|
51 |
|
52 | resizeMode?: ResizeMode | 'stretch' | 'cover' | 'contain';
|
53 | usePoster?: boolean;
|
54 |
|
55 |
|
56 | status?: AVPlaybackStatusToSet;
|
57 | progressUpdateIntervalMillis?: number;
|
58 | positionMillis?: number;
|
59 | shouldPlay?: boolean;
|
60 | rate?: number;
|
61 | shouldCorrectPitch?: boolean;
|
62 | volume?: number;
|
63 | isMuted?: boolean;
|
64 | isLooping?: boolean;
|
65 |
|
66 |
|
67 | scaleX?: number;
|
68 | scaleY?: number;
|
69 | translateX?: number;
|
70 | translateY?: number;
|
71 | rotation?: number;
|
72 | } & React.ComponentProps<typeof View>;
|
73 |
|
74 | export type VideoNativeProps = {
|
75 | source?: AVPlaybackNativeSource | null;
|
76 | resizeMode?: unknown;
|
77 | status?: AVPlaybackStatusToSet;
|
78 | onLoadStart?: () => void;
|
79 | onLoad?: (event: { nativeEvent: AVPlaybackStatus }) => void;
|
80 | onError?: (event: { nativeEvent: { error: string } }) => void;
|
81 | onStatusUpdate?: (event: { nativeEvent: AVPlaybackStatus }) => void;
|
82 | onReadyForDisplay?: (event: { nativeEvent: VideoReadyForDisplayEvent }) => void;
|
83 | onFullscreenUpdate?: (event: { nativeEvent: VideoFullscreenUpdateEvent }) => void;
|
84 | useNativeControls?: boolean;
|
85 | } & React.ComponentProps<typeof View>;
|
86 |
|
87 | export type VideoState = {
|
88 | showPoster: boolean;
|
89 | };
|
90 | export type ExponentVideoComponent = React.ComponentClass<VideoNativeProps>;
|