我正在使用 react-player 组件播放带有字幕的电影,如下所示:
import myVideo from '../media/test.mp4'
import React from 'react'
import ReactPlayer from 'react-player'
import './Video.css'
class Video extends React.Component {
render () {
return (
<div className='player-wrapper'>
<ReactPlayer
url={myVideo}
width='50%'
height='50%'
controls = {true}
className='react-player fixed-center'
config={{ file: {
tracks: [
{kind: 'subtitles', src: '../media/carol.vtt', srcLang: 'ro', default: true}
]
}}}
/>
</div>
)
}
}
export default Video
但不显示字幕,即使它与电影在同一个文件夹中
最好的问候, Aurelian