feat: add setVolume function to component's ref (#3794)
* feat: add setVolume function to component's ref * Update methods.mdx
This commit is contained in:
committed by
GitHub
parent
d4c9be2ba0
commit
3cd7ab60b2
@@ -64,6 +64,7 @@ export interface VideoRef {
|
||||
restore: boolean,
|
||||
) => void;
|
||||
save: (options: object) => Promise<VideoSaveData>;
|
||||
setVolume: (volume: number) => void;
|
||||
}
|
||||
|
||||
const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
@@ -289,6 +290,10 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
[setRestoreUserInterfaceForPIPStopCompletionHandler],
|
||||
);
|
||||
|
||||
const setVolume = useCallback((volume: number) => {
|
||||
return VideoManager.setVolume(volume, getReactTag(nativeRef));
|
||||
}, []);
|
||||
|
||||
const onVideoLoadStart = useCallback(
|
||||
(e: NativeSyntheticEvent<OnLoadStartData>) => {
|
||||
hasPoster && setShowPoster(true);
|
||||
@@ -505,6 +510,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
pause,
|
||||
resume,
|
||||
restoreUserInterfaceForPictureInPictureStopCompleted,
|
||||
setVolume,
|
||||
}),
|
||||
[
|
||||
seek,
|
||||
@@ -514,6 +520,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
pause,
|
||||
resume,
|
||||
restoreUserInterfaceForPictureInPictureStopCompleted,
|
||||
setVolume,
|
||||
],
|
||||
);
|
||||
|
||||
|
@@ -372,6 +372,7 @@ export interface VideoManagerType {
|
||||
licenseUrl: string,
|
||||
reactTag: number,
|
||||
) => Promise<void>;
|
||||
setVolume: (volume: number, reactTag: number) => Promise<void>;
|
||||
}
|
||||
|
||||
export interface VideoDecoderPropertiesType {
|
||||
|
Reference in New Issue
Block a user