EpubMediaPlayer
A player for one media element of an EPUB page, drawn over the poster that the page paints at EpubMedia.rect (HTML, 4.8.11).
Before it starts, it draws a play button, and a tap starts it. A video then plays in the box, and an audio element shows a transport bar in its own. With EpubMedia.controls, a video shows that bar along its bottom too, and a tap pauses and plays again. Without it, a tap still pauses and plays again, and shows the bar until the video has played on for a few seconds, since a reader must be able to stop what moves (#480). An element with EpubMedia.autoplay starts by itself, muted, since browsers let only muted media start unasked; the first touch of its controls, or of a video without them, turns the sound on. EpubMedia.muted mutes it from the start. EpubMedia.loop plays it again from the start when it ends. The player plays the first source it can, in the element's order, and when it can play none, the poster stays and the button goes.
The bar shows the elapsed and the total time around a line of how far playback has gone. A tap on the line seeks there and a drag scrubs, and a screen reader moves it as a slider (#479). The bar ends with a mute button and a menu of speeds from 0.5 to 2, which keep the pitch (#484). Where the box is too narrow, the times and then the menus leave the bar.
The subtitle and caption tracks of the element load with it, and the one it marks default shows over the video at once. A menu on the bar picks another track or none (#483).
The bar of a video has a full-screen button (#482). Full screen shows the same player over the whole window, in a Dialog, so playback goes on without a break, and the button, a back gesture or Escape leaves it. While it is up, the box on the page shows what the page paints there, the poster where the element has one. On Android, full screen also hides the system bars, and a landscape video turns the screen to landscape when the activity handles orientation changes itself, since a recreated activity would close the player. On iOS 16 and later, a landscape video asks the window scene for landscape. Both turn back to the orientation they found when full screen ends.
The player is closed when this leaves the composition, so a page that scrolls away stops. With a place, session keeps where it stopped, and the element shows that place, paused, when it comes back. Starting it pauses any other element of session that plays. When the app leaves the screen, a video pauses and an audio element follows KiteMediaSession.audioInBackground.
Parameters
plays a source that the book names by an https URL. See KiteMediaOverlay.
makes the player when the element starts. See KiteMediaOverlay.
the words of the controls. See KiteMediaOverlay.
what the elements share. See KiteMediaSession.
a name for the element that stays the same when its chapter is laid out again, under which session keeps where it stopped. Null keeps no place.