All files / atom/videoPlayer/src/hooks/vimeo useVideoMetadata.js

42.85% Statements 3/7
100% Branches 0/0
50% Functions 1/2
42.85% Lines 3/7

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 16 17 18 19 20 21    1x 6x                         6x        
import {VIMEO} from '../../settings/players.js'
 
const useVideoMetadata = ({src, onLoadVideo}) => {
  const loadVideoMetadata = async player => {
    const duration = await player.current.getDuration()
    const videoWidth = await player.current.getVideoWidth()
    const videoHeight = await player.current.getVideoHeight()
    onLoadVideo({
      src,
      type: VIMEO.VIDEO_TYPE,
      duration,
      videoWidth,
      videoHeight
    })
  }
 
  return {loadVideoMetadata}
}
 
export default useVideoMetadata