Site Building
Audio & Video formatting for the Web
Browser-compatible MP3 files can be generated by any number of different programs, like Audacity or Music.app.
Video can be more complex. Even if a video has the correct MP4 file extension it may still not be using the correct video codec. If your video works in one browser but doesn’t play in others, it is likely not using the H264 codec. Additionally, many applications that generate correctly-formatted video files will make them overly large, causing slow loading and performance issues in your site. We recommend Handbrake for generating size-efficient and web-compatible videos. When in doubt, Handbrake’s default preset works well.
Autoplaying with audio is not supported by browsers: video can autoplay as long as it is muted.
Audio
Look for audio-player inside your CSS to configure the fonts and styling of the player interface. You can use a number of CSS variables to control other aspects of the audio player.
For example, you can insert text into the play/pause button by changing text inside the --play-text and --pause-text variables. Increase the width of the button to accommodate that change:
audio-player::part(button) {
--icon-color: rgba(0, 0, 0, 0.85);
--icon-size: 32%;
--play-text: 'Play';
--pause-text: 'Pause';
width: 6em;
display: inline-flex;
justify-content: center;
cursor: pointer;
}
Hide the default play and pause icons with a display property:
audio-player::part(play-icon) {
display:none;
}
audio-player::part(pause-icon) {
display:none;
}
Or, if you want to keep the icon visible next to the text, add padding to the right side of the icon to add some distance between the two:
audio-player::part(play-icon) {
padding-right: 1em;
padding-left: 0.6em;
}
audio-player::part(pause-icon) {
padding-right: 1em;
padding-left: 0.6em;
}
Video
There are two main video interfaces to choose from: A transparent interface that consists of a clickable poster frame image, and the browser default with a visible timeline. If you choose a poster image, it will display when the video is not playing.
Embed from Vimeo and YouTube
Add Vimeo and YouTube embeds by pasting their URLs or embed codes directly into the page. These will display with their default branded interface if you choose the “browser default” option in their settings.