Skip to content

Streaming video does not work (fix in progress) #1948

@jaxoncreed

Description

@jaxoncreed

Environment

  • Server version: 7.1.2
  • Node.js version: 20.17.0
  • npm version: 10.8.2

Description

I've been experiencing problems with range headers. Namely, streaming video isn't working in a web browser.

To reproduce

Find a long video and place it in your Pod. Navigate to that video in a web browser and notice that the web browser does not send range headers with its request. This causes to entire video to be downloaded before it plays.

Interim Solution

Some searching around showed that an Options request should respond with an Accept-Ranges: bytes header for a web browser to send range headers.

I've done a naive fix by simply adding the Accept-Ranges header to the constant-headers.json config:

{
  "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld",
  "@graph": [
    {
      "comment": "Adds several constant headers.",
      "@id": "urn:solid-server:default:Middleware_Header",
      "@type": "HeaderHandler",
      "headers": [
        {
          "HeaderHandler:_headers_key": "Vary",
          "HeaderHandler:_headers_value": "Accept,Authorization,Origin"
        },
        {
          "HeaderHandler:_headers_key": "X-Powered-By",
          "HeaderHandler:_headers_value": "Community Solid Server"
        },
        {
          "HeaderHandler:_headers_key": "Accept-Ranges",
          "HeaderHandler:_headers_value": "bytes"
        }
      ]
    }
  ]
}

but any guidance on the right place to put this would be appreciated.

This does allow streaming video to work properly on Pods, but every time a new request for another chunk is made the server emits the following error.

2024-09-30T17:42:23.899Z [WrappedExpiringReadWriteLocker] {Primary} error: Lock expired after 6000ms on http://localhost:3000/jackson/public/10BusinessModelsForSolid.mp4
2024-09-30T17:42:23.901Z [StreamUtil] {W-???} warn: Piped stream errored with Lock expired after 6000ms on http://localhost:3000/jackson/public/10BusinessModelsForSolid.mp4
2024-09-30T17:42:23.901Z [StreamUtil] {W-???} warn: Piped stream errored with Lock expired after 6000ms on http://localhost:3000/jackson/public/10BusinessModelsForSolid.mp4
2024-09-30T17:42:23.901Z [BasicResponseWriter] {Primary} error: Aborting streaming response because of server error; headers already sent.
2024-09-30T17:42:23.901Z [BasicResponseWriter] {Primary} error: Response error: Lock expired after 6000ms on http://localhost:3000/jackson/public/10BusinessModelsForSolid.mp4
2024-09-30T17:42:23.901Z [HandlerServerConfigurator] {Primary} error: Request error: aborted

The error doesn't seem to affect the experience in the web browser, but something else must be going wrong. I will continue to investigate and report here.

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