1

I generated cue points in the BrightCove video. How can I use those cue points to start at that point and stop before the next cue point?

idevelop
  • 21
  • 2

2 Answers2

0

I too was looking for a way to set the start time of brightcove video. Unfortunately their docs are lacking any information regarding this. Instead, I had luck when searching for videojs start time or seek which provided me with documentation describing the currentTime() function -- this allowed me to set the start time of a video like so:

videojs('myPlayerID').on('loadedmetadata', function() {
    var myPlayer = this;
    var startTime = 6; //seconds

    myPlayer.currentTime(startTime);
    myPlayer.play();
}
jaegs
  • 489
  • 6
  • 15
0

Let your video is of length 20 seconds. you want to start at 5 and end at 15. then you should write as below in your method.

const player = videojs.getPlayer("myPlayerID");
const startTime = 5;
const endTime = 15;

player.currentTime(); // gives how much content is played in seconds

player.currentTime(startTime); // setting player current time at 5

player.play(); // Trigger play method after setting the currentTime

// To pause at specific time
let interval = setInterval(()=>{
  let currentTime = player.currentTime();
  if(currentTime > endTime){
    player.pause();
    clearInterval(interval)
  }
},1000)

https://docs.brightcove.com/brightcove-player/1.x/Player.html#currenttime-seconds-

Abhishek Kumar
  • 820
  • 10
  • 18