3
votes

I am implementing a video player in Actionscript and I need to be able to define the starting play time for the videos. Netstream.seek(pos) works for flv files but fails for H.264 files (the player starts playing the video from the beginning). Anyone knows what might be the problem?

(I am using Netstream for this instead of adding a parameter with the starting time when I call the Netstream.play method because I don't have Flash Media Server).

2
are you getting your streams from the server?www0z0k
I am using sample MP4 files that I found on the web (i.e. h264.code-shop.com:8080/trailer2.mp4).luis
i think the problem is that not all servers support seek functionalitywww0z0k
the issue seems to be related with the fact that seeking only works for MP4 streaming when the video has keyframes defined. in this situation I should be able to seek to a position that contains a keyframe. I am still not sure about this, but that's a possibility. I also tried to play local files and it didn't work.luis
you need canseekontime = true in video metadata and server support. for seeking to a keyframe you need to find a fileposition in keyframes.filepositions with the same index as keyframes.times item that's closest to your target time. after you know it you'll have to do something like stream.play(path.extension?start=12345[fileposition you need]) depending on server implementationwww0z0k

2 Answers

2
votes

Flash does not support sending bytes header, so you will always get byte 0-. You can accomplish seek by utilizing pseudo streaming ( http://h264.code-shop.com/trac ). Basicly, you supply a get param ?start=1234, then the server backend patch the moov header, move it to the front of the file, and start serving it at the start position. (Essentially, splitting the file on the fly, with start position at 1234, and serving up the new generated file)

0
votes

I know for a fact that this works with the latest Red5 1.0 builds, I cannot speak for FMS or Wowza.