Jump to content
Search Community

gotoVideoTime issue

alanpuccinelli test
Moderator Tag

Recommended Posts

First of all, thank you so much for all the time and effort you've put into this class!

 

I'm trying to replicate the experience of changing channels on a television with my video player and I'm running into an odd quirk. First of all, it seems if I ever attempt to go to a time in my videos when the video isn't playing at that moment the container appears to loose sync with the loaded asset. I say "loose sync" because the PLAY_PROGRESS still indicates that the stream is moving forward but the container doesn't update and there is no sound. I've tried waiting to send the gotoVideoTime call until complete, init, and buffer full and all seem to have the same effect. The only way I can seem to get it work is to build in a delay timer so that the gotoVideoTime call doesn't happen until about 200ms after the video starts playing. Here's a code sample of what I'm talking about:

 

import com.greensock.loading.*;
import com.greensock.loading.display.*;
import com.greensock.*;
import com.greensock.events.LoaderEvent;

//create a VideoLoader
var video:VideoLoader = new VideoLoader("videos/csi.flv", {name:"CSI", bufferMode:false, container:vidbox, width:400, height:300, scaleMode:"proportionalInside", bgColor:0x000000, autoPlay:false, volume:0.75, requireWithRoot:this.root, estimatedBytes:21093459, onComplete:completeHandler});
video.addEventListener(VideoLoader.PLAY_PROGRESS, updatePlayProgress);

//start loading
video.load();

function completeHandler(event:LoaderEvent):void {
 trace("load complete");
 video.gotoVideoTime(10,true);
}

function updatePlayProgress(event:LoaderEvent=null):void {
var time:Number = video.videoTime;
var minutes:String = force2Digits(int(time / 60));
var seconds:String = force2Digits(int(time % 60));
trace(minutes+":"+seconds);
}

function force2Digits(value:Number):String {
return (value < 10) ? "0" + String(value) : String(value);
}

 

 

if you change the 10 to a 0 in the gotoVideoTime call you can see that it will play just fine. What am I missing here?

Link to comment
Share on other sites

Hm, I can't seem to reproduce that issue - could you post a simple FLA along with the video so that I can publish it and immediately see the problem? Flash seems to have a hard time with certain types of videos in certain scenarios. I tried an FLV and it worked great for me every time. Never an audio problem - I used your code almost exactly.

 

You're using the latest version of the classes too, right?

Link to comment
Share on other sites

Sure, here's my file, and yes I'm using the latest version of the classes just downloaded them today. I've been trying to figure this out all afternoon and I'm going crazy with it. I've tried a few different FLV's but to be fair I did pull them all down from youtube. Not sure if there's something funky about the way they were encoded or not.

 

A few things for you to notice:

 

If the video starts off playing and then you skip using the buttons everything works fine. If you try to jump to a specific time once the load completes however... not so good. I did notice that the time keeps ticking by in my trace output as if the video were still playing but the container goes blank. Using the skip button while it's in this weird "playing but not playing state" will update a still image in the container but will not play once it's frozen. Some other things I've noticed too (you can see this too but uncommenting the traces in the updatePlayProgress function) The netStream.currentFPS drops to 0 and the bufferLength starts to increase.

 

What other events or tricks can I implement to better troubleshoot? I feel like I'm missing some key info about what's going on with the netstream. If anything it seems like the video container needs to be re-attached to the stream or something.

 

Thanks for taking a look.

Link to comment
Share on other sites

Thanks for posting the sample file(s). They actually helped identify a few more bugs in Adobe's NetStream class. After lots of testing and hacks, I discovered that if seek() is called before the NetStream dispatches a RENDER event, it will lose its audio. The video could completely finish downloading before the first RENDER event is dispatched (rare, but possible especially if you're running the video from your hard drive). And if pause() is called before the first RENDER event, the video won't render at all. On top of that, if you call a Video object's attachNetStream(null) method from within the NetStream's RENDER event handler, it will crash Flash Pro altogether! Yummy. Gotta love Flash bugs. Anyway, not to worry - that's one of the reasons it's a good idea to use LoaderMax instead of the built-in Adobe classes - I'm implementing workarounds for all this stuff so you don't have to deal with the bugs/hassles. I just posted an updated version of LoaderMax/VideoLoader that should solve these issues - please take a peek and let me know if things work well for you with the new version.

 

http://www.LoaderMax.com

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.
×
×
  • Create New...