To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flex and AIR

Reply
 
Thread Tools Display Modes
Old 10-05-2002, 09:29 PM   #1
rborg
Junior Member
 
Join Date: Sep 2002
Posts: 16
Buffering FLV videos.

Has ANYONE made any use of the buffering functions of FCS?
I posted my problem a couple weeks ago but nobody replied.
I cant get the playback to resume properly after the buffer is exhausted, then filled again.
rborg is offline   Reply With Quote
Old 10-06-2002, 04:57 AM   #2
Somar
Senior Member
 
Join Date: Apr 2001
Posts: 190
I have no idea, but I'm guessing this could help you out:

http://www.macromedia.com/desdev/mx/.../odopod05.html

Later,
Somar!
Somar is offline   Reply With Quote
Old 11-08-2002, 05:01 PM   #3
rborg
Junior Member
 
Join Date: Sep 2002
Posts: 16
has anyone tried that Odopod example. i dont think it works properly.
i guess its not really an example...anyone know?
Some of you *must* have made a video player that lets you fast forward and rebuffer and start playing again.
Maybe not...what stage are all of you at in using FCS?
It seems terribly easy to do something big with CFMX, FRemoting and FCS. Anyone working on something good?
rborg is offline   Reply With Quote
Old 11-20-2002, 09:41 AM   #4
Hoolio
Member
 
Join Date: Aug 2000
Posts: 58
Buffering the video

I have succesfully done this without much hassel. The Odopod example has some typos in it as well as some structural things that don't work. I think the article was just written quickly and without many quality checks. I have attatched some code that may help out:

serverName="rtmp://prv-flash"; // create connection to server
videoToLoad="corp"; // name of the video to load
totalBuffer=1; // total buffertime
endtime=150; // this is the total number of seconds of the video

nc = new NetConnection();
nc.connect(serverName+"/mxpresentation");

nc.onStatus = function(returnObj) {
// this function checks connection status
if (returnObj.code == "NetConnection.Connect.Success") {
startVideo();
} else if (returnObj.code == "NetConnection.Connect.Rejected") {
gotoAndStop("server busy");
nc.onStatus=null;
} else if (returnObj.code == "NetConnection.Connect.Closed") {
gotoAndStop("closed connection");
}
};
function startVideo() { // function to start video
myInputStream = new NetStream(nc);
vidBoxPlay.attachVideo(myInputStream);
myInputStream.setBufferTime(totalBuffer);
myInputStream.play(videoToLoad);
myInputStream.onStatus = function (infoObject) {
if (infoObject.code == "NetStream.Play.Start" || infoObject.code == "NetStream.Buffer.Empty") {
// below checks for the stream to end or buffer
if (myInputStream.time<endtime) {
buffer_mc._visible=1;
isBuffering = 1;
}else if(myInputStream.time >= endtime) play()
} else if (infoObject.code == "NetStream.Buffer.Full") {
isBuffering =0;
}
}
}
// this returns the percent buffered so that it can
// be displayed graphically
function bufferStatus () {
if (isBuffering){
currentBuffer=myInputStream.bufferLength;
bufferPercent=currentBuffer/totalBuffer;
if (bufferPercent > 1) bufferPercent =1, buffer_mc._visible=0
buffer_mc.bar_mc._xscale=bufferPercent*100;
}
}
pause_btn.onRelease=function (){pauseMovie()} // pauses the movie
play_btn.onRelease=function(){playMovie()} // plays the movie
function pauseMovie () {
myInputStream.pause(true);
}
function playMovie () {
myInputStream.pause(false);
}


Well that's it. If you want it to fastforward and the like you can easily set it to seek to a specific place in your video. I didn't need to with this example but you get the idea.
__________________
Jake Hilton
Hoolio is offline   Reply With Quote
Old 11-20-2002, 11:30 AM   #5
rborg
Junior Member
 
Join Date: Sep 2002
Posts: 16
did you experience the problem that i spoke of? when you tested the rebuffering does it start again properly?
i had tried my own code...found Odopod's...which was pretty much the same (i mean the buffering event handler)...i fixed the things that were missing and the slight errors.
have you tested this extensively?
I still had the rebuffering problem.
rborg is offline   Reply With Quote
Old 11-20-2002, 02:22 PM   #6
Hoolio
Member
 
Join Date: Aug 2000
Posts: 58
I haven't had any problems with it restarting. It has been working well for me... sorry.
__________________
Jake Hilton
Hoolio is offline   Reply With Quote
Old 12-02-2002, 11:59 AM   #7
JHarlequin
Senior Member
 
Join Date: Sep 2001
Location: Manhattan
Posts: 398
I am getting errors with your code. It looks like it is this line of code that is causing the problem but I don't know what you were trying to write.

Code:
if (myInputStream.time buffer_mc._visible=1;
Thanks for the help
__________________
JA
JHarlequin is offline   Reply With Quote
Old 12-02-2002, 06:34 PM   #8
Hoolio
Member
 
Join Date: Aug 2000
Posts: 58
Ok.. one more try :-)

That if statement should have been this:

if (myInputStream.time < endtime) {


when I cut and pasted it into the window it got rid of my code.

Here it is again:

// create connection to server
serverName="rtmp://flash.server.com";
videoToLoad="corp";
totalBuffer=1;
endtime=150;
nc = new NetConnection();
nc.connect(serverName+"/mxpresentation");

nc.onStatus = function(returnObj) {
if (returnObj.code == "NetConnection.Connect.Success") {
startVideo();
} else if (returnObj.code == "NetConnection.Connect.Rejected") {
gotoAndStop("server busy");
nc.onStatus=null;
} else if (returnObj.code == "NetConnection.Connect.Closed") {
gotoAndStop("closed connection");
}
};
function startVideo() {
myInputStream = new NetStream(nc);
vidBoxPlay.attachVideo(myInputStream);
myInputStream.setBufferTime(totalBuffer);
myInputStream.play(videoToLoad);
myInputStream.onStatus = function (infoObject) {
if (infoObject.code == "NetStream.Play.Start" || infoObject.code == "NetStream.Buffer.Empty") {
if (myInputStream.time < endtime) {
buffer_mc._visible=1;
isBuffering = 1;
}else if(myInputStream.time >= endtime) play()
} else if (infoObject.code == "NetStream.Buffer.Full") {
isBuffering =0;
}
}
}
function bufferStatus () {
if (isBuffering){
currentBuffer=myInputStream.bufferLength;
bufferPercent=currentBuffer/totalBuffer;
if (bufferPercent > 1) bufferPercent =1, buffer_mc._visible=0
buffer_mc.bar_mc._xscale=bufferPercent*100;
}
}
pause_btn.onRelease=function (){pauseMovie()}
play_btn.onRelease=function(){playMovie()}
function pauseMovie () {
myInputStream.pause(true);
}
function playMovie () {
myInputStream.pause(false);
}
__________________
Jake Hilton
Hoolio is offline   Reply With Quote
Old 12-10-2002, 01:40 PM   #9
mj97
-------------
 
Join Date: Feb 2002
Posts: 39
rBorg,
Did you ever resolve your issue? I am having the same problem and can't seem to figure it out.
mj97 is offline   Reply With Quote
Old 12-10-2002, 01:44 PM   #10
JHarlequin
Senior Member
 
Join Date: Sep 2001
Location: Manhattan
Posts: 398
I created a player that was helped out by hoolios code but I also added functions like fast forward, rewind and a timeline slider. I based my buffering on things I learned form hoolios code. What do need to figure out?
__________________
JA
JHarlequin is offline   Reply With Quote
Old 12-10-2002, 02:44 PM   #11
mj97
-------------
 
Join Date: Feb 2002
Posts: 39
JA,
I checked out your player from your other post. I think you may be having the same issue as well. When I played your video...paused it...then played again, it rebuffered which is fine, however it skipped ahead in the video a little bit. This is the problem I am having and I think rborg too.
My problem seems to go even further. Once I resume play my video disappears, then I hear the audio first (after skipping a few seconds) and then the video appears a few seconds after that.
I've seen the Odopod example work. It pauses and resumes exactly in the same spot. I'm not sure how to get there.
I have used the code from the reply's above and also my own with the same result.
If you have any suggestions I'll try it out and let you know how it works.
Cheers
MJ
mj97 is offline   Reply With Quote
Old 12-11-2002, 05:08 PM   #12
dogvicky
Junior Member
 
Join Date: Dec 2002
Posts: 6
You need to change the "Enhanced Seeking" flag in the Application.xml file on the server where Flashcom is installed. By default this value is set to false. When you set this value to true, the server generates a keyframe on the video at each point of the video where a keyframe does not exists.

Hope this helps
dogvicky is offline   Reply With Quote
Old 12-11-2002, 05:31 PM   #13
mj97
-------------
 
Join Date: Feb 2002
Posts: 39
I actually tried that but it didn't help. Maybe I set it up wrong, can you see anything wrong with what I have done...

I placed 'application.xml' in my application folder which contained the following code:

------------------------
<?xml version="1.0"?>
<Application>
<StreamManager>
<EnhancedSeek>true</EnhancedSeek>
</StreamManager>
</Application>
------------------------

Does 'enhanced seek' work when using...

myStream.pause(false);

to restart the video. I thought that 'enhanced seek' was for seeking...

myStream.seek


Hopefully I'm wrong. Thanks for your help.
MJ
mj97 is offline   Reply With Quote
Old 12-11-2002, 05:38 PM   #14
mj97
-------------
 
Join Date: Feb 2002
Posts: 39
My code disappeared. Here it is, I hope.

--?xml version="1.0"?--
--Application--
--StreamManager--
--EnhancedSeek--true--/EnhancedSeek--
--/StreamManager--
--/Application--

Not sure how to make the xml show up with the tags in, so...

-- = < and </
mj97 is offline   Reply With Quote
Old 12-12-2002, 03:54 AM   #15
dogvicky
Junior Member
 
Join Date: Dec 2002
Posts: 6
After I made the change on the Application.xml file, I had to restart the server before I got it to work properly.

Also, to answer your question, the enhanced seek flag also works for the pause function.

I hope this helps....
dogvicky is offline   Reply With Quote
Old 12-12-2002, 09:29 AM   #16
mj97
-------------
 
Join Date: Feb 2002
Posts: 39
I can't believe I didn't try restarting the server!
It works fine now.
Cheers,
MJ
mj97 is offline   Reply With Quote
Old 01-03-2003, 07:51 PM   #17
rborg
Junior Member
 
Join Date: Sep 2002
Posts: 16
blast...
well i knew someone would figure it out.
I guess it must be the server side. I will give it a try. In the meantime i fixed it by seeking back about .0001 seconds or something close to that before resuming play. then it rebuffers correctly.
rborg is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flex and AIR

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:30 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.