components
All repositories: gitoria
2.6 KB
// demo.hl — `/media-player`: the player on a page, with how to use it. The page owns the queue and hands the player its src// back when a queue item is tapped (the host decides what plays; the component only tells it).parent '../main.hl'import MediaPlayer from './media-player.hl'__title = 'Media player · Hybriel components'// the demo's queue: the item that plays says so by its src (the player marks it current); the lengths are the files' ownHybrid items = [{ src = '/media/test-video.mp4' title = 'Test clip (video)' dur = '0:30' }{ src = '/media/test-audio.mp3' title = 'Test tone (audio)' dur = '0:45' }{ src = '/media/test-video.mp4?again' title = 'Test clip again (video)' dur = '0:30' }{ src = '/media/test-audio.mp3?plain' title = 'Test tone without a cover (audio)' dur = '0:45' }]String current = '/media/test-video.mp4'String currentKind = 'video'String autoPlay = 'false'String currentTitle = 'Test clip (video)'String currentArtist = 'made with ffmpeg (public domain)'String currentCover = '/media/cover.png'picked = (src) => {current = srcautoPlay = 'true'let i = 0while (i < items.length) {if (items[i].src == src) { currentTitle = items[i].title }i = i + 1}currentCover = src.endsWith('?plain') ? '' : '/media/cover.png'currentKind = src.endsWith('.mp3') || src.endsWith('?plain') ? 'audio' : 'video'}Boolean showSkip = trueString repeatMode = 'off'Style {mediaPlayerDemo {demoOption {display = 'flex'flexWrap = 'wrap'alignItems = 'center'gap = '.5rem'margin = '1rem 0'button {maxWidth = '100%'whiteSpace = 'normal'}output { flexShrink = '0' }}}}View {mediaPlayerDemo {h1 { "Media player" }p { class = "muted" "Video and audio in one phone-first player: a seek bar you drag with a finger, back and forward 10 seconds, play and pause, mute, the speed and fullscreen (video). The queue under it plays the next item when one ends." }MediaPlayer { src = current kind = currentKind title = currentTitle artist = currentArtist cover = currentCover queue = items onPlay = picked autoPlay = autoPlay skip = showSkip repeat = repeatMode }demoOption { button { id = "demoSkip" type = "button" "Toggle skip buttons (skip = false)" on click() { showSkip = !showSkip } } output { id = "skipValue" showSkip } }demoOption { button { id = "demoRepeat" type = "button" "Toggle repeat one (repeat = one)" on click() { repeatMode = repeatMode == 'off' ? 'one' : 'off' } } output { id = "repeatValue" repeatMode } }p { a { id = "readme" href = "/media-player/README.md" "README (how to use it)" } }}}
Branches
Latest commits
- 7e428ba6Re-vendor Hybriel day72 (day73 withdrawn: minifier breaks write sets)Atlas
- a06fc778Reset virtual-list window when the host changes resetKeyAtlas
- 3aab598cRe-vendor complete Hybriel day73 set for virtual-list resetAtlas
- 337ca075MD1 gate check measures frames in the page, not milliseconds from outside, and takes the middle load (components#30)mre
- f5f131c5Record AP29 autoplay comparisons and passing gatesmre
- 51c38187Gate media autoplay on first load and after client mountmre
- a3f2223dRecord successful B44 deployment and live proofmre
- 06c1e021Record passing B44 browser rerunmre
- c9861533Record B44 component proof and browser gate blockermre
- 1b7413beIgnore detached media events and space demo option outputsmre
- ca3b4959Re-vendor complete Hybriel plugins and runtime to day44mre
- df9e7df9Last-item checks run in the browser gate (components#26 fixed on day41); media-player loop is a plain Booleanmre
- 895a5afcRe-vendor complete Hybriel plugins and runtime to day41mre
- 16006bb3Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
- 88397fc3Re-vendor complete Hybriel plugins and runtime to day39mre
- 9b872cedRecord IC28 deployment and live icon verificationmre
- 46fefaa7Count the icons entry in the offline home-page checkmre
- c7e14cabRecord IC28 rerun and unchanged-main baseline comparisonmre
- 5e090ffdRecord IC28 review evidence and gate resultsmre
- adfe2c4dAdd shuffle, repeat and repeatOne shared iconsmre