All files / atom/videoPlayer/src/hooks useVideoPlayer.js

100% Statements 8/8
100% Branches 2/2
100% Functions 2/2
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15        1x 32x 32x 32x 32x   29x        
import {lazy} from 'react'
 
import {UNKNOWN} from '../settings/index.js'
import useDetectVideoType from './useDetectVideoType.js'
const useVideoPlayer = props => {
  const {src} = props
  const {detectVideoType} = useDetectVideoType()
  const videoType = detectVideoType(src)
  if (videoType === UNKNOWN) return ['p', {...props, children: 'Not supported media type'}]
 
  return [lazy(() => import(`../components/${videoType.PLAYER_COMPONENT}.js`)), props]
}
 
export default useVideoPlayer