A plugin for ABC's Odyssey Story Format that asks for user permission to play audio.
After the user gives permission, videos will automatically play and audio will fade between the videos as the page scrolls.
Originally developed for the 4 Corners Black Summer bushfires interactive.
This plugin depends on Odyssey.
The plugin works out of the box with standard Odyssey videos.
- Add the
odyssey-audio-visual-plugin
JavaScript to your article in CoreMedia (content id: 101718598). - Add
#audio-visual-plugin-mount
on its own line where you want the "enable audio" button to appear.
This should get you most of the way there.
Custom interactives like Ease Frame must opt in to allow the Odyssey Audio Visual Plugin to control the volume.
To do this:
- Add
class="oavp-video"
to a parent element for the<video>
. - Each
<video>
needs its own parent element.
The browser may permit playing audio even if the user hasn't explicitly given permission, so to be a good citizen you should check the current status before playing any audio.
There is a DOM-based API to check the current permission:
const isMuted = document.querySelector('[data-id="odyssey-audio-visual-plugin"')?.dataset?.muted !== 'false';
Note that if the plugin doesn't exist in the page, this code will always return false.
- Joshua Byrd ([email protected])
- Ash Kyd ([email protected])