I'm having a bit of trouble trying to fully buffer a pre-recorded rtmp-stream from Wowza media server with an in-house flash player. The requirement to fully pre-buffer the video comes from the management. It must be possible to view the whole video offline.
When the netConnection object gets a connection I create the NetStream object, set a metadata event handler for it that sets the NetStream.maxBufferTime to the full duration of the video. Also when creating the NetStream I add an Event.ENTER_FRAME listener to the video component so it checks when the video has been loaded(it has a width) so it will pause on the first frame.
Then I start playing the video from the netstream. When the metadata event is received the buffer is set, when the first frame is downloaded and displayed on the video object the player pauses on the first frame, but continues loading the video in the buffer. Now when I trace the buffer(NetStream.bufferLength) I notice the following phenomena which is a source of major grief for me:
If the NetStream.maxBufferTime is set to 100% of the length of the video, the video is buffered fully and after approximately four seconds pass the playhead(NetStream.time) gets moved to the end of the video. However when I resume the playback on a Linux system the video is displayed normally, but the playhead stays at 100%(Which wreaks havoc on custom cuepoint handling). On windows system the playhead also stays at 100% but the video is played back at 100x the speed of normal.
When the buffer reaches 100% the events NetStream.buffer.flush and NetStream.play.stop(?!?!) are triggered, but the player does react to neither of them, so to me it seems this is a bug in the flash NetStream or Wowza.
If however I set the NetStream.maxBufferTime to (the length of video - 0.4) the buffering stops just before the end of the stream and the NetStream.Play.stop doesn't get triggered and the playhead stays at the first frame, but this feels a bit too hackish solution.
Progressive download doesn't feel like a solution either, as at least some, if not all of the videos must be at least somewhat protected from copying.
Any pointers?
The Wowza is 2.something, flex is 4.1 to support flash 10.1, the streams are either recorded with a flex/flash recorder or uploaded to the server and converted to h.264(Both exhibit this behaviour.) and flash version range from 10.1 to 11.0.
Edit: It seems that the ultimate path we will take on this issue will be that any video that needs to be protected will be served as rtmp stream with minimal buffering and public videos will be server as progressive download. As it was mentioned in the comments rtmp is not supposed to do buffering, so what we were doing was basically wrong. For future reference: Do not buffer more than a few seconds of rtmp stream.
I'm not too sure on your answer - but, my first question would certainly be, why are you trying to buffer the entire length of a streamed video? I understand not an answer - just trying to garner more info!