MediaSource long videos

📰 Reddit r/webdev

Learn to handle long videos with MediaSource by understanding SourceBuffer limitations and implementing a strategy to extend seekable areas

intermediate Published 24 Jun 2026
Action Steps
  1. Check the current SourceBuffer size and quota using the `SourceBuffer.buffered` property and `MediaSource.sourceBuffers` array
  2. Implement a strategy to append or remove chunks from the SourceBuffer to stay within the quota limits
  3. Use the `MediaSource.duration` property to set the duration of the video and allow seeking beyond the initial SourceBuffer size
  4. Experiment with using multiple SourceBuffers or implementing a custom buffering strategy to extend the seekable area
  5. Test and optimize the implementation for different video lengths and browser configurations
Who Needs to Know This

Web developers working with video content can benefit from understanding how to use MediaSource for long videos, especially when dealing with SourceBuffer quota exceeded errors

Key Insight

💡 MediaSource has limitations when dealing with long videos, but by understanding SourceBuffer quotas and implementing a custom strategy, you can extend the seekable area and improve user experience

Share This
📹 Handle long videos with MediaSource by understanding SourceBuffer limitations! 🤔

Key Takeaways

Learn to handle long videos with MediaSource by understanding SourceBuffer limitations and implementing a strategy to extend seekable areas

Full Article

Anyone played with MediaSource? Whats the strategy for long videos (over SourceBuffer QuotaExceededError). When giving a stream url directly to src the whole buffered is seekable, say all 20min. But going through MediaSource the seekable area is reduced to SourceBuffer size (eg. 10 min around video.currentTime) How is the browser doing it? afaik there is no prepending to SourceBuffer, nor multiple SourceBuffers per video strea
Read full article → ← Back to Reads