mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Enable detecting autoplay status
This commit is contained in:
parent
df6f0487bf
commit
8358e21f2d
1 changed files with 17 additions and 3 deletions
|
|
@ -219,9 +219,8 @@ export default {
|
|||
// Set frame ID here so that it's the same when Youtube API looks for it
|
||||
// this.frameId = `youtube-bg-${this._uid}`
|
||||
|
||||
// this.initializeLitePlayer()
|
||||
|
||||
// this.initializePlayer()
|
||||
this.detectAutoplay()
|
||||
.then( statuses => console.log(statuses) )
|
||||
},
|
||||
methods: {
|
||||
scrollRow ( timestamp ) {
|
||||
|
|
@ -239,6 +238,21 @@ export default {
|
|||
timestampsScroller.scroll({ left: newScrollPosition, behavior: 'smooth' })
|
||||
},
|
||||
|
||||
async detectAutoplay () {
|
||||
|
||||
if ( !process.client ) return false
|
||||
|
||||
const { default: canAutoPlay } = await import('can-autoplay')
|
||||
|
||||
const willAutoplay = await canAutoPlay.video()
|
||||
const willAutoplayMuted = await canAutoPlay.video({ muted: true, inline: true })
|
||||
|
||||
return {
|
||||
willAutoplay,
|
||||
willAutoplayMuted
|
||||
}
|
||||
},
|
||||
|
||||
async seekTo (timestampInSeconds) {
|
||||
|
||||
if (this.playerLoaded === false) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue