Open yarontorbaty opened 9 years ago
good idea i am thinking about creating a "real" player supporting not only broadway.js but different video decoders. at the time i see broadway.js only as a decoder.
Yes - I was looking for a way to do this myself, but the onPictureDecoded
only returns buffer, width and height. If it also returned the timestamp of the frame that would be ideal - and would also (I think?) allow you to pre-render some frames and increase FPS. That might negatively impact memory usage, though.
@alastaircoote do you know if the timestamp information is even provided in the h264 stream data?
@soliton4 I don't know. If FPS is available in the header you could calculate it that way, but I don't know much about decoding that data/if it's even possible.
Timestamp information is available in the container format, not in the raw stream. Broadway includes an mp4 parser, you should be able to figure out the timestamp using that. Read the mp4 spec, (or the qucktime spec from which it is derived, the Apple docs are better).
i created the foundation for a frame buffer here: https://github.com/mbebenita/Broadway/commit/0324cb3a319441bc04d3e132a05e77fdec978deb
How would you set the fps with your code?
At times the video moves either too fast or too slow, In order to provide a smooth user experience displaying frames should be done in a constant interval (1000/FPS)