Skip to content

Audio playback fails due to incorrect request headers #295

@Wijnants

Description

@Wijnants

Bug Description

When loading a valid IIIF Presentation 3 manifest that contains an audio file (type: "Sound"), the Clover viewer fails to play the audio. No sound is produced and no errors appear in the browser console. The same manifest and audio file work perfectly in other viewers like Mirador.

A key symptom is that the network request for the .mp3 file is not reliably initiated. On the first load, the request is often missing entirely from the Developer Tools' "Network" tab. Only after reloading the page 2-3 times does the request for the media file appear. This intermittent behavior strongly suggests a race condition or timing issue within the viewer's code.

Steps to Reproduce

  1. Go to the Clover demo page: https://samvera-labs.github.io/clover-iiif/docs/viewer/demo

  2. Load the following IIIF Manifest URL:
    https://vetmediathek.vetmeduni.ac.at/api/v1/objects/uuid/568a9701-0d4a-4ed7-8ae6-1e9c4fe944ec/format/iiif/v3/manifest.json

  3. Observe that the audio does not play.

  4. Open the browser's Developer Tools and check the "Network" tab. You may need to reload the page multiple times for the .mp3 request to appear.

Analysis & Evidence

The IIIF manifest is valid and the server is configured correctly (it supports HTTP Range Requests with a 206 Partial Content response). The problem lies within the Clover viewer's logic.

  1. Race Condition: The inconsistent firing of the network request for the audio file points to a client-side timing issue. It seems the logic to initiate the audio fetch is not synchronized correctly with the component's lifecycle.

  2. Incorrect Request Headers: When the request for the MP3 file is successfully made, the request headers initiated by Clover are incorrect:

  • Sec-Fetch-Mode: no-cors: This is the critical error. A no-cors request prevents the player's JavaScript from accessing the response data, making playback impossible even after a successful download.

  • Sec-Fetch-Dest: video: The request's destination is incorrectly flagged as video instead of audio.

Conclusion

The evidence suggests two distinct bugs in how Clover handles audio content: a race condition that prevents the media request from being made reliably, and the use of incorrect fetch headers(no-cors) that prevents playback even when the request succeeds.

The fetch request should be made reliably with mode: 'cors' to allow the player to access the audio data.

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