fix: fix codegen types (#3636)
* fix: remove string unions from component spec * fix linter issue * fix codegen type * update podspec
This commit is contained in:
parent
d3cc0d0c5a
commit
9b66e7fdce
@ -2,6 +2,8 @@ require "json"
|
|||||||
|
|
||||||
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
||||||
|
|
||||||
|
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = 'react-native-video'
|
s.name = 'react-native-video'
|
||||||
s.version = package['version']
|
s.version = package['version']
|
||||||
@ -38,10 +40,29 @@ Pod::Spec.new do |s|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
s.dependency "React-Core"
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
||||||
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
||||||
|
if respond_to?(:install_modules_dependencies, true)
|
||||||
|
install_modules_dependencies(s)
|
||||||
|
else
|
||||||
|
s.dependency "React-Core"
|
||||||
|
|
||||||
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
||||||
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
||||||
|
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
||||||
|
s.pod_target_xcconfig = {
|
||||||
|
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
||||||
|
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
||||||
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
||||||
|
}
|
||||||
|
s.dependency "React-RCTFabric"
|
||||||
|
s.dependency "React-Codegen"
|
||||||
|
s.dependency "RCT-Folly"
|
||||||
|
s.dependency "RCTRequired"
|
||||||
|
s.dependency "RCTTypeSafety"
|
||||||
|
s.dependency "ReactCommon/turbomodule/core"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
s.default_subspec = "Video"
|
s.default_subspec = "Video"
|
||||||
s.static_framework = true
|
|
||||||
s.xcconfig = {
|
|
||||||
'OTHER_LDFLAGS': '-ObjC',
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,16 @@ import React, {
|
|||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
type ComponentRef,
|
type ComponentRef,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import {View, StyleSheet, Image, Platform} from 'react-native';
|
import {
|
||||||
|
View,
|
||||||
|
StyleSheet,
|
||||||
|
Image,
|
||||||
|
Platform,
|
||||||
|
type StyleProp,
|
||||||
|
type ImageStyle,
|
||||||
|
type NativeSyntheticEvent,
|
||||||
|
} from 'react-native';
|
||||||
|
|
||||||
import NativeVideoComponent, {
|
import NativeVideoComponent, {
|
||||||
type OnAudioFocusChangedData,
|
type OnAudioFocusChangedData,
|
||||||
type OnAudioTracksData,
|
type OnAudioTracksData,
|
||||||
@ -15,15 +24,12 @@ import NativeVideoComponent, {
|
|||||||
type OnBufferData,
|
type OnBufferData,
|
||||||
type OnExternalPlaybackChangeData,
|
type OnExternalPlaybackChangeData,
|
||||||
type OnGetLicenseData,
|
type OnGetLicenseData,
|
||||||
type OnLoadData,
|
|
||||||
type OnLoadStartData,
|
type OnLoadStartData,
|
||||||
type OnPictureInPictureStatusChangedData,
|
type OnPictureInPictureStatusChangedData,
|
||||||
type OnPlaybackStateChangedData,
|
type OnPlaybackStateChangedData,
|
||||||
type OnProgressData,
|
type OnProgressData,
|
||||||
type OnReceiveAdEventData,
|
|
||||||
type OnSeekData,
|
type OnSeekData,
|
||||||
type OnTextTrackDataChangedData,
|
type OnTextTrackDataChangedData,
|
||||||
type OnTextTracksData,
|
|
||||||
type OnTimedMetadataData,
|
type OnTimedMetadataData,
|
||||||
type OnVideoAspectRatioData,
|
type OnVideoAspectRatioData,
|
||||||
type OnVideoErrorData,
|
type OnVideoErrorData,
|
||||||
@ -31,15 +37,18 @@ import NativeVideoComponent, {
|
|||||||
type VideoComponentType,
|
type VideoComponentType,
|
||||||
type VideoSrc,
|
type VideoSrc,
|
||||||
} from './specs/VideoNativeComponent';
|
} from './specs/VideoNativeComponent';
|
||||||
|
|
||||||
import type {StyleProp, ImageStyle, NativeSyntheticEvent} from 'react-native';
|
|
||||||
import {
|
import {
|
||||||
generateHeaderForNative,
|
generateHeaderForNative,
|
||||||
getReactTag,
|
getReactTag,
|
||||||
resolveAssetSourceForVideo,
|
resolveAssetSourceForVideo,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import {VideoManager} from './specs/VideoNativeComponent';
|
import {VideoManager} from './specs/VideoNativeComponent';
|
||||||
import type {ReactVideoProps} from './types/video';
|
import type {
|
||||||
|
OnLoadData,
|
||||||
|
OnTextTracksData,
|
||||||
|
OnReceiveAdEventData,
|
||||||
|
ReactVideoProps,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
export type VideoSaveData = {
|
export type VideoSaveData = {
|
||||||
uri: string;
|
uri: string;
|
||||||
@ -524,7 +533,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
|||||||
selectedAudioTrack={_selectedAudioTrack}
|
selectedAudioTrack={_selectedAudioTrack}
|
||||||
selectedVideoTrack={_selectedVideoTrack}
|
selectedVideoTrack={_selectedVideoTrack}
|
||||||
onGetLicense={useExternalGetLicense ? onGetLicense : undefined}
|
onGetLicense={useExternalGetLicense ? onGetLicense : undefined}
|
||||||
onVideoLoad={onVideoLoad}
|
onVideoLoad={onVideoLoad as (e: NativeSyntheticEvent<object>) => void}
|
||||||
onVideoLoadStart={onVideoLoadStart}
|
onVideoLoadStart={onVideoLoadStart}
|
||||||
onVideoError={onVideoError}
|
onVideoError={onVideoError}
|
||||||
onVideoProgress={onVideoProgress}
|
onVideoProgress={onVideoProgress}
|
||||||
@ -554,7 +563,9 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
|||||||
onRestoreUserInterfaceForPictureInPictureStop
|
onRestoreUserInterfaceForPictureInPictureStop
|
||||||
}
|
}
|
||||||
onVideoAspectRatio={_onVideoAspectRatio}
|
onVideoAspectRatio={_onVideoAspectRatio}
|
||||||
onReceiveAdEvent={_onReceiveAdEvent}
|
onReceiveAdEvent={
|
||||||
|
_onReceiveAdEvent as (e: NativeSyntheticEvent<object>) => void
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
{showPoster ? (
|
{showPoster ? (
|
||||||
<Image style={posterStyle} source={{uri: poster}} />
|
<Image style={posterStyle} source={{uri: poster}} />
|
||||||
|
@ -38,10 +38,7 @@ export type VideoSrc = Readonly<{
|
|||||||
customImageUri?: string;
|
customImageUri?: string;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
type DRMType = WithDefault<
|
type DRMType = WithDefault<string, 'widevine'>;
|
||||||
'widevine' | 'playready' | 'clearkey' | 'fairplay',
|
|
||||||
'widevine'
|
|
||||||
>;
|
|
||||||
|
|
||||||
type DebugConfig = Readonly<{
|
type DebugConfig = Readonly<{
|
||||||
enable?: boolean;
|
enable?: boolean;
|
||||||
@ -67,15 +64,9 @@ type TextTracks = ReadonlyArray<
|
|||||||
}>
|
}>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
type SelectedTextTrackType = WithDefault<
|
type SelectedTextTrackType = WithDefault<string, 'system'>;
|
||||||
'system' | 'disabled' | 'title' | 'language' | 'index',
|
|
||||||
'system'
|
|
||||||
>;
|
|
||||||
|
|
||||||
type SelectedAudioTrackType = WithDefault<
|
type SelectedAudioTrackType = WithDefault<string, 'system'>;
|
||||||
'system' | 'disabled' | 'title' | 'language' | 'index',
|
|
||||||
'system'
|
|
||||||
>;
|
|
||||||
|
|
||||||
type SelectedTextTrack = Readonly<{
|
type SelectedTextTrack = Readonly<{
|
||||||
type?: SelectedTextTrackType;
|
type?: SelectedTextTrackType;
|
||||||
@ -87,10 +78,7 @@ type SelectedAudioTrack = Readonly<{
|
|||||||
value?: string;
|
value?: string;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
type SelectedVideoTrackType = WithDefault<
|
type SelectedVideoTrackType = WithDefault<string, 'auto'>;
|
||||||
'auto' | 'disabled' | 'resolution' | 'index',
|
|
||||||
'auto'
|
|
||||||
>;
|
|
||||||
|
|
||||||
type SelectedVideoTrack = Readonly<{
|
type SelectedVideoTrack = Readonly<{
|
||||||
type?: SelectedVideoTrackType;
|
type?: SelectedVideoTrackType;
|
||||||
@ -122,13 +110,13 @@ type SubtitleStyle = Readonly<{
|
|||||||
opacity?: WithDefault<Float, 1>;
|
opacity?: WithDefault<Float, 1>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type OnLoadData = Readonly<{
|
type OnLoadData = Readonly<{
|
||||||
currentTime: Float;
|
currentTime: Float;
|
||||||
duration: Float;
|
duration: Float;
|
||||||
naturalSize: Readonly<{
|
naturalSize: Readonly<{
|
||||||
width: Float;
|
width: Float;
|
||||||
height: Float;
|
height: Float;
|
||||||
orientation: WithDefault<'landscape' | 'portrait', 'landscape'>;
|
orientation: WithDefault<string, 'landscape'>;
|
||||||
}>;
|
}>;
|
||||||
audioTracks: {
|
audioTracks: {
|
||||||
index: Int32;
|
index: Int32;
|
||||||
@ -145,7 +133,7 @@ export type OnLoadData = Readonly<{
|
|||||||
/**
|
/**
|
||||||
* iOS only supports VTT, Android supports all 3
|
* iOS only supports VTT, Android supports all 3
|
||||||
*/
|
*/
|
||||||
type?: WithDefault<'srt' | 'ttml' | 'vtt', 'srt'>;
|
type?: WithDefault<string, 'srt'>;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
@ -203,7 +191,7 @@ export type OnAudioTracksData = Readonly<{
|
|||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type OnTextTracksData = Readonly<{
|
type OnTextTracksData = Readonly<{
|
||||||
textTracks: {
|
textTracks: {
|
||||||
index: Int32;
|
index: Int32;
|
||||||
title?: string;
|
title?: string;
|
||||||
@ -211,7 +199,7 @@ export type OnTextTracksData = Readonly<{
|
|||||||
/**
|
/**
|
||||||
* iOS only supports VTT, Android supports all 3
|
* iOS only supports VTT, Android supports all 3
|
||||||
*/
|
*/
|
||||||
type?: WithDefault<'srt' | 'ttml' | 'vtt', 'srt'>;
|
type?: WithDefault<string, 'srt'>;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
}[];
|
}[];
|
||||||
}>;
|
}>;
|
||||||
@ -254,162 +242,9 @@ export type OnPictureInPictureStatusChangedData = Readonly<{
|
|||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type OnReceiveAdEventData = Readonly<{
|
type OnReceiveAdEventData = Readonly<{
|
||||||
data?: {};
|
data?: {};
|
||||||
event: WithDefault<
|
event: WithDefault<string, 'AD_BREAK_ENDED'>;
|
||||||
/**
|
|
||||||
* iOS only: Fired the first time each ad break ends. Applications must reenable seeking when this occurs (only used for dynamic ad insertion).
|
|
||||||
*/ | 'AD_BREAK_ENDED'
|
|
||||||
/**
|
|
||||||
* Fires when an ad rule or a VMAP ad break would have played if autoPlayAdBreaks is false.
|
|
||||||
*/
|
|
||||||
| 'AD_BREAK_READY'
|
|
||||||
/**
|
|
||||||
* iOS only: Fired first time each ad break begins playback. If an ad break is watched subsequent times this will not be fired. Applications must disable seeking when this occurs (only used for dynamic ad insertion).
|
|
||||||
*/
|
|
||||||
| 'AD_BREAK_STARTED'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the ad has stalled playback to buffer.
|
|
||||||
*/
|
|
||||||
| 'AD_BUFFERING'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the ad is ready to play without buffering, either at the beginning of the ad or after buffering completes.
|
|
||||||
*/
|
|
||||||
| 'AD_CAN_PLAY'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when an ads list is loaded.
|
|
||||||
*/
|
|
||||||
| 'AD_METADATA'
|
|
||||||
/**
|
|
||||||
* iOS only: Fired every time the stream switches from advertising or slate to content. This will be fired even when an ad is played a second time or when seeking into an ad (only used for dynamic ad insertion).
|
|
||||||
*/
|
|
||||||
| 'AD_PERIOD_ENDED'
|
|
||||||
/**
|
|
||||||
* iOS only: Fired every time the stream switches from content to advertising or slate. This will be fired even when an ad is played a second time or when seeking into an ad (only used for dynamic ad insertion).
|
|
||||||
*/
|
|
||||||
| 'AD_PERIOD_STARTED'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the ad's current time value changes. The event `data` will be populated with an AdProgressData object.
|
|
||||||
*/
|
|
||||||
| 'AD_PROGRESS'
|
|
||||||
/**
|
|
||||||
* Fires when the ads manager is done playing all the valid ads in the ads response, or when the response doesn't return any valid ads.
|
|
||||||
*/
|
|
||||||
| 'ALL_ADS_COMPLETED'
|
|
||||||
/**
|
|
||||||
* Fires when the ad is clicked.
|
|
||||||
*/
|
|
||||||
| 'CLICK'
|
|
||||||
/**
|
|
||||||
* Fires when the ad completes playing.
|
|
||||||
*/
|
|
||||||
| 'COMPLETED'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when content should be paused. This usually happens right before an ad is about to cover the content.
|
|
||||||
*/
|
|
||||||
| 'CONTENT_PAUSE_REQUESTED'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when content should be resumed. This usually happens when an ad finishes or collapses.
|
|
||||||
*/
|
|
||||||
| 'CONTENT_RESUME_REQUESTED'
|
|
||||||
/**
|
|
||||||
* iOS only: Cuepoints changed for VOD stream (only used for dynamic ad insertion).
|
|
||||||
*/
|
|
||||||
| 'CUEPOINTS_CHANGED'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the ad's duration changes.
|
|
||||||
*/
|
|
||||||
| 'DURATION_CHANGE'
|
|
||||||
/**
|
|
||||||
* Fires when an error is encountered and the ad can't be played.
|
|
||||||
*/
|
|
||||||
| 'ERROR'
|
|
||||||
/**
|
|
||||||
* Fires when the ad playhead crosses first quartile.
|
|
||||||
*/
|
|
||||||
| 'FIRST_QUARTILE'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the impression URL has been pinged.
|
|
||||||
*/
|
|
||||||
| 'IMPRESSION'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when an ad triggers the interaction callback. Ad interactions contain an interaction ID string in the ad data.
|
|
||||||
*/
|
|
||||||
| 'INTERACTION'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the displayed ad changes from linear to nonlinear, or the reverse.
|
|
||||||
*/
|
|
||||||
| 'LINEAR_CHANGED'
|
|
||||||
/**
|
|
||||||
* Fires when ad data is available.
|
|
||||||
*/
|
|
||||||
| 'LOADED'
|
|
||||||
/**
|
|
||||||
* Fires when a non-fatal error is encountered. The user need not take any action since the SDK will continue with the same or next ad playback depending on the error situation.
|
|
||||||
*/
|
|
||||||
| 'LOG'
|
|
||||||
/**
|
|
||||||
* Fires when the ad playhead crosses midpoint.
|
|
||||||
*/
|
|
||||||
| 'MIDPOINT'
|
|
||||||
/**
|
|
||||||
* Fires when the ad is paused.
|
|
||||||
*/
|
|
||||||
| 'PAUSED'
|
|
||||||
/**
|
|
||||||
* Fires when the ad is resumed.
|
|
||||||
*/
|
|
||||||
| 'RESUMED'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the displayed ads skippable state is changed.
|
|
||||||
*/
|
|
||||||
| 'SKIPPABLE_STATE_CHANGED'
|
|
||||||
/**
|
|
||||||
* Fires when the ad is skipped by the user.
|
|
||||||
*/
|
|
||||||
| 'SKIPPED'
|
|
||||||
/**
|
|
||||||
* Fires when the ad starts playing.
|
|
||||||
*/
|
|
||||||
| 'STARTED'
|
|
||||||
/**
|
|
||||||
* iOS only: Stream request has loaded (only used for dynamic ad insertion).
|
|
||||||
*/
|
|
||||||
| 'STREAM_LOADED'
|
|
||||||
/**
|
|
||||||
* iOS only: Fires when the ad is tapped.
|
|
||||||
*/
|
|
||||||
| 'TAPPED'
|
|
||||||
/**
|
|
||||||
* Fires when the ad playhead crosses third quartile.
|
|
||||||
*/
|
|
||||||
| 'THIRD_QUARTILE'
|
|
||||||
/**
|
|
||||||
* iOS only: An unknown event has fired
|
|
||||||
*/
|
|
||||||
| 'UNKNOWN'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the ad is closed by the user.
|
|
||||||
*/
|
|
||||||
| 'USER_CLOSE'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the non-clickthrough portion of a video ad is clicked.
|
|
||||||
*/
|
|
||||||
| 'VIDEO_CLICKED'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when a user clicks a video icon.
|
|
||||||
*/
|
|
||||||
| 'VIDEO_ICON_CLICKED'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the ad volume has changed.
|
|
||||||
*/
|
|
||||||
| 'VOLUME_CHANGED'
|
|
||||||
/**
|
|
||||||
* Android only: Fires when the ad volume has been muted.
|
|
||||||
*/
|
|
||||||
| 'VOLUME_MUTED',
|
|
||||||
'AD_BREAK_ENDED'
|
|
||||||
>;
|
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type OnVideoErrorData = Readonly<{
|
export type OnVideoErrorData = Readonly<{
|
||||||
@ -438,7 +273,7 @@ export interface VideoNativeProps extends ViewProps {
|
|||||||
adTagUrl?: string;
|
adTagUrl?: string;
|
||||||
allowsExternalPlayback?: boolean; // ios, true
|
allowsExternalPlayback?: boolean; // ios, true
|
||||||
maxBitRate?: Float;
|
maxBitRate?: Float;
|
||||||
resizeMode?: WithDefault<'none' | 'contain' | 'cover' | 'stretch', 'none'>;
|
resizeMode?: WithDefault<string, 'none'>;
|
||||||
repeat?: boolean;
|
repeat?: boolean;
|
||||||
automaticallyWaitsToMinimizeStalling?: boolean;
|
automaticallyWaitsToMinimizeStalling?: boolean;
|
||||||
textTracks?: TextTracks;
|
textTracks?: TextTracks;
|
||||||
@ -448,25 +283,7 @@ export interface VideoNativeProps extends ViewProps {
|
|||||||
paused?: boolean;
|
paused?: boolean;
|
||||||
muted?: boolean;
|
muted?: boolean;
|
||||||
controls?: boolean;
|
controls?: boolean;
|
||||||
filter?: WithDefault<
|
filter?: WithDefault<string, ''>;
|
||||||
| ''
|
|
||||||
| 'CIColorInvert'
|
|
||||||
| 'CIColorMonochrome'
|
|
||||||
| 'CIColorPosterize'
|
|
||||||
| 'CIFalseColor'
|
|
||||||
| 'CIMaximumComponent'
|
|
||||||
| 'CIMinimumComponent'
|
|
||||||
| 'CIPhotoEffectChrome'
|
|
||||||
| 'CIPhotoEffectFade'
|
|
||||||
| 'CIPhotoEffectInstant'
|
|
||||||
| 'CIPhotoEffectMono'
|
|
||||||
| 'CIPhotoEffectNoir'
|
|
||||||
| 'CIPhotoEffectProcess'
|
|
||||||
| 'CIPhotoEffectTonal'
|
|
||||||
| 'CIPhotoEffectTransfer'
|
|
||||||
| 'CISepiaTone',
|
|
||||||
''
|
|
||||||
>;
|
|
||||||
filterEnabled?: boolean;
|
filterEnabled?: boolean;
|
||||||
volume?: Float; // default 1.0
|
volume?: Float; // default 1.0
|
||||||
playInBackground?: boolean;
|
playInBackground?: boolean;
|
||||||
@ -474,12 +291,12 @@ export interface VideoNativeProps extends ViewProps {
|
|||||||
preferredForwardBufferDuration?: Float; //ios, 0
|
preferredForwardBufferDuration?: Float; //ios, 0
|
||||||
playWhenInactive?: boolean; // ios, false
|
playWhenInactive?: boolean; // ios, false
|
||||||
pictureInPicture?: boolean; // ios, false
|
pictureInPicture?: boolean; // ios, false
|
||||||
ignoreSilentSwitch?: WithDefault<'inherit' | 'ignore' | 'obey', 'inherit'>; // ios, 'inherit'
|
ignoreSilentSwitch?: WithDefault<string, 'inherit'>; // ios, 'inherit'
|
||||||
mixWithOthers?: WithDefault<'inherit' | 'mix' | 'duck', 'inherit'>; // ios, 'inherit'
|
mixWithOthers?: WithDefault<string, 'inherit'>; // ios, 'inherit'
|
||||||
rate?: Float;
|
rate?: Float;
|
||||||
fullscreen?: boolean; // ios, false
|
fullscreen?: boolean; // ios, false
|
||||||
fullscreenAutorotate?: boolean;
|
fullscreenAutorotate?: boolean;
|
||||||
fullscreenOrientation?: WithDefault<'all' | 'landscape' | 'portrait', 'all'>;
|
fullscreenOrientation?: WithDefault<string, 'all'>;
|
||||||
progressUpdateInterval?: Float;
|
progressUpdateInterval?: Float;
|
||||||
restoreUserInterfaceForPIPStopCompletionHandler?: boolean;
|
restoreUserInterfaceForPIPStopCompletionHandler?: boolean;
|
||||||
localSourceEncryptionKeyScheme?: string;
|
localSourceEncryptionKeyScheme?: string;
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
|
import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
|
||||||
import type {
|
import type {
|
||||||
OnAudioFocusChangedData,
|
OnAudioFocusChangedData,
|
||||||
OnAudioTracksData,
|
OnAudioTracksData,
|
||||||
OnBandwidthUpdateData,
|
OnBandwidthUpdateData,
|
||||||
OnBufferData,
|
OnBufferData,
|
||||||
OnExternalPlaybackChangeData,
|
OnExternalPlaybackChangeData,
|
||||||
OnLoadData,
|
|
||||||
OnLoadStartData,
|
OnLoadStartData,
|
||||||
OnPictureInPictureStatusChangedData,
|
OnPictureInPictureStatusChangedData,
|
||||||
OnPlaybackData,
|
OnPlaybackData,
|
||||||
OnPlaybackStateChangedData,
|
OnPlaybackStateChangedData,
|
||||||
OnProgressData,
|
OnProgressData,
|
||||||
OnReceiveAdEventData,
|
|
||||||
OnSeekData,
|
OnSeekData,
|
||||||
OnTextTrackDataChangedData,
|
OnTextTrackDataChangedData,
|
||||||
OnTextTracksData,
|
|
||||||
OnTimedMetadataData,
|
OnTimedMetadataData,
|
||||||
OnVideoAspectRatioData,
|
OnVideoAspectRatioData,
|
||||||
OnVideoErrorData,
|
OnVideoErrorData,
|
||||||
@ -24,6 +22,205 @@ import type {
|
|||||||
export type AudioTrack = OnAudioTracksData['audioTracks'][number];
|
export type AudioTrack = OnAudioTracksData['audioTracks'][number];
|
||||||
export type TextTrack = OnTextTracksData['textTracks'][number];
|
export type TextTrack = OnTextTracksData['textTracks'][number];
|
||||||
|
|
||||||
|
export type OnLoadData = Readonly<{
|
||||||
|
currentTime: number;
|
||||||
|
duration: number;
|
||||||
|
naturalSize: Readonly<{
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
orientation: WithDefault<'landscape' | 'portrait', 'landscape'>;
|
||||||
|
}>;
|
||||||
|
audioTracks: {
|
||||||
|
index: number;
|
||||||
|
title?: string;
|
||||||
|
language?: string;
|
||||||
|
bitrate?: number;
|
||||||
|
type?: string;
|
||||||
|
selected?: boolean;
|
||||||
|
}[];
|
||||||
|
textTracks: {
|
||||||
|
index: number;
|
||||||
|
title?: string;
|
||||||
|
language?: string;
|
||||||
|
/**
|
||||||
|
* iOS only supports VTT, Android supports all 3
|
||||||
|
*/
|
||||||
|
type?: WithDefault<'srt' | 'ttml' | 'vtt', 'srt'>;
|
||||||
|
selected?: boolean;
|
||||||
|
}[];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
export type OnTextTracksData = Readonly<{
|
||||||
|
textTracks: {
|
||||||
|
index: number;
|
||||||
|
title?: string;
|
||||||
|
language?: string;
|
||||||
|
/**
|
||||||
|
* iOS only supports VTT, Android supports all 3
|
||||||
|
*/
|
||||||
|
type?: WithDefault<string, 'srt'>;
|
||||||
|
selected?: boolean;
|
||||||
|
}[];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
export type OnReceiveAdEventData = Readonly<{
|
||||||
|
data?: object;
|
||||||
|
event: WithDefault<
|
||||||
|
/**
|
||||||
|
* iOS only: Fired the first time each ad break ends. Applications must reenable seeking when this occurs (only used for dynamic ad insertion).
|
||||||
|
*/ | 'AD_BREAK_ENDED'
|
||||||
|
/**
|
||||||
|
* Fires when an ad rule or a VMAP ad break would have played if autoPlayAdBreaks is false.
|
||||||
|
*/
|
||||||
|
| 'AD_BREAK_READY'
|
||||||
|
/**
|
||||||
|
* iOS only: Fired first time each ad break begins playback. If an ad break is watched subsequent times this will not be fired. Applications must disable seeking when this occurs (only used for dynamic ad insertion).
|
||||||
|
*/
|
||||||
|
| 'AD_BREAK_STARTED'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the ad has stalled playback to buffer.
|
||||||
|
*/
|
||||||
|
| 'AD_BUFFERING'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the ad is ready to play without buffering, either at the beginning of the ad or after buffering completes.
|
||||||
|
*/
|
||||||
|
| 'AD_CAN_PLAY'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when an ads list is loaded.
|
||||||
|
*/
|
||||||
|
| 'AD_METADATA'
|
||||||
|
/**
|
||||||
|
* iOS only: Fired every time the stream switches from advertising or slate to content. This will be fired even when an ad is played a second time or when seeking into an ad (only used for dynamic ad insertion).
|
||||||
|
*/
|
||||||
|
| 'AD_PERIOD_ENDED'
|
||||||
|
/**
|
||||||
|
* iOS only: Fired every time the stream switches from content to advertising or slate. This will be fired even when an ad is played a second time or when seeking into an ad (only used for dynamic ad insertion).
|
||||||
|
*/
|
||||||
|
| 'AD_PERIOD_STARTED'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the ad's current time value changes. The event `data` will be populated with an AdProgressData object.
|
||||||
|
*/
|
||||||
|
| 'AD_PROGRESS'
|
||||||
|
/**
|
||||||
|
* Fires when the ads manager is done playing all the valid ads in the ads response, or when the response doesn't return any valid ads.
|
||||||
|
*/
|
||||||
|
| 'ALL_ADS_COMPLETED'
|
||||||
|
/**
|
||||||
|
* Fires when the ad is clicked.
|
||||||
|
*/
|
||||||
|
| 'CLICK'
|
||||||
|
/**
|
||||||
|
* Fires when the ad completes playing.
|
||||||
|
*/
|
||||||
|
| 'COMPLETED'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when content should be paused. This usually happens right before an ad is about to cover the content.
|
||||||
|
*/
|
||||||
|
| 'CONTENT_PAUSE_REQUESTED'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when content should be resumed. This usually happens when an ad finishes or collapses.
|
||||||
|
*/
|
||||||
|
| 'CONTENT_RESUME_REQUESTED'
|
||||||
|
/**
|
||||||
|
* iOS only: Cuepoints changed for VOD stream (only used for dynamic ad insertion).
|
||||||
|
*/
|
||||||
|
| 'CUEPOINTS_CHANGED'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the ad's duration changes.
|
||||||
|
*/
|
||||||
|
| 'DURATION_CHANGE'
|
||||||
|
/**
|
||||||
|
* Fires when an error is encountered and the ad can't be played.
|
||||||
|
*/
|
||||||
|
| 'ERROR'
|
||||||
|
/**
|
||||||
|
* Fires when the ad playhead crosses first quartile.
|
||||||
|
*/
|
||||||
|
| 'FIRST_QUARTILE'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the impression URL has been pinged.
|
||||||
|
*/
|
||||||
|
| 'IMPRESSION'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when an ad triggers the interaction callback. Ad interactions contain an interaction ID string in the ad data.
|
||||||
|
*/
|
||||||
|
| 'INTERACTION'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the displayed ad changes from linear to nonlinear, or the reverse.
|
||||||
|
*/
|
||||||
|
| 'LINEAR_CHANGED'
|
||||||
|
/**
|
||||||
|
* Fires when ad data is available.
|
||||||
|
*/
|
||||||
|
| 'LOADED'
|
||||||
|
/**
|
||||||
|
* Fires when a non-fatal error is encountered. The user need not take any action since the SDK will continue with the same or next ad playback depending on the error situation.
|
||||||
|
*/
|
||||||
|
| 'LOG'
|
||||||
|
/**
|
||||||
|
* Fires when the ad playhead crosses midpoint.
|
||||||
|
*/
|
||||||
|
| 'MIDPOINT'
|
||||||
|
/**
|
||||||
|
* Fires when the ad is paused.
|
||||||
|
*/
|
||||||
|
| 'PAUSED'
|
||||||
|
/**
|
||||||
|
* Fires when the ad is resumed.
|
||||||
|
*/
|
||||||
|
| 'RESUMED'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the displayed ads skippable state is changed.
|
||||||
|
*/
|
||||||
|
| 'SKIPPABLE_STATE_CHANGED'
|
||||||
|
/**
|
||||||
|
* Fires when the ad is skipped by the user.
|
||||||
|
*/
|
||||||
|
| 'SKIPPED'
|
||||||
|
/**
|
||||||
|
* Fires when the ad starts playing.
|
||||||
|
*/
|
||||||
|
| 'STARTED'
|
||||||
|
/**
|
||||||
|
* iOS only: Stream request has loaded (only used for dynamic ad insertion).
|
||||||
|
*/
|
||||||
|
| 'STREAM_LOADED'
|
||||||
|
/**
|
||||||
|
* iOS only: Fires when the ad is tapped.
|
||||||
|
*/
|
||||||
|
| 'TAPPED'
|
||||||
|
/**
|
||||||
|
* Fires when the ad playhead crosses third quartile.
|
||||||
|
*/
|
||||||
|
| 'THIRD_QUARTILE'
|
||||||
|
/**
|
||||||
|
* iOS only: An unknown event has fired
|
||||||
|
*/
|
||||||
|
| 'UNKNOWN'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the ad is closed by the user.
|
||||||
|
*/
|
||||||
|
| 'USER_CLOSE'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the non-clickthrough portion of a video ad is clicked.
|
||||||
|
*/
|
||||||
|
| 'VIDEO_CLICKED'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when a user clicks a video icon.
|
||||||
|
*/
|
||||||
|
| 'VIDEO_ICON_CLICKED'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the ad volume has changed.
|
||||||
|
*/
|
||||||
|
| 'VOLUME_CHANGED'
|
||||||
|
/**
|
||||||
|
* Android only: Fires when the ad volume has been muted.
|
||||||
|
*/
|
||||||
|
| 'VOLUME_MUTED',
|
||||||
|
'AD_BREAK_ENDED'
|
||||||
|
>;
|
||||||
|
}>;
|
||||||
|
|
||||||
export interface ReactVideoEvents {
|
export interface ReactVideoEvents {
|
||||||
onAudioBecomingNoisy?: () => void; //Android, iOS
|
onAudioBecomingNoisy?: () => void; //Android, iOS
|
||||||
onAudioFocusChanged?: (e: OnAudioFocusChangedData) => void; // Android
|
onAudioFocusChanged?: (e: OnAudioFocusChangedData) => void; // Android
|
||||||
|
Loading…
Reference in New Issue
Block a user