While loading FLV videos using FLVPlayback Component 2.5 in Flash, when I tried to navigate to the “cue” point I had created using AS3 cue point object,
flvPlayer.seekToNavCuePoint("cp1");
It failed with following error:
VideoError: 1003: Invalid seek at fl.video::FLVPlayback/seekToNavCuePoint() at Function/<anonymous>() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at fl.video::FLVPlayback/http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::setState() at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::finishAutoResize() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick()
The solution to locate the Cue Point is using findCuePoint() method, which returns an associative array of the cue point and then get the value of “time”. You can do a seek in the flv video using following code:
flvPlayer.seek(flvPlayer.findCuePoint("cp1", CuePointType.ACTIONSCRIPT)["time"]);
Since creating cue points using ActionScript and then seeking and jumping to the specific time in the FLV Video is a bit tricky, it would not be out of place if I post my working code here for reference. So here is the complete example:
import fl.video.*; // Requires an FLVPlayback instance called flvPlayer on Stage flvPlayer.source = "sample-video.flv"; // add some AS cue points using time and name parameters flvPlayer.addASCuePoint(0.524, "ASpt1"); flvPlayer.addASCuePoint(2, "ASpt2"); flvPlayer.addASCuePoint(3.75, "ASpt3"); flvPlayer.addASCuePoint(5.57, "ASpt4"); flvPlayer.addEventListener(VideoEvent.READY, jumpToCuePoint); function jumpToCuePoint(evt:VideoEvent):void{ //this will do a seek flvPlayer.seek(flvPlayer.findCuePoint("ASpt4", CuePointType.ACTIONSCRIPT)["time"]); }
Hope that helps.
Cheers!
This did not work for me in Animate CC 2017. The line:
flvPlayer.addEventListener(VideoEvent.READY, jumpToCuePoint);
throws an error:
Access of possibly undefined property READY through a reference of static type Class
I saw online to perhaps address the full path to the video event:
flvPlayer.addEventListener(fl.video.VideoEvent.READY, jumpToCuePoint);
and
flvPlayer.seek(flvPlayer.findCuePoint(“ASpt3”, CuePointType.ACTIONSCRIPT)[“time”])
but, although this gives no errors, the video fails to play.