Skip to main content
All CollectionsAdvanced Use-Cases
Display Content On a Page Via Video Trigger
Display Content On a Page Via Video Trigger

Using the API you can display content on your page when your video reaches a certain time

Updated over a week ago

You may want to display content on your page when a video reaches a certain point.

For example, you can show a "Buy Now" button at the end of sales video. Or show some sort of quiz/evaluation for students at the end of a lesson.

Here is an example of code you can use with an example video:

<script src="https://spotlightrteam.cdn.spotlightr.com/assets/spotlightr.js"></script><iframe allow="autoplay" class="video-player-container spotlightr" data-playerid="MTI5MTg2OA==" allowtransparency="true" style="max-width:100%" name="videoPlayerframe" allowfullscreen="true" src="https://spotlightrteam.cdn.spotlightr.com/watch/MTI5MTg2OA==" watch-type="" url-params="" frameborder="0" scrolling="no"> </iframe>

<div id="hidden" style="display: none; background:yellow; font-size:3em"> this is hidden until second 3</div>


<script>
document.addEventListener('vooPlayerReady', vooPlayerReady, false);
function vooPlayerReady(event){
vooAPI("MTI5MTg2OA==", 'getTime', ['3'], getTime);
}
function getTime(time){
console.log("[vp]getTime",time);
document.querySelector("#hidden").style.display = "block";

}
</script>

Did this answer your question?