INNER CODE UNIT · JavaScript

toggleVideo

presenta-software/presenta-lib · src/blocks/video/index.js:26

  const toggleVideo = (e) => {
    if (!video) video = child.querySelector('video')
    if (isPlaying) {
      video.pause()
    } else {
      video.play()
    }
    isPlaying = !isPlaying
  }

  const setKeyListener = e => {
    if (e.key === ' ') {
      toggleVideo()
      e.stopPropagation()
      e.preventDefault()
    }
    if (e.key === 'r') {
      if (video) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…