fix(ts): onPlaybackRateChangeData was not correctly typed (#3651)

This commit is contained in:
Olivier Bouillet 2024-04-04 14:45:39 +02:00 committed by GitHub
parent 10b100de44
commit 2a858df8bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 4 deletions

View File

@ -36,6 +36,8 @@ import Video, {
OnTextTrackDataChangedData,
TextTrackType,
ISO639_1,
OnPlaybackStateChangedData,
OnPlaybackRateChangeData,
} from 'react-native-video';
import ToggleControl from './ToggleControl';
import MultiValueControl, {
@ -335,6 +337,14 @@ class VideoPlayer extends Component {
this.channelUp();
};
onPlaybackRateChange = (data: OnPlaybackRateChangeData) => {
console.log('onPlaybackRateChange', data);
}
onPlaybackStateChanged = (data: OnPlaybackStateChangedData) => {
console.log('onPlaybackStateChanged', data);
}
toggleFullscreen() {
this.setState({fullscreen: !this.state.fullscreen});
}
@ -805,6 +815,8 @@ class VideoPlayer extends Component {
selectedAudioTrack={this.state.selectedAudioTrack}
playInBackground={false}
preventsDisplaySleepDuringVideoPlayback={true}
onPlaybackRateChange={this.onPlaybackRateChange}
onPlaybackStateChanged={this.onPlaybackStateChanged}
/>
</TouchableOpacity>
);

View File

@ -218,7 +218,7 @@ export type OnVideoTracksData = Readonly<{
}[];
}>;
export type OnPlaybackData = Readonly<{
export type OnPlaybackRateChangeData = Readonly<{
playbackRate: Float;
}>;
@ -328,7 +328,7 @@ export interface VideoNativeProps extends ViewProps {
onVideoFullscreenPlayerWillDismiss?: DirectEventHandler<{}>; // ios, android
onVideoFullscreenPlayerDidDismiss?: DirectEventHandler<{}>; // ios, android
onReadyForDisplay?: DirectEventHandler<{}>;
onPlaybackRateChange?: DirectEventHandler<OnPlaybackData>; // all
onPlaybackRateChange?: DirectEventHandler<OnPlaybackRateChangeData>; // all
onVolumeChange?: DirectEventHandler<OnVolumeChangeData>; // android, ios
onVideoExternalPlaybackChange?: DirectEventHandler<OnExternalPlaybackChangeData>;
onGetLicense?: DirectEventHandler<OnGetLicenseData>;

View File

@ -7,7 +7,7 @@ import type {
OnExternalPlaybackChangeData,
OnLoadStartData,
OnPictureInPictureStatusChangedData,
OnPlaybackData,
OnPlaybackRateChangeData,
OnPlaybackStateChangedData,
OnProgressData,
OnSeekData,
@ -239,7 +239,7 @@ export interface ReactVideoEvents {
onPictureInPictureStatusChanged?: (
e: OnPictureInPictureStatusChangedData,
) => void; //iOS
onPlaybackRateChange?: (e: OnPlaybackData) => void; //All
onPlaybackRateChange?: (e: OnPlaybackRateChangeData) => void; //All
onVolumeChange?: (e: OnVolumeChangeData) => void; //Android, iOS
onProgress?: (e: OnProgressData) => void; //All
onReadyForDisplay?: () => void; //Android, iOS