1988 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says

i’ve spent almost 10 fxxxing days on this…
now it seems i finally found a (ugly) solution but still wonder if this can be addressed in other ways.

the problem arise when seeking ahead of loaded video:

  1. a "NetStream.Play.Stop" event gets fired randomly
  2. video freeze and resume only when buffer (2s) gets filled again
2 is most annoying since it stops playback for undefined number of seconds

using (bytesLoaded/bytesTotal)*duration as upper seek limit does not solve
since for variable bitrate media it’s just an approximation.

lots of videoplayer authors here, any advice on fighting this ?

8112 posts Community Moderator
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 6-7 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX Volunteer moderator says
the problem arise when seeking ahead of loaded video

this depends on what you mean by this…

Are you using progressive http download / streaming or youtube style streaming with php / asp?

1988 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says

progressive http

8112 posts Community Moderator
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 6-7 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX Volunteer moderator says
progressive http

easiest way around is to prevent them seeking past the currently loaded point…

http://s3.envato.com/files/91461/flvPlayer3.html

This a version of my player and if you try to scrub past the currently loaded point it wont allow you to which saves having to deal with all the issues that netstream brings when trying to seek to an unbuffered point…

1988 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says
easiest way around is to prevent them seeking past the currently loaded point…
how do you get currently loaded point ?
8112 posts Community Moderator
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 6-7 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX Volunteer moderator says
easiest way around is to prevent them seeking past the currently loaded point…
how do you get currently loaded point ?

I store it as a % within my VideoCore class thats calculated when needed…

public function get percentLoaded():Number
{
    return Number((videoStream.bytesLoaded / videoStream.bytesTotal).toFixed(2));
}

Then my MediaScrubber class calls this once a second to update its length of whats loaded.

The Mouse Listener for MediaScrubber is only on the loaded bar but returns a % of where on the full bars width your clicking which is the % of the video that you then seek to using something like…

public function seek($seekTo:Number):void 
{
    videoStream.seek(duration * $seekTo);
    _playing = true;
} 

Because the Mouse Listener is only on the loaded bar you can never seek past whats loaded…

hope that makes some kind of sense :)

1988 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says

using bytesLoded/bytesTotal won’t work ‘cause
highly variable bitrate videos will always fool an upper seek bound based on that.

Even setting limit to 5s less than (bytesLoded/bytesTotal)*duration it’s not enough to prevent the issue with some videos

ps
your preview does not work for me (firefox 3.5/linux)
it locks at “initalizing”

8112 posts Community Moderator
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 6-7 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX Volunteer moderator says
using bytesLoded/bytesTotal won’t work ‘cause
highly variable bitrate videos will always fool an upper seek bound based on that.

I guess thats an issue that you can’t really get round :( i’ve never had an issue with it though…

ps
your preview does not work for me (firefox 3.5/linux)
it locks at "initalizing"

hmmm, works fine here XP / FF 3 .5.

If you have Firebug would you mind seeing whats causing it to hang up?

1988 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says
i’ve translated it from italian, so exact english message could be different
Permission denied to <hxxp://s3.envato.com> 
for calling Location.toString method on <hxxp://activeden.net>

about the issue, just try the player with some high bitrate videos on a (simulated) slow link

1312 posts
  • Elite Author
  • Sold between 50 000 and 100 000 dollars
  • Has been a member for 5-6 years
  • Microlancer Beta Tester
  • United Kingdom
  • Attended a Community Meetup
  • Referred between 200 and 499 users
+3 more
LGLab says

Funny I was actually making a flv player in AS3 and was about to try and deal with this.

Would it not be good practice to set the rectangle boundaries used for the scrub startDrag, to a rectangle that is changed dynamically in the video load function as in:

public function setloadProgress(event:Event):void
{        
var loadedPercent:Number = stream.bytesLoaded*100/stream.bytesTotal;
videoControls.loadBar.loadProgressBar.width = loadedPercent*loadBarWidth/100;
vidRect=new Rectangle(0,3,videoControls.loadBar.loadProgressBar.width,0); 
}

Then in the scrub function:

private function scrubButtonPressed(event:MouseEvent):void
{
videoControls.loadBar.loadBarScrub.startDrag(false,vidRect);
}

AS3 noob here…be nice :D

by
by
by
by
by
by