1

I receive my subtitles dynamically from the remote API but I can't get them to show in my react-player

      <ReactPlayer
        width="100%"
        height="100%"
        url={src}
        controls={true}
        config={{
          file: {
            tracks: [
              {
                kind: 'subtitles',
                src: 'https://s3.eu-central-1.amazonaws.com/'path'/subtitles-test.vtt',
                srcLang: 'en',
                default: true,
                label: 'eng',
              },
            ],
          },
        }}
      />

I also tried adding crossOrigin: 'true' to the attributes property but that makes me unable to play the video (it just gets stuck at 00:00)

Adding subtitles locally works just fine

Oleksandr Fomin
  • 2,005
  • 5
  • 25
  • 47
  • Did you end up finding a solution? – chocojunkie Oct 28 '21 at 20:33
  • If I'm not mistaken we had to change some CORS settings on the backend to make it work. Here is what the config looks like right now and the subtitles are working config={{ file: { attributes: { crossOrigin: 'anonymous', }, tracks: [ { kind: 'subtitles', src: subtitles , srcLang: 'en', default: false, label: 'eng', }, ], }, }} – Oleksandr Fomin Oct 28 '21 at 20:38

0 Answers0