Skip to content

Missing Content-Length response header in local source causes net::ERR_REQUEST_RANGE_NOT_SATISFIABLE on <audio> elements created from JavaScript #505

@gluth

Description

@gluth

Operating System Info

Windows 10

Other OS

No response

OBS Studio Version

32.0.0

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/7aTYoaJnGTmGy6xZ

OBS Studio Crash Log URL

No response

Expected Behavior

That audio would be played every time without an issue.

Current Behavior

When .play() is used network logs (sometimes - its not consistent, but happens often) is filled with Failed to load resource: net::ERR_REQUEST_RANGE_NOT_SATISFIABLE error.

Steps to Reproduce

Create html with script tag file with something like this and add it to obs as local browser source.

const audio = document.createElement('audio');
audio.src = 'short_file.mp3';
audio.play();

This is snippet which causes error, file must be relatively short, like the one attached. Core of this issue is that, when loading audio files browser specify byte range in headers (0-) and local source response does not include nor total byte length of resource or served range in bytes.

Because of that, when playing audio (mp3 file format may also be related to it) and hitting end of currently loaded file new request is fired with byte range out of currently file size (it requests bytes after the end of file). Which results in error and script fail.

This happens often (every second/third browser source reload) and has bigger chance to happen with cold cache.

wdech.mp3

Anything else we should know?

No response

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