Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Gamebytes

Pseudo Streaming a MP4

Recommended Posts

Hi,

 

I'm trying to use the VideoLoader to pseudo stream some of my content. I'm loading the new content using ?start=#. It works perfectly only I don't get a event dispatched when the buffer runs out which is pretty annoying.

 

I just can't get it to work :(

 

(I'm using server software for pseudo streaming: http://h264.code-shop.com/trac )

 

VideoLoader init/settings


settings.width = this._width;
settings.height = this._height;
settings.autoPlay = false;
settings.scaleMode = 'proportionalInside';
settings.volume = _savedSettings.data.videoVolume;
settings.allowMalformedURL = true;
settings.checkPolicyFile = true;
settings.bgColor = 0X000000;
settings.alpha = 1;
settings.autoAdjustBuffer = true;
settings.noCache = true;
settings.name = 'videoPlayer';


if( _streamMode == VideoPlayer.PSEUDO_STREAM )
{
_videoLoaderSettings.bufferMode = true;
url_ = url_ +'?start=0';
}
else
{
_videoLoaderSettings.bufferMode = false;
}


_videoLoader = new VideoLoader( url_, _videoLoaderSettings );

_videoLoader.addEventListener( VideoLoader.VIDEO_PLAY, handleVideoLoaderStatus );
_videoLoader.addEventListener( VideoLoader.VIDEO_PAUSE, handleVideoLoaderStatus );
_videoLoader.addEventListener( VideoLoader.VIDEO_COMPLETE, handleVideoLoaderStatus );

_videoLoader.addEventListener( VideoLoader.VIDEO_BUFFER_EMPTY, handleVideoLoaderStatus );
_videoLoader.addEventListener( VideoLoader.VIDEO_BUFFER_FULL, handleVideoLoaderStatus );

 

VideoLoader seek code

_videoLoader.url =  _videoData.video +'?start='+ _time;
_videoLoader.load(true);
_videoLoader.playVideo();

 

This works perfectly but when the buffer gets emptied no LoaderEvent gets dispatched. Or in some cases when bufferMode set to false bufferEmpty get dispatched and like 100ms later bufferFull get's dispatched (video hangs until truely buffered).

 

What i've tried and didn't work:

- setting bufferMode to false

- autoAdjustBuffer set to false

- without flushing the content

- without the noCache parameter

- calling auditSize() manually

Edited by Gamebytes
Link to comment
Share on other sites

Hmm...the "pseudo streaming" has me a little nervous. Are you trying to do some server-side magic to spit back a custom video file based on the request's "start" parameter that starts at the specified time on-the-fly? I wonder if the server isn't correctly encoding things or sending the correct metadata with the video file. Keep in mind that VideoLoader is NOT meant to do true streaming (nor should it since the whole idea behind the LoaderMax system is to manage progressive loads). Flash can be pretty picky in terms of video files, their encoding, meta data, etc.

 

We can't really help much with the server-side stuff nor can we support pseudo streaming, but if you still need help please post a set of files (as simple as possible - not your full production files) that we can publish on our end to clearly see the problem reproduced.

Link to comment
Share on other sites

Hi,

 

Thanks for your reply! I tried to narrow down the problem and think i've found the problem. I will first explain with i'm doing here so you can replicate it.

 

I'm using SpeedLimit for OSX to throttle the bandwidth to the server where the video file is hosted.

 

----------

Situation 1:

SpeedLimit set to 1572kbps (around 197kB/s)

bufferMode set to true .

autoAdjustBuffer to false.

 

When the buffer runs out the bufferEmpty event doesn't get fired.

 

Situation 2:

SpeedLimit set to 1572kbps (around 197kB/s)

bufferMode set to false.

autoAdjustBuffer to false

 

When the buffer runs out the bufferEmpty does get fired.

 

Situation 3:

These settings i'm using to pseudo stream.

 

bufferMode to false

autoAdjustBuffer to true

 

I throttle the speed to 1572k let the buffer run out and the buffer gets fired! Then VideoLoader is auto-adjusting it's buffer. When I see the buffer filling up I wait for the video to play and then switch quickly to 384k (around 48kB/s). While the video is playing and the buffer eventually runs out it doesn't dispatch anymore a bufferEmpty.

----------

 

I think the problem is at the autoAdjustBuffer setting. When i'm pseudo streaming (the server indeed spits out segments of the video file). And load it's new file it doesn't recalibrate it's buffer correctly or something and when it runs out again it won't fire a bufferEmpty.

 

So problem still unsolved ;). I've created a sample video player with seek functions I hope you can reproduce this problem.

 

Thanks in advance!

 

Greensock-VideoLoader (Attachment)

Link to comment
Share on other sites

A few questions:

 

1) Are you using the latest version of LoaderMax/VideoLoader?

 

2) Does the NetStream instance dispatch a NetStatusEvent with the code "NetStream.Buffer.Empty"? If not, it's a problem with the NetStream class itself (from Adobe) and I'm doubtful we could do anything to fix that.

Link to comment
Share on other sites

Okay, I did identify an issue that could affect the BUFFER_EMPTY functionality when bufferMode is true. That is fixed in the latest version. I also tweaked a few other minor things - would you mind downloading the latest version, giving it a shot, and letting us know if it resolves the issue you posted about? http://www.greensock.com/loadermax/

Link to comment
Share on other sites

Hi,

 

I've downloaded the updated version of LoaderMax. When I set bufferMode to true VideoLoader doesn't dispatch a BUFFER_FULL or BUFFER_EMPTY.

 

When I add listeners directly to the NetStream object I do recieve Buffer.Empty and Buffer.Full events.

 

I've done several test without seeking and one test with seeking.

 

Here are my test setups (these test are without seeking):

 

LoaderEvent BUFFER_FULL get's fired only once.

--------- VideoLoader Settings ---------
scaleMode=proportionalInside
height=720
noCache=true
autoPlay=false
width=1280
checkPolicyFile=false
autoAdjustBuffer=false <----------------------------
volume=1
allowMalformedURL=true
bufferMode=true <----------------------------
bgColor=0
--------- VideoLoader Settings ---------
1344505431.293 : *** LoaderEvent:videoPlay got dispatched.
1344505431.294 : --- NetStream Event:NetStream.Play.Start got dispatched.
1344505438.887 : *** LoaderEvent:videoBufferFull got dispatched.
1344505438.945 : *** LoaderEvent:init got dispatched.
1344505438.945 : --- NetStream Event:NetStream.Buffer.Full got dispatched.
1344505448.025 : --- NetStream Event:NetStream.Buffer.Empty got dispatched.
1344505452.092 : --- NetStream Event:NetStream.Buffer.Full got dispatched.
1344505512.059 : --- NetStream Event:NetStream.Buffer.Empty got dispatched.
1344505520.592 : --- NetStream Event:NetStream.Buffer.Full got dispatched.

 

With these setting (bufferMode: true) and autoAdjustBuffer set to true. it doesn't adjust the buffer.

--------- VideoLoader Settings ---------
scaleMode=proportionalInside
height=720
noCache=true
autoPlay=false
width=1280
checkPolicyFile=false
autoAdjustBuffer=true <----------------------------
volume=1
allowMalformedURL=true
bufferMode=true <----------------------------
bgColor=0
--------- VideoLoader Settings ---------
1344505614.641 : *** LoaderEvent:videoPlay got dispatched.
1344505614.641 : --- NetStream Event:NetStream.Play.Start got dispatched.
1344505622.343 : *** LoaderEvent:videoBufferFull got dispatched.
1344505622.343 : --- NetStream Event:NetStream.Buffer.Full got dispatched.
1344505622.427 : *** LoaderEvent:init got dispatched.
1344505631.543 : --- NetStream Event:NetStream.Buffer.Empty got dispatched.
1344505642.576 : --- NetStream Event:NetStream.Buffer.Full got dispatched.
1344505651.509 : --- NetStream Event:NetStream.Buffer.Empty got dispatched.

 

This seems to work properly.

--------- VideoLoader Settings ---------
scaleMode=proportionalInside
height=720
noCache=true
autoPlay=false
width=1280
checkPolicyFile=false
autoAdjustBuffer=false <----------------------------
volume=1
allowMalformedURL=true
bufferMode=false <----------------------------
bgColor=0
--------- VideoLoader Settings ---------

1344505875.98 : *** LoaderEvent:videoPlay got dispatched.
1344505875.981 : --- NetStream Event:NetStream.Play.Start got dispatched.
1344505883.66 : *** LoaderEvent:videoBufferFull got dispatched.
1344505883.66 : --- NetStream Event:NetStream.Buffer.Full got dispatched.
1344505883.744 : *** LoaderEvent:init got dispatched.
1344505892.859 : *** LoaderEvent:videoBufferEmpty got dispatched.
1344505892.86 : --- NetStream Event:NetStream.Buffer.Empty got dispatched.
1344505903.926 : *** LoaderEvent:videoBufferFull got dispatched.
1344505903.926 : --- NetStream Event:NetStream.Buffer.Full got dispatched.
1344505912.36 : *** LoaderEvent:videoBufferEmpty got dispatched.
1344505912.36 : --- NetStream Event:NetStream.Buffer.Empty got dispatched.

 

