videoflowplayer

Make Flowplayer always start from 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, if I click play and allow video to end, the next time(without page refresh) I play the video, it starts from start instead of first cue point.

I'd appreciate a hint or solution, how I can make the video always play from first cuepoint, without page refresh

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 :)


Solution

  • ok, after thinking for a bit found the solution. The idea is that after the video ends we just seek to the first cuepoint. Solved by adding only couple lines:

    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();
            };
          }).on("finish", function (e, api) {
            api.seek(parseInt(videoStartTime));
          });