Jump to content
GreenSock

AntB90

VideoLoader duration tracing out as 0 although buffer full

Recommended Posts

Hey, 

 

I'm trying to simply load a video and get it's duration. The video does load correctly and plays but video.duration is tracing out as 0. I also tried onComplete but again the duration traces out as 0.

video = new VideoLoader(filePath, {name:"video", container:scope.videoHolder_mc, x:5, y:5, width:640, height:480, scaleMode:"proportionalInside", bgColor:0x000000, autoPlay:false, requireWithRoot:mainScope.root});//, onComplete:completeHandler});

video.addEventListener(VideoLoader.VIDEO_BUFFER_FULL, bufferFullHandler);
video.load();
 
function bufferFullHandler(e:LoaderEvent):void {
trace("video.duration: " + video.duration);
}

Thanks in advamce.

Link to comment
Share on other sites

The way videos load in Flash is a bit odd/frustrating - the metadata doesn't come in for a while sometimes, so when the buffer is full it may still not be there. Also, it's very dependent on the encoding software you used for your video (it is supposed to be injected properly). So it may be a problem with the way your video is encoded. Have you tried checking the duration after a while? Is it ever accurate (even after it has fully loaded)? 

Link to comment
Share on other sites

Hey, thank you for your reply.

 

I've loaded in a 10 second video and given it over 5 minutes to load just to check if the metadata was there but this isn't the case. I am converting the video to .flv with ffmpeg beforehand so that the software can play any video format and guess this may be causing the metadata to be lost. Any idea on how I can get around this or is it something I will have to solve with ffmpeg?

Link to comment
Share on other sites

Yep, that sure sounds like a problem with the way you're encoding. Maybe try using Adobe's software for encoding if you can. Other than that, I'm not entirely sure what to suggest to ensure that the metadata is properly injected. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×