<div>
<video id="my-video" class="video-js" width="320" height="180" controls preload="auto" data-setup='{}'>
<source src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type="video/mp4" />
</video>
</div>
<p id="video-status">The video is ready.</p>
<div class="button-container">
<button onclick="play()">PLAY</button>
<button onclick="pause()">PAUSE</button>
<button onclick="setVolume()">VOLUME 0.5</button>
<div>
var player = videojs('my-video', {
controls: true
});
const play = () => {
player.play();
}
const pause = () => {
player.pause();
}
const setVolume = ()=> {
player.volume(0.5);
}
player.on('play', function() {
document.getElementById('video-status').innerText = 'The video is playing.'
});
player.on('pause', function() {
document.getElementById('video-status').innerText = 'The video is pausing.'
});