Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

readme.md

about

Helps control video elements with autoplay available down to iOS 8.

setup

Fetch latest from the npm registry:

npm install @thewhodidthis/playah

usage

Feed with a <video> element as for example,

import createPlayer from 'playah'

const video = document.createElement('video')

'playsinline loop autoplay'.split(' ').forEach((v) => {
  video.setAttribute(v, '')
})

video.setAttribute('src', 'BigBuckBunny.mp4')

// Instantiating past video setup is
// kind of important in this example
const { play, stop } = createPlayer(video)

let paused = 1

video.addEventListener('loadstart', () => {
  paused = 0
})

video.addEventListener('click', (e) => {
  e.preventDefault()

  paused = paused ? play() : stop()
}, false)

document.body.appendChild(video)
You can’t perform that action at this time.