All audio and video are embedded in XHTML documents using standard HTML5.
When sending books with embedded audio or video content, keep the following in mind:
The maximum file size for the .zip
file is 2GB. The larger the file is, the longer it takes for a consumer to download your book.
Keep audio and video content to a minimum to avoid long download times.
All audio files need to be the same sample rate.
It may take longer for your book to appear on Apple Books because the files need to be checked by Apple for quality control purposes.
Note that audio and video files do not have DRM applied in the final book, regardless of contract or the metadata; however, DRM is applied to the text in the book.
Fallback video content is not currently supported. All video must be either HEVC (High Efficiency Video Coding) in an MPEG-4 container or H.264 in an MPEG-4 container.
Important: Make sure you specify the correct media-type
for your audio files in the OPF. For example, the expected media-type
for m4a files is "audio/m4a"
). If the media-type
is incorrect, the audio won’t play after customers have purchased the book. This issue won’t be evident when testing locally prior to delivering to Apple Books.
For optimal user experience, audio and video content should appear on its own line in the EPUB and be centered on the page using text-align:center
defined in the CSS. Apple Books provides default dimensions for audio and video. The standard video pane dimensions are a 1:2 ratio and display at 300px wide by 150px tall on the iPad. However, the width can also be defined using CSS, ideally as a percentage of the screen width. Apple Books ensures that video and audio fit on a page, no matter the screen size. To avoid layout issues, do not set an explicit height on video elements.
Note: To enable readers to revisit embedded media, Apple recommends that you provide entries in the Table of Content that point to media.
Refer to the EPUB example that is available on the Support page for Apple Books.
Embed videos or audio using standard HTML5 tags:
video src="video/H264-640x480.m4v" controls="controls" poster="images/posterimage.jpg"/>
<audio src="audio/loop.m4a" controls="controls"/>
Note that the video tag must include the required poster image. The customer sees the poster image in the text and clicks the image to start the video. The controls
attribute allows readers to play, pause, and scrub the media. The autoplay
attribute automatically starts playing the audio or video without stopping. The controls
and autoplay
attributes are boolean. Including them activates the attribute no matter their value. For example, autoplay="false"
is the same as autoplay="true"
. Note that although autoplay
is supported, Apple recommends that it not be used. It is best to allow readers to control their own reading experience as they know the environment in which they are reading.
The following two examples show how to embed audio and video content in the EPUB, followed by a screenshot of how the audio and video would appear on the device:
<h3>Below is an embedded audio file.</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<audio src="audio/loop.m4a" controls="controls"/>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<h3>Below is an embedded video file.</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<video src="video/H264-640x480.m4v" controls="controls" poster="images/posterimage.jpg" />
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>