import React from 'react'
import { DOMAttachableStream } from '@zocks-communications/client-sdk-js'
import { useVideo } from './hooks'

export const Video: React.FC<{ videoStream: DOMAttachableStream | null }> = ({ videoStream }) => {
  const { videoRef } = useVideo(videoStream)

  return videoStream && <video ref={videoRef} data-testid='videoElement' />
}
