INPUT /  OUTPUT /  LANGUAGE





audio, video tags

Presentation tag

Creates and displays (where applicable) a multimedia player in the console capable of playing audio or video.

Sample usage

Fields

Primary field

Scalar field

Contains binary file data of a complete well-formed media file in a supported format.

Supported media formats include:

Media typeFormatMIME type
audio 🔊 MP3 audio/mpeg
audio 🔊 WAV audio/wav
audio 🔊 OGG audio/ogg
audio 🔊 AAC audio/mp4
video 📺 MP4 video/mp4
video 📺 WebM video/webm
video 📺 OGG video/ogg

Secondary fields

Behaviour

The audio tag is similar to the video tag except it has no visible display on the screen unless the controls field is set to true.

When the media file is given as one block of raw data, playback can start before all of the data has arrived, and onReady may come while the rest is still being received. When it is sent in pieces with .push, playback can start only after .commit.

Media files should be kept small to respect the user's limited memory resources and ensure quick loading times. In cases where long audio needs to be played, one way to achieve this is to split the audio into self-contained playable segments, switching playback between audio tags when required, where one audio tag has the audio segment currently being played and the other audio tag pre-buffers the next segment of audio to be played when the current segment finishes. This approach might require an elaborate implementation depending on how much user interaction is required.

For larger video media, it is both resource-intensive and wasteful to load the entire video into the tag at once. An efficient approach is to have the media pre-split into segments. Once the first segment has been loaded into the video element, the segment can begin to play while the next segement is being buffered into a scalar element. The new segment data can then be assigned to the media element when it is necessary to transition to the next part of the video. If the next required segment is not ready yet (or the user has jumped to a point in the video that falls within an unbuffered segment) some manner of 'buffering' indicator should ideally be displayed to remind the user to be patient.

See also