import renderPoster from './poster.js' function renderTimestamps ( video ) { if ( video.timestamps.length === 0 ) return '' const timestampsForRender = video.timestamps.map( timestamp => { const [ minutes, seconds ] = timestamp.time.split(':') return { ...timestamp, inSeconds: (minutes * 60) + Number(seconds) } }) const timestampButtonsHtml = timestampsForRender.map( timestamp => (/* html */` `) ).join('') return /* html */`
` } 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 */`