<div class="vimeo-video" data-behavior="vimeo-video" data-video-id="584907375">
<div class="vimeo-video__player-wrap">
<div id="vimeo-player" class="vimeo-video-player"></div>
</div>
<div>
<a class="cta cta--primary play-btn">Play</a>
<a class="cta cta--primary pause-btn">pause</a>
<a class="cta cta--primary mute-btn">Mute</a>
<a class="cta cta--primary unmute-btn">UnMute</a>
</div>
</div>
No notes defined.
/* No context defined. */
import Player from '@vimeo/player';
export default parentElement => {
const { videoId } = parentElement.dataset;
const playButton = parentElement.querySelector('.play-btn');
const muteButton = parentElement.querySelector('.mute-btn');
const pauseButton = parentElement.querySelector('.pause-btn');
const unmuteButton = parentElement.querySelector('.unmute-btn');
const player = new Player('vimeo-player', {
id: videoId,
autoplay: 1,
muted: 1,
title: 0,
sidedock: 0,
controls: 0,
});
playButton.addEventListener('click', () => {
player.play();
});
pauseButton.addEventListener('click', () => {
player.pause();
});
muteButton.addEventListener('click', () => {
player.setVolume(0);
});
unmuteButton.addEventListener('click', () => {
player.setVolume(1);
});
};
<div class="vimeo-video" data-behavior="vimeo-video" data-video-id="584907375">
<div class="vimeo-video__player-wrap">
<div id="vimeo-player" class="vimeo-video-player"></div>
</div>
<div>
<a class="cta cta--primary play-btn">Play</a>
<a class="cta cta--primary pause-btn">pause</a>
<a class="cta cta--primary mute-btn">Mute</a>
<a class="cta cta--primary unmute-btn">UnMute</a>
</div>
</div>