w3c / webcodecs

WebCodecs is a flexible web API for encoding and decoding audio and video.
https://w3c.github.io/webcodecs/
Other
978 stars 136 forks source link

audio-video-player sample support seek? #533

Closed shaozj closed 2 years ago

shaozj commented 2 years ago

I saw the new audio-video-player sample. It's really a great work to me. I wonder could you provide a seek sample? The video player would be much more useable.

sandersdan commented 2 years ago

I think that seeking adds a lot of complexity to the demuxer without adding much in terms of WebCodecs. It's probably better to build a video player as an external project rather than as a WebCodecs sample.

shaozj commented 2 years ago

@sandersdan Thanks! I will try to build a video player based on WebCodecs.

chcunningham commented 2 years ago

Awesome!

FYI, the high level steps for player.seek(T) would be 1) seek the demuxer to the key frame at-or-before time T 2) reset() the decoder and decode from that key frame, continuing until you reach T 3) discard decoder outputs until you get the frame at time T 4) keep playing as usual