This works nicely but no LoaderEvents get's dispatched with these settings.


--------- VideoLoader Settings ---------
scaleMode=proportionalInside
height=720
noCache=true
autoPlay=false
width=1280
checkPolicyFile=false
autoAdjustBuffer=true <----------------------------
volume=1
allowMalformedURL=true
bufferMode=false <----------------------------
bgColor=0
--------- VideoLoader Settings ---------
[sWF] Users:jesse:Projects:Greensock-VideoLoader:bin-debug:Main.swf - 60,972 bytes after decompression
1344506047.397 : *** LoaderEvent:videoPlay got dispatched.
1344506047.397 : --- NetStream Event:NetStream.Play.Start got dispatched.
1344506055.092 : *** LoaderEvent:videoBufferFull got dispatched.
1344506055.093 : --- NetStream Event:NetStream.Buffer.Full got dispatched.
1344506055.194 : *** LoaderEvent:init got dispatched.
1344506064.325 : *** LoaderEvent:videoBufferEmpty got dispatched.
1344506064.326 : --- NetStream Event:NetStream.Buffer.Empty got dispatched.
1344506081.027 : *** LoaderEvent:videoBufferFull got dispatched.
1344506081.093 : --- NetStream Event:NetStream.Buffer.Full got dispatched.
1344506206.392 : --- NetStream Event:NetStream.Buffer.Empty got dispatched.
1344506221.562 : --- NetStream Event:NetStream.Buffer.Full got dispatched.

 

----------------

 

Test with seeking (pseudo) using the last settings.

 

First I let the buffer run out normally NetStream events get fired as expected. After seeking no NetStream events get fired (seems like the original NetStream object is destroyed?). The loaderEvents are still firing their events correctly. After it auto adjusts the buffer and the buffer runs out even LoaderEvents don't get dispatched anymore.

 



--------- VideoLoader Settings ---------
scaleMode=proportionalInside
height=720
noCache=true
autoPlay=false
width=1280
checkPolicyFile=false
autoAdjustBuffer=true <----------------------------
volume=1
allowMalformedURL=true
bufferMode=false <----------------------------
bgColor=0
--------- VideoLoader Settings ---------
[sWF] Users:jesse:Projects:Greensock-VideoLoader:bin-debug:Main.swf - 60,972 bytes after decompression
1344506539.744 : *** LoaderEvent:videoPlay got dispatched.
1344506539.744 : --- NetStream Event:NetStream.Play.Start got dispatched.
1344506539.777 : *** LoaderEvent:init got dispatched.
1344506546.287 : *** LoaderEvent:videoBufferFull got dispatched.
1344506546.29 : --- NetStream Event:NetStream.Buffer.Full got dispatched.
1344506557.942 : *** LoaderEvent:videoPlay got dispatched.
1344506558.274 : *** LoaderEvent:videoBufferFull got dispatched.
1344506558.282 : *** LoaderEvent:init got dispatched.
1344506566.575 : *** LoaderEvent:videoPlay got dispatched.
1344506566.61 : *** LoaderEvent:init got dispatched.
1344506596.546 : *** LoaderEvent:videoBufferFull got dispatched.
1344506602.542 : *** LoaderEvent:videoBufferEmpty got dispatched.
1344506618.877 : *** LoaderEvent:videoBufferFull got dispatched.

 

I've tried to dive into the LoaderMax source but it takes some time to figure out how everything is linked together. I hope my testing helps you out!

 

Thank you in advance!

 

[VideoLoader using the settings for the last pseudo test]

Greensock-VideoLoader-test2 (Attachment)

 

I Forgot to mention when the buffer runs out on my first test it didn't start playing again.

I worked around this problem by executing the method playVideo when BUFFER_FULL is fired.

Edited by Gamebytes
Link to comment
Share on other sites

I'm going on a short vacation I will come back on the issue!

Link to comment
Share on other sites

Are you absolutely sure that you replaced your files with the latest version? I wonder if you need to clear your ASO files or something. I tried your new test file and got perfect results every time. Would you mind trying again with the latest version of all the files after clearing your ASO files? Maybe even try publishing on a different system altogether just to see if that makes a difference?

 

By the way, thank you for providing a set of files that makes it pretty easy to publish and see what's going on. Very helpful indeed. I just wish I could reproduce the issue on my end. :(

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.
×