TimGT
TimGT

Reputation: 43

Flowplayer pauses at different times with cuepoint

Good morning. I have a Flowplayer video with cuepoints ex [5, 10]. Here, my video starts from 5th second and pauses at 10th second. So it works. However, video sometimes pauses at 9th second and sometimes on 10th second. So it looks like a flowplayer bug.

I'd appreciate a hint or solution, how I can make the video always pause at exact time everytime.

here is the code snippet

flowplayer(flowplayerObject, {
        hlsjs: {
          xhrSetup: function (xhr) {
            xhr.withCredentials = true;
          }
        },
        swf: ------,
        swfHls: -------,
        clip: {
          cuepoints:[videoStartTime,videoEndTime],
          sources: [
            {type: "application/x-mpegURL", src: -------l},
            {type: "video/mp4", src: -------}
          ]
        }
      }).one("ready", function (e, api, video){
        api.seek(parseInt(videoStartTime));
      }).on("cuepoint", function (e, api, cuepoint) {
         if (cuepoint.index === 1) {
          api.pause();
        };
      }) ;

Thank you

Upvotes: 0

Views: 78

Answers (2)

TimGT
TimGT

Reputation: 43

Thanks for your answer ami91. This is what I got from flowplayer devevelopers:

There's a limit to the granularity of the progress event (for memory reasons) of 250ms which triggers the cuepoint events. The video you are using has a frame rate of 25 fps, so a cuepoint of 7.0s sits exactly on the frame boarder, and may therefore be trigger too early if the progress event triggering the cuepoint is below 125ms before 7.0. Setting the cuepoint a tiny bit later should have the desired effect. You won't get total precision because firing an event every 0.04 sec – or even more

So, I just added 0.5 sec to the end of the video.

Upvotes: 1

ami91
ami91

Reputation: 1354

I have not used the cuepoints feature of Flowplayer before, but I am familiar with the seek() API function where you specify the time (in seconds) in the video that you would like to seek to.

For the seek function to work properly, your video needs to have a keyframe at every second of the video. I have a feeling cuepoints would have the same requirement.

If you are familiar with ffmpeg, you can use the "force_key_frames" parameter like this way to add a keyframe to every second of the video -

ffmpeg -i input_file_location -force_key_frames "expr:gte(t,n_forced*1)" other_ffmpeg_parameters -y output_file_location

The downside to adding additional keyframes is that your video will occupy more space on the disk, but if you need the video to pause (or) start consistently at the times specified, I can't think of any other way using the HTML5 version of Flowplayer.

Upvotes: 1

Related Questions