gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmaina06fc778Reset virtual-list window when the host changes resetKeyAtlasmain/components/media-player/demo.hl

2.6 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. Style {
  33. mediaPlayerDemo {
  34. demoOption {
  35. display = 'flex'
  36. flexWrap = 'wrap'
  37. alignItems = 'center'
  38. gap = '.5rem'
  39. margin = '1rem 0'
  40. button {
  41. maxWidth = '100%'
  42. whiteSpace = 'normal'
  43. }
  44. output { flexShrink = '0' }
  45. }
  46. }
  47. }
  48. View {
  49. mediaPlayerDemo {
  50. h1 { "Media player" }
  51. 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." }
  52. MediaPlayer { src = current kind = currentKind title = currentTitle artist = currentArtist cover = currentCover queue = items onPlay = picked autoPlay = autoPlay skip = showSkip repeat = repeatMode }
  53. demoOption { button { id = "demoSkip" type = "button" "Toggle skip buttons (skip = false)" on click() { showSkip = !showSkip } } output { id = "skipValue" showSkip } }
  54. demoOption { button { id = "demoRepeat" type = "button" "Toggle repeat one (repeat = one)" on click() { repeatMode = repeatMode == 'off' ? 'one' : 'off' } } output { id = "repeatValue" repeatMode } }
  55. p { a { id = "readme" href = "/media-player/README.md" "README (how to use it)" } }
  56. }
  57. }

Branches

Latest commits

  • 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
  • c96709c8media-player: skip = false and repeat = 'one' options (jukebox#19)mre