ReactPlayer subtitle not showing
Asked Answered
C

2

2

I have a problem with ReactPlayer component. I'm trying to upload a subtitle(track) using config attribute and it isn't displayed onto the video.

I'm running this project on Chrome. In Networks I found out that my request was blocked with the error "blocked:origin" that's why I added:

attributes: {
    crossOrigin: 'true'
}

This is my ReactPlayer component:

<ReactPlayer
    url='video/myVideo'
    className="myClass"
    config= {
        file: {
            attributes: {
                crossOrigin: 'true'
            },
            tracks: [
                {kind: 'subtitles', src: 'subs/mySubtitle', srcLang: 'en', default: true}
            ]
        }
    }
/>

Also, I'm using React v16.2.0 and ReactPlayer v0.25.3.

Comprehensible answered 9/5, 2019 at 13:29 Comment(2)
You might just be missing the .vtt src: 'subs/mySubtitle.vtt'Horrific
Have you found a solution?Termagant
B
0

same question !

 tracks:        [
                            {
                                kind: 'subtitles',
                                src: this.state.trackUrl,
                                srcLang: 'en',
                                default: true,
                            },

                        ]
Bowlds answered 29/8, 2019 at 7:28 Comment(1)
Have you found a solution?Termagant
K
0

Not sure if you ever found a solution, but this worked for me (if you use absolute paths):

    import introVideoText from 'assets/impacti_intro.vtt';

then

    config={{
              file: {
                tracks: [
                  {
                    kind: 'subtitles',
                    src: introVideoText,
                    srcLang: 'en',
                    default: true,
                  }
                ],
              },
Kathie answered 15/3, 2021 at 18:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.