From 158b943826ae5b3fea8b4ce4b73bf774a391deb2 Mon Sep 17 00:00:00 2001 From: EkaanshArora Date: Wed, 15 Sep 2021 02:18:10 +0530 Subject: [PATCH] add config to AgoraVideoPlayer - #9 --- src/index.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 146ff64..32f4993 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -13,7 +13,8 @@ import AgoraRTC, { IMicrophoneAudioTrack, IRemoteVideoTrack, MicrophoneAudioTrackInitConfig, - ScreenVideoTrackInitConfig + ScreenVideoTrackInitConfig, + VideoPlayerConfig } from 'agora-rtc-sdk-ng' export default AgoraRTC; @@ -330,11 +331,11 @@ export function createScreenVideoTrack( } -export const AgoraVideoPlayer = (props: React.DetailedHTMLProps, HTMLDivElement> & { videoTrack: ILocalVideoTrack | IRemoteVideoTrack | ICameraVideoTrack }) => { +export const AgoraVideoPlayer = (props: React.DetailedHTMLProps, HTMLDivElement> & { videoTrack: ILocalVideoTrack | IRemoteVideoTrack | ICameraVideoTrack } & {config?: VideoPlayerConfig}) => { const vidDiv: RefObject = useRef(null) - const { videoTrack, ...other } = props; + const { videoTrack, config, ...other } = props; useEffect(() => { - if (vidDiv.current !== null) videoTrack.play(vidDiv.current) + if (vidDiv.current !== null) videoTrack.play(vidDiv.current, config) return () => { videoTrack.stop() }