Audio and Video
Audio macro syntax
The block audio macro enables you to embed audio streams into your documentation. You can embed self-hosted audio files that are supported by the browser.
The audio formats AsciiDoc supports is dictated by the output format, such as the formats supported by the browser when generating HTML.
While this was once a precarious ordeal, HTML 5 has brought sanity to audio support in the browser by adding a dedicated <audio>
element and by introducing several standard audio formats.
Those formats are now widely supported across browsers and systems.
For a canonical list of supported web audio formats and their interaction with modern browsers, see the Mozilla Developer Supported Media Formats documentation.
audio::ocean-waves.wav[]
You can control the audio settings using additional attributes on the macro.
For instance, you can offset the start time of playback using the start
attribute and enable autoplay using the autoplay
option.
audio::ocean-waves.wav[start=60,opts=autoplay]
You can include a caption above the audio using the title attribute.
.Take a zen moment
audio::ocean-waves.wav[]
Video macro syntax
The block video macro enables you to embed videos into your documentation. You can embed self-hosted videos or videos shared on popular video hosting sites such as Vimeo and YouTube.
The video formats AsciiDoc supports is dictated by the output format, such as the formats supported by the browser when generating HTML.
While this was once a precarious ordeal, HTML 5 has brought sanity to video support in the browser by adding a dedicated <video>
element and by introducing several standard video formats.
Those formats are now widely supported across browsers and systems.
For a canonical list of supported web video formats and their interaction with modern browsers, see the Mozilla Developer Supported Media Formats documentation.
video::video-file.mp4[]
You can control the video settings using additional attributes on the macro.
For instance, you can offset the start time of playback using the start
attribute and enable autoplay using the autoplay
option.
video::video-file.mp4[width=640,start=60,opts=autoplay]
You can include a caption on the video using the title attribute.
.A walkthrough of the product
video::video-file.mp4[]
Vimeo and YouTube videos
The video macro supports embedding videos from external video hosting services like Vimeo and YouTube. The AsciiDoc processor, specifically the converter, automatically generates the correct code to embed the video in the HTML output.
To use this feature, put the video ID in the macro target and the name of the hosting service in the first positional attribute.
video::67480300[vimeo]
video::RvRhUHTV_8k[youtube]
When embedding a YouTube video, you can specify a playlist to associate with the video using the list
attribute.
The playlist must be specified by its ID.
video::RvRhUHTV_8k[youtube,list=PLDitloyBcHOm49bxNhvGgg0f9NRZ5lSaP]
Instead of using the list
attribute, you can specify the ID of the playlist after the video ID in the target, separated by a slash.
video::RvRhUHTV_8k/PLDitloyBcHOm49bxNhvGgg0f9NRZ5lSaP[youtube]
Alternatively, you can create a dynamic, unnamed playlist by listing several additional video IDs in the playlist
attribute.
video::RvRhUHTV_8k[youtube,playlist="_SvwdK_HibQ,SGqg_ZzThDU"]
Instead of using the playlist
attribute, you can create a dynamic, unnamed playlist by listing several video IDs in the target separated by a comma.
video::RvRhUHTV_8k,_SvwdK_HibQ,SGqg_ZzThDU[youtube]
Audio and video attributes and options
Attribute | Value(s) | Example Syntax | Notes |
---|---|---|---|
|
User defined text |
|
|
|
User-defined playback start time in seconds. |
|
|
|
User-defined playback end time in seconds. |
|
|
|
|
|
The controls value is enabled by default |
Attribute | Value(s) | Example Syntax | Notes |
---|---|---|---|
|
User defined text |
|
|
|
A URL to an image to show until the user plays or seeks. |
|
Can be specified as the first positional (unnamed) attribute.
Also used to specify the service when referring to a video hosted on Vimeo ( |
|
User-defined size in pixels. |
|
Can be specified as the second positional (unnamed) attribute. |
|
User-defined size in pixels. |
|
Can be specified as the third positional (unnamed) attribute. |
|
User-defined playback start time in seconds. |
|
|
|
User-defined playback end time in seconds. |
|
|
|
The YouTube theme to use for the frame. |
|
Valid values are |
|
The language used in the YouTube frame. |
|
A BCP 47 language tag (typically a two-letter language code, like |
|
The ID of a playlist to associate with a YouTube video. |
|
Only applies to YouTube videos. |
|
Additional video IDs to create a dynamic YouTube playlist. |
|
IDs must be separated by commas. Therefore, the value must be enclosed in double quotes. Only applies to YouTube videos. |
|
|
|
The controls are enabled by default.
The |