fix: update types (#3288)
This commit is contained in:
parent
7fd7b3ff32
commit
5c3baca1d8
@ -59,6 +59,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
fullscreen,
|
||||
drm,
|
||||
textTracks,
|
||||
selectedVideoTrack,
|
||||
selectedAudioTrack,
|
||||
selectedTextTrack,
|
||||
onLoadStart,
|
||||
@ -153,8 +154,9 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
if (!drm) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
drmType: drm.type,
|
||||
type: drm.type,
|
||||
licenseServer: drm.licenseServer,
|
||||
headers: drm.headers,
|
||||
contentId: drm.contentId,
|
||||
@ -168,14 +170,9 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
if (!selectedTextTrack) {
|
||||
return;
|
||||
}
|
||||
if (typeof selectedTextTrack?.value === 'number') {
|
||||
return {
|
||||
selectedTextType: selectedTextTrack?.type,
|
||||
index: selectedTextTrack?.value,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
selectedTextType: selectedTextTrack?.type,
|
||||
type: selectedTextTrack?.type,
|
||||
value: selectedTextTrack?.value,
|
||||
};
|
||||
}, [selectedTextTrack]);
|
||||
@ -184,18 +181,24 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
if (!selectedAudioTrack) {
|
||||
return;
|
||||
}
|
||||
if (typeof selectedAudioTrack?.value === 'number') {
|
||||
return {
|
||||
selectedAudioType: selectedAudioTrack?.type,
|
||||
index: selectedAudioTrack?.value,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
selectedAudioType: selectedAudioTrack?.type,
|
||||
type: selectedAudioTrack?.type,
|
||||
value: selectedAudioTrack?.value,
|
||||
};
|
||||
}, [selectedAudioTrack]);
|
||||
|
||||
const _selectedVideoTrack = useMemo(() => {
|
||||
if (!selectedVideoTrack) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
type: selectedVideoTrack?.type,
|
||||
value: selectedVideoTrack?.value,
|
||||
};
|
||||
}, [selectedVideoTrack]);
|
||||
|
||||
const seek = useCallback(async (time: number, tolerance?: number) => {
|
||||
if (isNaN(time)) {
|
||||
throw new Error('Specified time is not a number');
|
||||
@ -470,6 +473,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
textTracks={textTracks}
|
||||
selectedTextTrack={_selectedTextTrack}
|
||||
selectedAudioTrack={_selectedAudioTrack}
|
||||
selectedVideoTrack={_selectedVideoTrack}
|
||||
onGetLicense={onGetLicense}
|
||||
onVideoLoad={onVideoLoad}
|
||||
onVideoLoadStart={onVideoLoadStart}
|
||||
|
@ -53,7 +53,7 @@ type DebugConfig = Readonly<{
|
||||
}>;
|
||||
|
||||
type Drm = Readonly<{
|
||||
drmType?: DrmType;
|
||||
type?: DrmType;
|
||||
licenseServer?: string;
|
||||
headers?: Headers;
|
||||
contentId?: string; // ios
|
||||
@ -74,17 +74,15 @@ type TextTracks = ReadonlyArray<
|
||||
type TextTrackType = 'system' | 'disabled' | 'title' | 'language' | 'index';
|
||||
|
||||
type SelectedTextTrack = Readonly<{
|
||||
selectedTextType: TextTrackType;
|
||||
value?: string;
|
||||
index?: number;
|
||||
type: TextTrackType;
|
||||
value?: string | number;
|
||||
}>;
|
||||
|
||||
type AudioTrackType = 'system' | 'disabled' | 'title' | 'language' | 'index';
|
||||
|
||||
type SelectedAudioTrack = Readonly<{
|
||||
selectedAudioType: AudioTrackType;
|
||||
value?: string;
|
||||
index?: number;
|
||||
type: AudioTrackType;
|
||||
value?: string | number;
|
||||
}>;
|
||||
|
||||
export type Seek = Readonly<{
|
||||
@ -146,7 +144,6 @@ export type OnBandwidthUpdateData = Readonly<{
|
||||
export type OnSeekData = Readonly<{
|
||||
currentTime: number;
|
||||
seekTime: number;
|
||||
finished: boolean;
|
||||
}>;
|
||||
|
||||
export type OnPlaybackStateChangedData = Readonly<{
|
||||
|
Loading…
Reference in New Issue
Block a user