Commit 1cf21402 authored by 李纪文's avatar 李纪文

fix: 修改视频掉线重连

parent 927e2774
......@@ -8,6 +8,7 @@ class App extends React.Component {
constructor(props) {
super(props);
this.jessibuca = null;
this.outTime = null;
this.showOperateBtns = true;
this.$container = null;
this.forceNoOffscreen = false;
......@@ -75,8 +76,17 @@ class App extends React.Component {
};
if (dom) {
this.jessibuca = new window.Jessibuca(jsc);
this.jessibuca.on("loadingTimeout", function () {
console.log('timeout')
this.jessibuca.on("error", (error) => {
if (error === 'fetchError' || error === 'websocketError') {
// 这里统一的做重连
this.outTime = setTimeout(() => {
this.jessibuca.pause().then(()=>{
this.jessibuca.play().then().catch((e)=>{
// console.log(e)
})
})
}, 5000);
}
})
}
}
......@@ -109,6 +119,10 @@ class App extends React.Component {
isPlaying: false,
});
}
if (this.outTime) {
clearTimeout(this.outTime);
this.outTime = null;
}
}
renderCheckedArr() {
let { VideoInfo } = this.props;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment