ampproject / ampproject/amphtml
crossorigin attribute on amp-audio to support tracks hosted on different domain to story
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
Caption/subtitle tracks do not currently work with amp-audio. This may be because unlike amp-video it does not support/transfer the crossorigin="anonymous" attribute to the element which leads to errors of the following nature:
```
Unsafe attempt to load URL X.vtt from frame with URL Y. Domains, protocols and ports must match.
```
I've created a test story to demonstrate the problem:
https://stories.nws.ai/1288492465/audio-captions/
Support for `` in `` does seem flaky between browsers.
I've tested outside of AMP and it works in Chrome but not Firefox:

### Alternatives Considered
The alternative would be to try and use `amp-video`. However, it doesn't seem to be able to play audio files, so the audio would have to be converted into a video file (additional processing for the user).
### Additional Context
_No response_
Contributor guide
Research direction
Start by inspecting the amp-audio implementation and compare how amp-video handles the crossorigin="anonymous" attribute. Reproduce the caption-track case with the linked test story, then verify that cross-domain tracks load without the reported error across the relevant browsers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100