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

export const Audio: React.FC<{ audioStream: DOMAttachableStream | null }> = ({ audioStream }) => {
  const { audioRef } = useAudio(audioStream)

  return audioStream && <audio ref={audioRef} data-testid='audioElement' />
}
