FLVPlayback VideoEvent.COMPLETE triggers before the video reaches the end, and the video stops playing

StackOverflow https://stackoverflow.com/questions/13865421

  •  07-12-2021
  •  | 
  •  

Question

import fl.video.*;
var player:FLVPlayback = new FLVPlayback();
addChild(player);
player.skin = "someSkin.swf";
player.source = "http://someDomian/some.flv";

Here's the code. I just load and play some flv from server, and when I test it via Flash (just press ctrl+enter), the video will stop at about 90% of the video and dispatch the COMPLETE event. Any one knows why? Try it again, the time where the video stops is the same, just about 90%. I searched it, and I tried to change playheadUpdateInterval of player, set totalTime explictly, or set bufferTime longer. All those solutions make no difference. I tried to load another movie from the same server, same problem. Any chances something wrong with the server?

EDIT: I sent the swf to someone else, and the video plays as it's supposed to do. Then another guy, and the same result. So, I guess there's something wrong with my settings? Is there some setting will cause this strange action? But when I tried it on my laptop, the video stops unexpectedly. Why this seems to work on everyone's computer except mine?

before CLOSE: Eventually my colleagues found the strange reason causes this problem, if changing the publish setting to FP10 & 10.1 or FP9, it'll work as we expect. FP10.2 and up, videos on that server seem not have the talent to find their ending. The videos are H.264/AAC, if I convert them to VP60/MP3, all the FP versions will work. Since I can't modify the setting about the codecs, I'll just change the publish setting and leave the codecs thing alone. Although I'm just frustrated by this, if you see this and so lucky that you happen to know the codecs thing why the "early complete" appears, please please tell me.

Was it helpful?

Solution

The problem could be with the .FLV file, sometimes there could be problems while encoding any video file(AVI,MOV,MP4,3GP,WMV) in to .FLV format that results in skipped frames. Try your code with some other .FLV file if that works good then you need to re-encode your FLV file.

You can also try capturing the video Complete Event by tracking the Video Playback Progress.

import fl.video.*;

var player:FLVPlayback = new FLVPlayback();
addChild(player);
player.skin = "someSkin.swf";
player.source = "http://someDomian/some.flv";

addEventListener(Event.ENTER_FRAME, enterFrameHandler);

function enterFrameHandler(event:Event):void {

    if(player.playheadPercentage>=99)
    {

      //On Video Playback Complete Actions here     
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top