Skip to content

Commit

Permalink
Merge pull request #613 from ahaoboy/master
Browse files Browse the repository at this point in the history
fix: chrome video don't show  bug
  • Loading branch information
mikolalysenko authored Jul 22, 2021
2 parents b164bf1 + 0a53483 commit 35647e9
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions example/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,25 @@ require('resl')({
},

onDone: ({ video }) => {
video.autoplay = true
video.autoplay = false
video.loop = true
video.play()

const texture = regl.texture(video)
regl.frame(() => {
drawDoggie({ video: texture.subimage(video) })
video.preload = 'auto'
video.autoload = true
video.load()

const startBtn = document.createElement('button')
startBtn.style = 'position:absolute;left:50%;top:50%'
startBtn.innerText = 'start'
document.body.appendChild(startBtn)

startBtn.addEventListener('click', () => {
video.play()
const texture = regl.texture(video)
regl.frame(() => {
drawDoggie({ video: texture.subimage(video) })
})
startBtn.parentNode.removeChild(startBtn)
})
}
})

0 comments on commit 35647e9

Please sign in to comment.