Skip to content

Protocol Handler: WEBM does not load when used in video HTML tag #57

@lidel

Description

@lidel

Summary

WEBM video fails to load on initial load when used in <video> tag.
If opened directly at least once, then loads fine.

Discovered this problem in IPFS Companion, which was streaming videos from IPFS,
but I created a simplified repro without IPFS that downloads file via HTTP and produces the same error.
Tested with 2MB and 22MB files, same result for both. Steps below use 2MB file.

How to Reproduce

  1. Run demo:protocol from my video-render-bug-demo branch:

    git clone -b video-render-bug-demo --depth 1 https://github.com/lidel/libdweb.git
    cd libdweb
    yarn && yarn demo:protocol
    
  2. Open dweb://html/ first: loading via <video> tag will fail with this error.

    • Looks like a race-condition of sorts related to content-type sniffing. It failed to guess content-type when video was not yet in cache. @Gozala this may be remotely related to discussion about content-type we had at DWeb: if browser could wait until API returns content-encoding, content-type along with content's asynciterator, that could solve this issue as well.
  3. Open dweb://html/video.webm directly: it will load and play just fine.

  4. Open dweb://html/ again: loading via <video> tag will work this time.

    • It seems browser's content-type sniffing fails when video is not yet in cache, but works fine after initial load.
  5. Open dweb://foo/: loading via <video> tag from different origin will fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions