import renderPoster from './poster.js'
function renderTimestamps ( video ) {
const timestampsForRender = video.timestamps.map( timestamp => {
const [ minutes, seconds ] = timestamp.time.split(':')
return {
...timestamp,
inSeconds: (minutes * 60) + Number(seconds)
}
})
return timestampsForRender.map( timestamp => (/* html */`
`) ).join('')
}
export default async function ( video, options = {} ) {
const {
coverBottomHtml = ''
// classes = 'w-full flex-shrink-0 flex-grow-0 border-2 border-transparent rounded-2xl overflow-hidden'
} = options
// Setup inline player script
await this.usingComponent( 'node_modules/can-autoplay/build/can-autoplay.min.js' )
await this.usingComponent( 'helpers/lite-youtube.js' )
// Setup inline lazysizes
await this.usingComponent( 'node_modules/lazysizes/lazysizes.min.js' )
// console.log('video', video)
const posterHtml = renderPoster( video )
const timestampsHtml = renderTimestamps( video )
return /* html */`
`
}