4

I have been creating a custom video player for the web. On some machines that I run this on it will start loading the .flv file then no progress will be made for 30 seconds to one minute then show that the video is completely loaded. I am checking how much has been loaded using a bytesLoaded / bytesTotal in an Event.ENTER_FRAME. When traced separately what seems to be happening when it shows fully loaded the bytesTotal value changes to the current bytesLoaded value causing my video player to register that my load percentage to be 1. I have traced out the NetStatus event.code value and there is no update to show that there has been any sort of error. All I get are a NetStream.Play.Start NetStream.Buffer.Full and then it will wait and reset the bytes total value.

So what I am asking is if there a way to handle this problem?

Snikk
  • 156
  • 1
  • 5
  • When you say "no-progres has been made", do you mean on you progress bar OR actually the loading ? Have you monitored the loading with Firebug/Activity Monitor/Charles Proxy etc. ? Also, how much do you set your buffer to ? Do you pause/start the playing manually or is it meant to play automatically when the buffer is full ? – Theo.T Jan 25 '11 at 02:09
  • This seems to have been a problem related to the seek functionality going beyond the amount buffered. This only happened on some machines though and with a graphics card update and a FlashPlayer update the problem hasn't been happening anymore. That combined with a tighter control of where seek commands can be issued and a dynamically altered buffer to accommodate different connection speeds the problem has gone away on all machines that I have tested it on. I appreciate you getting back to me though. It was an odd problem and I cannot get it to happen consistently anymore after the updates. – Snikk Jan 27 '11 at 00:36

2 Answers2

1

There doesn't seem to be a specific answer to this problem. I have since made another attempt at the problem and there are two lessons that I have learned.

1) You can code around most shortcomings in the netstream class by not allowing it to attempt to seek past the loaded point using the bytesLoaded, bytesTotal and the bufferTime properties. This can allow you to make sure that you never allow the seek to be attempted to a time that could cause a problem.

2) Always allow the previous seek attempt to finish and handle it properly before attempting to send another.

Snikk
  • 156
  • 1
  • 5
0

Are you playing an mp4 whose moov atom (e.g. metadata) is at the end of the file? If so, Flash cannot play the file until the entire file loads and is able to read the metadata.

This tool should fix your video file: http://renaun.com/blog/code/qtindexswapper/

Matt
  • 3,483
  • 4
  • 36
  • 46
  • I am familiar with the moov spec. The Initial playback of the Video is triggered by the meta data being received so it can't be that. The video that I am playing back in this instance is a FLV using the On2 VP6 codec which has the metadata right at the begging of the file. The problem was with seeking while the video was loading during playback. If it attempted to seek past the loaded point. – Snikk Apr 06 '11 at 19:00