diff --git a/examples/basic/src/VideoPlayer.tsx b/examples/basic/src/VideoPlayer.tsx index e719279d..98e1e17f 100644 --- a/examples/basic/src/VideoPlayer.tsx +++ b/examples/basic/src/VideoPlayer.tsx @@ -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} /> ); diff --git a/src/specs/VideoNativeComponent.ts b/src/specs/VideoNativeComponent.ts index 11752957..8f8d09a1 100644 --- a/src/specs/VideoNativeComponent.ts +++ b/src/specs/VideoNativeComponent.ts @@ -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; // all + onPlaybackRateChange?: DirectEventHandler; // all onVolumeChange?: DirectEventHandler; // android, ios onVideoExternalPlaybackChange?: DirectEventHandler; onGetLicense?: DirectEventHandler; diff --git a/src/types/events.ts b/src/types/events.ts index 4f9e9238..c97cd086 100644 --- a/src/types/events.ts +++ b/src/types/events.ts @@ -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