Audio Player
Adding the Audio Playback Widget
Follow the steps given below to add the audio playback widget in your website.
Get Started
Step 1: Add the following HTML into the body section of your web application code to add the Audio Playback widget.
Note: Make sure data-widget is set to ‘true' as this applies the VIDIZMO default styling to the widget.
Call audio player methods
Step 2: Add the following method into the body section of your web application code by making a function inside the script tag to call widget methods. Sample methods can be seen in the following code:
function play() {
document.querySelector('.audio').play();
}
function pause() {
document.querySelector('.audio').pause();
}
Other available methods are listed below.
Listen to audio player events
Step 3: Add the following Script tag into the body section of your web application code to bind the events and see these events in the console.
document.querySelector('.audio').addEventListener('on-initializing',
evt => { });
document.querySelector('.audio').addEventListener('on-muted',
evt => { });
Other available events can be found below.
Input properties for Audio Playback Widget
Methods for Audio Playback Widget
Output Events for Audio Playback Widget
Interceptors
VIDIZMO lets widgets' consumers to intercept rendering pipeline and make changes in the data.
Sample Code - VIDIZMO Audio Playback Widget
<script type="text/javascript"
src="https:// test-5.beta.vidizmo.com/static/js/vidizmo-player/player.js">
</script>
<link rel="stylesheet"
href="https:// test-5.beta.vidizmo.com/static/compiled/widget/widgets.css" />
<script type="text/javascript"
src="https:// test-5.beta.vidizmo.com/static/compiled/widget/widgets.js">
</script>
<div>
<vdz-mashup-audio data-widget="true" id="101" mashup-id="169378"></vdz-mashup-audio>
</div>
<button onclick="play1()">play audio 1</button>
<button onclick="pause1()">pause audio 1</button>
<button onclick="mute1()">mute audio 1</button>
<button onclick="unmute1()">unmute audio 1</button>
<button onclick="getvolume1()">getVolume audio 1</button>
<button onclick="gofull1()">gofull audio 1</button>
<button onclick="gettime1()">gettime audio 1</button>
<button onclick="destroy1()">destroy audio 1</button>
<button onclick="seek1()">seek audio 1</button>
<button onclick="play2()">play audio 2</button>
<button onclick="pause2()">pause audio 2</button>
<script>
function play1() {
document.getElementById("101").play();
}
function pause1() {
document.getElementById("101").pause();;
}
function mute1() {
document.getElementById("101").mute();;
}
function unmute1() {
document.getElementById("101").unMute();;
}
function getvolume1() {
console.log(document.getElementById("101").volume());
}
function gofull1() {
document.getElementById("101").enterFullscreen();
}
function gettime1() {
console.log(document.getElementById("101").time());
}
function destroy1() {
document.getElementById("101").destroy();
}
function seek1() {
document.getElementById("101").seek(24);
}
function play2() {
document.getElementById("102").play();
}
function pause2() {
document.getElementById("102").pause();
}
</script>