gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitbd4aa808bd4aa808Record VL24 deployment and live verificationmrebd4aa808/components/media-player/media-player.hl

20.7 KB

  1. // media-player.hl — THE MEDIA PLAYER, all Hybriel (no JavaScript file): audio and video in one phone-first player.
  2. // `MediaPlayer { src = "/media/x.mp4" kind = "video" title = "The clip" artist = "Someone" }` — `kind = "audio"` shows a
  3. // cover image (`cover`) with the title and artist instead of the video area. The browser's own media element plays (no
  4. // `controls`: this component draws the controls, sized for a thumb): a seek bar you drag with a finger (the played part in
  5. // the accent colour, the buffered part as a lighter bar, a 44 px tall touch area with a thin visible bar), Back 10 s,
  6. // play/pause (the largest button), Forward 10 s, mute, the current time / total time, the playback speed (1 / 1.25 / 1.5 / 2)
  7. // and, on video, fullscreen. THE QUEUE is the host's list: `queue = [{ src, title, dur }]` renders under the player, the
  8. // item that plays is marked with the accent colour only, and a tap calls the host's function with the record's `src`
  9. // (hybriel#87: a child talks upward through a function its host gives it) — the host hands a new `src` back, the player
  10. // loads and plays it; when an item ends, the next one is picked the same way. USE ONE PER PAGE (a composed component's
  11. // members are the page's state). Keyboard: the media element takes the focus (a click on it), Space plays / pauses,
  12. // ArrowLeft / ArrowRight jump 10 s. The handlers read the elements' own state, never the members.
  13. import Icon from '../icons/icons.hl'
  14. String src = ''
  15. String kind = 'video'
  16. String title = ''
  17. String artist = ''
  18. String cover = ''
  19. String playLabel = 'Play'
  20. String pauseLabel = 'Pause'
  21. String backLabel = 'Back 10 seconds'
  22. String forwardLabel = 'Forward 10 seconds'
  23. String muteLabel = 'Mute'
  24. String unmuteLabel = 'Unmute'
  25. String speedLabel = 'Playback speed'
  26. String fullscreenLabel = 'Fullscreen'
  27. String queueLabel = 'Queue'
  28. Hybrid queue = []
  29. onPlay = null
  30. Number jump = 10
  31. // the state the media events write (the framework repaints the sites that read them)
  32. String playing = 'false'
  33. String muted = 'false'
  34. String timeText = '0:00'
  35. String totalText = '0:00'
  36. String playedPct = '0'
  37. String bufferedPct = '0'
  38. String speedText = '1'
  39. String dragging = 'false'
  40. String bufferedStyle = 'width:0%'
  41. String playedStyle = 'width:0%'
  42. String thumbStyle = 'left:0%'
  43. String autoPlay = 'false'
  44. String playClass = 'mp-play'
  45. String playLabelNow = playLabel
  46. String playIsNow = playLabel
  47. String muteClass = 'mp-mute'
  48. String muteLabelNow = muteLabel
  49. // "1:23" — whole seconds are enough for a time line
  50. clockText(t) {
  51. if (t == null || t < 0 || t != t) { return '0:00' }
  52. s = t - t % 1
  53. m = (s - s % 60) / 60
  54. sec = s - m * 60
  55. return m + ':' + (sec < 10 ? '0' : '') + sec
  56. }
  57. // the player's own element (the video or audio tag of this component)
  58. mediaOf(node) { return node.closest('media-player').querySelector('video, audio') }
  59. // the media element an event came from: the element itself (its own events can arrive while it is not yet in the page),
  60. // or the one of the player the node belongs to (the mount tick of the seek bar)
  61. mediaFrom(node) { return node.matches('video, audio') ? node : mediaOf(node) }
  62. // the seek bar of this component
  63. barOf(node) { return node.closest('media-player').querySelector('mp-seek') }
  64. // the media element's buffered end as a percent of its duration
  65. bufferedPctOf(v) {
  66. if (v == null || v.buffered.length == 0 || v.duration == 0 || v.duration == null) { return '0' }
  67. return '' + ((v.buffered.end(v.buffered.length - 1) / v.duration) * 100 - (v.buffered.end(v.buffered.length - 1) / v.duration) * 100 % 1)
  68. }
  69. Style {
  70. mediaPlayer {
  71. display = 'block'
  72. font = 'inherit'
  73. color = 'var(--color-text, #000)'
  74. background = 'var(--color-background, #fff)'
  75. video {
  76. display = 'block'
  77. width = '100%'
  78. aspectRatio = '16 / 9'
  79. height = 'auto'
  80. objectFit = 'contain'
  81. background = 'var(--color-background-sunken, #555)'
  82. borderRadius = 'var(--radius-large, 10px)'
  83. cursor = 'pointer'
  84. }
  85. audio { display = 'none' }
  86. // Class or attribute assigned by the View or code; no compound-selector form.
  87. '.mp-cover' {
  88. display = 'flex'
  89. alignItems = 'center'
  90. gap = '.8rem'
  91. margin = '0 0 .4rem'
  92. img {
  93. flex = 'none'
  94. width = '5rem'
  95. height = '5rem'
  96. objectFit = 'cover'
  97. borderRadius = 'var(--radius-large, 10px)'
  98. background = 'var(--color-surface, #ddd)'
  99. }
  100. h2 {
  101. margin = '0'
  102. fontSize = '1.15rem'
  103. lineHeight = '1.3'
  104. color = 'var(--color-text-strong, #000)'
  105. overflowWrap = 'anywhere'
  106. }
  107. p {
  108. margin = '.15rem 0 0'
  109. color = 'var(--color-text-muted, #555)'
  110. overflowWrap = 'anywhere'
  111. }
  112. }
  113. mpSeek {
  114. display = 'block'
  115. position = 'relative'
  116. height = '2.75rem'
  117. margin = '.15rem 0'
  118. touchAction = 'none'
  119. cursor = 'pointer'
  120. animation = 'media-player-mount 100ms linear infinite'
  121. // Class or attribute assigned by the View or code; no compound-selector form.
  122. '.mp-track' {
  123. position = 'absolute'
  124. left = '.3125rem'
  125. right = '.3125rem'
  126. top = '1.1875rem'
  127. height = '.375rem'
  128. borderRadius = 'var(--radius-small, 5px)'
  129. background = 'var(--color-surface, #ddd)'
  130. overflow = 'hidden'
  131. }
  132. // Class or attribute assigned by the View or code; no compound-selector form.
  133. '.mp-buffered' {
  134. position = 'absolute'
  135. left = '0'
  136. top = '0'
  137. bottom = '0'
  138. width = '0'
  139. background = 'var(--color-grey, #999)'
  140. opacity = '.55'
  141. }
  142. // Class or attribute assigned by the View or code; no compound-selector form.
  143. '.mp-played' {
  144. position = 'absolute'
  145. left = '0'
  146. top = '0'
  147. bottom = '0'
  148. width = '0'
  149. background = 'var(--color-accent, #000)'
  150. }
  151. // Class or attribute assigned by the View or code; no compound-selector form.
  152. '.mp-thumb' {
  153. position = 'absolute'
  154. top = '1.0625rem'
  155. width = '.625rem'
  156. height = '.625rem'
  157. borderRadius = '50%'
  158. background = 'var(--color-accent, #000)'
  159. transform = 'translateX(-50%)'
  160. left = '0'
  161. marginLeft = '.3125rem'
  162. }
  163. }
  164. mpButtons {
  165. display = 'flex'
  166. alignItems = 'center'
  167. flexWrap = 'wrap'
  168. gap = '.2rem'
  169. button {
  170. display = 'inline-flex'
  171. alignItems = 'center'
  172. justifyContent = 'center'
  173. minWidth = '2.75rem'
  174. minHeight = '2.75rem'
  175. padding = '0'
  176. font = 'inherit'
  177. fontWeight = '600'
  178. color = 'var(--color-text, #000)'
  179. background = 'transparent'
  180. border = '0'
  181. borderRadius = 'var(--radius-small, 5px)'
  182. cursor = 'pointer'
  183. hover { background = 'var(--color-surface, #f2f2f2)' }
  184. focusVisible {
  185. outline = '2px solid var(--color-accent, #555)'
  186. outlineOffset = '1px'
  187. }
  188. }
  189. // Class or attribute assigned by the View or code; no compound-selector form.
  190. 'button.mp-play' {
  191. background = 'var(--color-surface, #f2f2f2)'
  192. minWidth = '3.25rem'
  193. minHeight = '3.25rem'
  194. width = '3.25rem'
  195. height = '3.25rem'
  196. }
  197. // Class or attribute assigned by the View or code; no compound-selector form.
  198. '.mp-times' {
  199. display = 'inline-flex'
  200. alignItems = 'center'
  201. minHeight = '2.75rem'
  202. padding = '0'
  203. flex = '0 1 auto'
  204. flexWrap = 'nowrap'
  205. fontVariantNumeric = 'tabular-nums'
  206. fontSize = '.85rem'
  207. whiteSpace = 'nowrap'
  208. color = 'var(--color-text-muted, #555)'
  209. }
  210. }
  211. // Class or attribute assigned by the View or code; no compound-selector form.
  212. '.mp-play' {
  213. // Class or attribute assigned by the View or code; no compound-selector form.
  214. '.i-pause' { display = 'none' }
  215. }
  216. // Class or attribute assigned by the View or code; no compound-selector form.
  217. '.mp-play.is-playing' {
  218. // Class or attribute assigned by the View or code; no compound-selector form.
  219. '.i-play' { display = 'none' }
  220. // Class or attribute assigned by the View or code; no compound-selector form.
  221. '.i-pause' { display = 'inline-flex' }
  222. }
  223. // Class or attribute assigned by the View or code; no compound-selector form.
  224. '.mp-mute' {
  225. // Class or attribute assigned by the View or code; no compound-selector form.
  226. '.i-off' { display = 'none' }
  227. }
  228. // Class or attribute assigned by the View or code; no compound-selector form.
  229. '.mp-mute.is-muted' {
  230. // Class or attribute assigned by the View or code; no compound-selector form.
  231. '.i-on' { display = 'none' }
  232. // Class or attribute assigned by the View or code; no compound-selector form.
  233. '.i-off' { display = 'inline-flex' }
  234. }
  235. // Class or attribute assigned by the View or code; no compound-selector form.
  236. '.mp-queue-title' {
  237. margin = '1rem 0 .2rem'
  238. fontSize = '1rem'
  239. color = 'var(--color-text-strong, #000)'
  240. }
  241. // Class or attribute assigned by the View or code; no compound-selector form.
  242. 'ol.mp-queue' {
  243. display = 'grid'
  244. gap = '.1rem'
  245. margin = '0'
  246. padding = '0'
  247. listStyle = 'none'
  248. li { margin = '0' }
  249. button {
  250. display = 'flex'
  251. alignItems = 'center'
  252. gap = '.5rem'
  253. width = '100%'
  254. minHeight = '2.75rem'
  255. padding = '.3rem .55rem'
  256. font = 'inherit'
  257. textAlign = 'left'
  258. color = 'var(--color-text, #000)'
  259. background = 'transparent'
  260. border = '0'
  261. borderRadius = 'var(--radius-small, 5px)'
  262. cursor = 'pointer'
  263. hover { background = 'var(--color-surface, #f2f2f2)' }
  264. focusVisible {
  265. outline = '2px solid var(--color-accent, #555)'
  266. outlineOffset = '1px'
  267. }
  268. }
  269. // Class or attribute assigned by the View or code; no compound-selector form.
  270. 'li.current' {
  271. button {
  272. color = 'var(--color-accent, #000)'
  273. background = 'var(--color-surface, #f2f2f2)'
  274. }
  275. // Class or attribute assigned by the View or code; no compound-selector form.
  276. '.mp-q-dur' { color = 'inherit' }
  277. }
  278. // Class or attribute assigned by the View or code; no compound-selector form.
  279. '.mp-q-title' {
  280. flex = '1'
  281. minWidth = '0'
  282. overflowWrap = 'anywhere'
  283. textAlign = 'left'
  284. }
  285. // Class or attribute assigned by the View or code; no compound-selector form.
  286. '.mp-q-dur' {
  287. flex = 'none'
  288. fontSize = '.85rem'
  289. color = 'var(--color-text-muted, #555)'
  290. }
  291. }
  292. }
  293. '@keyframes media-player-mount' {
  294. 'from' { opacity = '.999' }
  295. to { opacity = '1' }
  296. }
  297. // No language form for selector list.
  298. 'media-player mp-buttons .i-play, media-player mp-buttons .i-pause, media-player mp-buttons .i-on, media-player mp-buttons .i-off' {
  299. display = 'inline-flex'
  300. flex = 'none'
  301. lineHeight = '0'
  302. }
  303. }
  304. View {
  305. mediaPlayer {
  306. if (isVideo) { video { src = src preload = "metadata" playsinline = "playsinline" tabindex = "0" title = title class = "mp-media"
  307. on click(e) { emit mpToggle(e) } on play(e) { emit mpStarted(e) } on pause(e) { emit mpPaused(e) } on ended(e) { emit mpEnded(e) } on timeupdate(e) { emit mpTime(e) } on durationchange(e) { emit mpTotal(e) } on loadedmetadata(e) { emit mpLoad(e) } on progress(e) { emit mpBuffered(e) } on volumechange(e) { emit mpVolume(e) } on ratechange(e) { emit mpRate(e) } on keydown(e) { emit mpKey(e) }
  308. } }
  309. if (isAudio) { audio { src = src preload = "metadata" class = "mp-media"
  310. on play(e) { emit mpStarted(e) } on pause(e) { emit mpPaused(e) } on ended(e) { emit mpEnded(e) } on timeupdate(e) { emit mpTime(e) } on durationchange(e) { emit mpTotal(e) } on loadedmetadata(e) { emit mpLoad(e) } on progress(e) { emit mpBuffered(e) } on volumechange(e) { emit mpVolume(e) } on ratechange(e) { emit mpRate(e) } on keydown(e) { emit mpKey(e) }
  311. }
  312. if (hasCover) { div { class = "mp-cover"
  313. img { src = cover alt = "" }
  314. div {
  315. h2 { title }
  316. p { artist }
  317. }
  318. } }
  319. }
  320. mpSeek { role = "slider" 'aria-label' = "Seek" 'aria-valuemin' = "0" 'aria-valuemax' = "100" 'aria-valuenow' = playedPct 'aria-valuetext' = seekText tabindex = "0"
  321. on animationiteration(e) { emit mpMount(e) } on pointerdown(e) { emit mpDown(e) } on pointermove(e) { emit mpMove(e) } on pointerup(e) { emit mpUp(e) } on pointercancel(e) { emit mpUp(e) } on keydown(e) { emit mpBarKey(e) }
  322. div { class = "mp-track"
  323. div { class = "mp-buffered" style = bufferedStyle }
  324. div { class = "mp-played" style = playedStyle }
  325. }
  326. div { class = "mp-thumb" style = thumbStyle }
  327. }
  328. mpButtons {
  329. button { type = "button" class = "mp-back" title = backLabel 'aria-label' = backLabel Icon { name = "skipBack" size = "1.5em" } on click(e) { emit mpBack(e) } }
  330. button { type = "button" class = playClass title = playLabelNow 'aria-label' = playIsNow
  331. span { class = "i-play" Icon { name = "play" size = "1.75em" } }
  332. span { class = "i-pause" Icon { name = "pause" size = "1.75em" } }
  333. on click(e) { emit mpToggle(e) }
  334. }
  335. button { type = "button" class = "mp-forward" title = forwardLabel 'aria-label' = forwardLabel Icon { name = "skipForward" size = "1.5em" } on click(e) { emit mpForward(e) } }
  336. span { class = "mp-times"
  337. time { timeText }
  338. span { 'aria-hidden' = "true" "/" }
  339. time { totalText }
  340. }
  341. button { type = "button" class = muteClass title = muteLabelNow 'aria-label' = muteLabelNow
  342. span { class = "i-on" Icon { name = "volume" } }
  343. span { class = "i-off" Icon { name = "volumeOff" } }
  344. on click(e) { emit mpMute(e) }
  345. }
  346. button { type = "button" class = "mp-speed" title = speedLabel 'aria-label' = speedName on click(e) { emit mpSpeed(e) }
  347. span { 'aria-hidden' = "true" speedText + '×' }
  348. }
  349. if (isVideo) { button { type = "button" class = "mp-fullscreen" title = fullscreenLabel 'aria-label' = fullscreenLabel Icon { name = "fullscreen" } on click(e) { emit mpFull(e) } } }
  350. }
  351. if (hasQueue) { div {
  352. h2 { class = "mp-queue-title" queueLabel }
  353. ol { class = "mp-queue" 'aria-label' = queueLabel
  354. for (q of rows) { li { class = q.cls
  355. button { type = "button" 'data-src' = q.src title = q.title
  356. span { class = "mp-q-title" q.title }
  357. span { class = "mp-q-dur" q.dur }
  358. on click(e) { emit mpPick(e) }
  359. }
  360. } }
  361. }
  362. } }
  363. }
  364. }
  365. isVideo = kind != 'audio'
  366. isAudio = kind == 'audio'
  367. hasCover = kind == 'audio' && cover != ''
  368. hasQueue = queue.length > 0
  369. seekText = timeText + ' of ' + totalText
  370. speedName = speedLabel + ' ' + speedText + '×'
  371. Hybrid rows = rowsOf(queue, src)
  372. // the queue rows with the current one marked (a row's class must be a field of the record)
  373. rowsOf(list, now) {
  374. out = []
  375. let i = 0
  376. while (i < list.length) {
  377. out.push({ src = list[i].src title = list[i].title dur = list[i].dur cls = list[i].src == now ? 'current' : '' })
  378. i = i + 1
  379. }
  380. return out
  381. }
  382. // ---- the buttons ----------------------------------------------------------------------------------------
  383. on mpToggle(e) {
  384. v = mediaOf(e.target)
  385. if (v.paused) { v.play() } else { v.pause() }
  386. return null
  387. }
  388. on mpBack(e) {
  389. v = mediaOf(e.target)
  390. if (v.currentTime > jump) { v.currentTime = v.currentTime - jump } else { v.currentTime = 0 }
  391. return null
  392. }
  393. on mpForward(e) {
  394. v = mediaOf(e.target)
  395. if (v.duration > 0 && v.currentTime + jump < v.duration) { v.currentTime = v.currentTime + jump } else if (v.duration > 0) { v.currentTime = v.duration }
  396. return null
  397. }
  398. on mpMute(e) {
  399. v = mediaOf(e.target)
  400. v.muted = !v.muted
  401. return null
  402. }
  403. on mpSpeed(e) {
  404. v = mediaOf(e.target)
  405. s = v.playbackRate
  406. let next = 1
  407. if (s == 1) { next = 1.25 } else if (s == 1.25) { next = 1.5 } else if (s == 1.5) { next = 2 }
  408. v.playbackRate = next
  409. speedText = '' + next
  410. return null
  411. }
  412. on mpFull(e) {
  413. p = e.target.closest('media-player')
  414. if (document.fullscreenElement != null) { document.exitFullscreen() } else { p.requestFullscreen() }
  415. return null
  416. }
  417. // ---- the seek bar ---------------------------------------------------------------------------------------
  418. // the percent of the bar a pointer x lands on
  419. pctOf(bar, x) {
  420. r = bar.getBoundingClientRect()
  421. if (r.width == 0) { return 0 }
  422. let p = (x - r.left) / r.width * 100
  423. if (p < 0) { p = 0 }
  424. if (p > 100) { p = 100 }
  425. return p - p % 1
  426. }
  427. on mpDown(e) {
  428. v = mediaOf(e.target)
  429. bar = barOf(e.target)
  430. bar.setPointerCapture(e.pointerId)
  431. dragging = 'true'
  432. if (v.duration > 0) { v.currentTime = pctOf(bar, e.clientX) / 100 * v.duration }
  433. return null
  434. }
  435. on mpMove(e) {
  436. if (dragging != 'true') { return null }
  437. v = mediaOf(e.target)
  438. bar = barOf(e.target)
  439. if (v.duration > 0) { v.currentTime = pctOf(bar, e.clientX) / 100 * v.duration }
  440. return null
  441. }
  442. on mpUp(e) {
  443. dragging = 'false'
  444. return null
  445. }
  446. // the seek bar itself takes the keyboard too: arrows jump, Home / End go to the ends
  447. on mpBarKey(e) {
  448. v = mediaOf(e.target)
  449. if (e.key == 'ArrowLeft') { e.preventDefault() emit mpBack(e) return null }
  450. if (e.key == 'ArrowRight') { e.preventDefault() emit mpForward(e) return null }
  451. if (e.key == 'Home' && v.duration > 0) { e.preventDefault() v.currentTime = 0 return null }
  452. if (e.key == 'End' && v.duration > 0) { e.preventDefault() v.currentTime = v.duration return null }
  453. return null
  454. }
  455. // ---- the media element's events --------------------------------------------------------------------------
  456. // the whole display read from the media element: the labels, the times, the bars, the play / mute / speed state. A new
  457. // source on the SAME element (a queue item of the same kind) or a new element (the kind changed) must never show the
  458. // old item's state: the time, the bars, the speed and the mute of the element are what the buttons show.
  459. on mpSync(e) {
  460. v = mediaFrom(e.target)
  461. timeText = clockText(v.currentTime)
  462. totalText = v.duration > 0 ? clockText(v.duration) : '0:00'
  463. playedPct = v.duration > 0 ? '' + (v.currentTime / v.duration * 100 - v.currentTime / v.duration * 100 % 1) : '0'
  464. playedStyle = 'width:' + playedPct + '%'
  465. thumbStyle = 'left:' + playedPct + '%'
  466. bufferedPct = bufferedPctOf(v)
  467. bufferedStyle = 'width:' + bufferedPct + '%'
  468. speedText = '' + v.playbackRate
  469. muted = v.muted ? 'true' : 'false'
  470. muteClass = v.muted ? 'mp-mute is-muted' : 'mp-mute'
  471. muteLabelNow = v.muted ? unmuteLabel : muteLabel
  472. playClass = v.paused ? 'mp-play' : 'mp-play is-playing'
  473. playLabelNow = v.paused ? playLabel : pauseLabel
  474. playIsNow = playLabelNow
  475. return null
  476. }
  477. // the metadata of a new source arrived after the handlers were bound (a queue pick of the same kind keeps the element and
  478. // only changes its src; `loadstart` is not a DOM event the framework knows, `loadedmetadata` is): read the display again
  479. // and, when the host asked for it, start the new item
  480. on mpLoad(e) {
  481. emit mpSync(e)
  482. v = mediaFrom(e.target)
  483. if (autoPlay == 'true') { v.play() }
  484. return null
  485. }
  486. on mpRate(e) { speedText = '' + e.target.playbackRate return null }
  487. // the first tick of the mount animation: the element's own state (already loaded before the handlers bound)
  488. // is read in, then the animation is turned off
  489. on mpMount(e) {
  490. e.target.style.animationName = 'none'
  491. emit mpSync(e)
  492. v = mediaOf(e.target)
  493. if (autoPlay == 'true') { v.play() }
  494. return null
  495. }
  496. on mpStarted(e) { playing = 'true' playClass = 'mp-play is-playing' playLabelNow = pauseLabel playIsNow = pauseLabel return null }
  497. on mpPaused(e) { playing = 'false' playClass = 'mp-play' playLabelNow = playLabel playIsNow = playLabel return null }
  498. on mpTime(e) {
  499. v = e.target
  500. timeText = clockText(v.currentTime)
  501. if (v.duration > 0) {
  502. playedPct = '' + (v.currentTime / v.duration * 100 - v.currentTime / v.duration * 100 % 1)
  503. playedStyle = 'width:' + playedPct + '%'
  504. thumbStyle = 'left:' + playedPct + '%'
  505. if (totalText == '0:00') { totalText = clockText(v.duration) }
  506. bufferedPct = bufferedPctOf(v)
  507. bufferedStyle = 'width:' + bufferedPct + '%'
  508. }
  509. return null
  510. }
  511. on mpTotal(e) {
  512. if (e.target.duration > 0) { totalText = clockText(e.target.duration) }
  513. return null
  514. }
  515. on mpBuffered(e) {
  516. v = e.target
  517. bufferedPct = bufferedPctOf(v)
  518. bufferedStyle = 'width:' + bufferedPct + '%'
  519. if (v.duration > 0 && totalText == '0:00') { totalText = clockText(v.duration) }
  520. return null
  521. }
  522. on mpVolume(e) {
  523. muted = e.target.muted ? 'true' : 'false'
  524. muteClass = muted == 'true' ? 'mp-mute is-muted' : 'mp-mute'
  525. muteLabelNow = muted == 'true' ? unmuteLabel : muteLabel
  526. return null
  527. }
  528. on mpKey(e) {
  529. if (e.key == ' ' || e.key == 'Spacebar') { e.preventDefault() emit mpToggle(e) return null }
  530. if (e.key == 'ArrowLeft') { e.preventDefault() emit mpBack(e) return null }
  531. if (e.key == 'ArrowRight') { e.preventDefault() emit mpForward(e) return null }
  532. return null
  533. }
  534. // ---- the queue ---------------------------------------------------------------------------------------------
  535. // a tap on a queue item tells the host, which hands a new src back (the player is built anew with it)
  536. // a tap on a queue item tells the host, which hands a new src back (the player is built anew with it); the
  537. // new one starts playing at once (the user asked for it — autoplay policies allow a play after a tap)
  538. on mpPick(e) {
  539. b = e.target.closest('button')
  540. if (onPlay != null) { onPlay(b.getAttribute('data-src')) }
  541. return null
  542. }
  543. // an item ended: the next one is picked the same way (the last one just stops)
  544. on mpEnded(e) {
  545. playing = 'false'
  546. let i = 0
  547. let next = ''
  548. while (i < queue.length) {
  549. if (queue[i].src == src && i + 1 < queue.length) { next = queue[i + 1].src }
  550. i = i + 1
  551. }
  552. if (next != '' && onPlay != null) { onPlay(next) }
  553. return null
  554. }

Branches

Latest commits

  • 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
  • 0b3fd8c9comments: nest Style rules in the language's formmre
  • 67e043c8plugins/web/README.md from hybriel cb9e480dmre