React video.js实现m3u8格式视频播放及实时切换
先安装:
npm install --save video.js
导入
import videojs from 'video.js'
import "video.js/dist/video-js.css";
constructor(props) {
super(props);
this.state = {
current_url : '/001.m3u8',
}
this.player= null
}
componentDidMount 方法下
this.player = videojs("video");
this.player.controls(true)
this.player.src(this.state.current_url)
<video id="video" className="video-js vjs-default-skin video" style={{height:"500px"}} ></video>
浙公网安备 33010602011771号