gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitadfe2c4dadfe2c4dAdd shuffle, repeat and repeatOne shared iconsmreadfe2c4d/components/media-player/demo.hl

2.3 KB

  1. // 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
  2. // back when a queue item is tapped (the host decides what plays; the component only tells it).
  3. parent '../main.hl'
  4. import MediaPlayer from './media-player.hl'
  5. __title = 'Media player · Hybriel components'
  6. // the demo's queue: the item that plays says so by its src (the player marks it current); the lengths are the files' own
  7. Hybrid items = [
  8. { src = '/media/test-video.mp4' title = 'Test clip (video)' dur = '0:30' }
  9. { src = '/media/test-audio.mp3' title = 'Test tone (audio)' dur = '0:45' }
  10. { src = '/media/test-video.mp4?again' title = 'Test clip again (video)' dur = '0:30' }
  11. { src = '/media/test-audio.mp3?plain' title = 'Test tone without a cover (audio)' dur = '0:45' }
  12. ]
  13. String current = '/media/test-video.mp4'
  14. String currentKind = 'video'
  15. String autoPlay = 'false'
  16. String currentTitle = 'Test clip (video)'
  17. String currentArtist = 'made with ffmpeg (public domain)'
  18. String currentCover = '/media/cover.png'
  19. picked = (src) => {
  20. current = src
  21. autoPlay = 'true'
  22. let i = 0
  23. while (i < items.length) {
  24. if (items[i].src == src) { currentTitle = items[i].title }
  25. i = i + 1
  26. }
  27. currentCover = src.endsWith('?plain') ? '' : '/media/cover.png'
  28. currentKind = src.endsWith('.mp3') || src.endsWith('?plain') ? 'audio' : 'video'
  29. }
  30. Boolean showSkip = true
  31. String repeatMode = 'off'
  32. View {
  33. mediaPlayerDemo {
  34. h1 { "Media player" }
  35. 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." }
  36. MediaPlayer { src = current kind = currentKind title = currentTitle artist = currentArtist cover = currentCover queue = items onPlay = picked autoPlay = autoPlay skip = showSkip repeat = repeatMode }
  37. p { button { id = "demoSkip" type = "button" "Toggle skip buttons (skip = false)" on click() { showSkip = !showSkip } } output { id = "skipValue" showSkip } }
  38. p { button { id = "demoRepeat" type = "button" "Toggle repeat one (repeat = one)" on click() { repeatMode = repeatMode == 'off' ? 'one' : 'off' } } output { id = "repeatValue" repeatMode } }
  39. p { a { id = "readme" href = "/media-player/README.md" "README (how to use it)" } }
  40. }
  41. }

Branches

Latest commits

  • adfe2c4dAdd shuffle, repeat and repeatOne shared iconsmre
  • c96709c8media-player: skip = false and repeat = 'one' options (jukebox#19)mre
  • bd4aa808Record VL24 deployment and live verificationmre
  • e5b98ecfRun virtual-list gate before deploymentmre
  • 2e9b4a8evirtual-list: into main, with centerId and scrollTop/onScroll (jukebox#20)mre
  • 69954249Align all plugin sources with Hybriel day38bmre
  • f740f666Re-vendor components to Hybriel set day38bmre
  • 8176eb14Record CS23b deployment and live verificationmre
  • 84e3ddaaRemove blank line before pagination Style closing bracemre
  • a92298ddRecord exact CSS and same-date proof after specificity reviewmre
  • c71a0abePreserve consumer theme specificity with nested tag rulesmre
  • 64a2bc27Document CS23b style formatting proof and review statusmre
  • a72b57cficons: nest Style rules in the language's formmre
  • 927616e2pagination: nest Style rules in the language's formmre
  • aab8ad29code-editor: nest Style rules in the language's formmre
  • ba30727afile-upload: nest Style rules in the language's formmre
  • 42fefa4emodal: nest Style rules in the language's formmre
  • 6fd953e3range-picker: nest Style rules in the language's formmre
  • f661951ddate-picker: nest Style rules in the language's formmre
  • 363577e6media-player: nest Style rules in the language's formmre