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

fix: 修改视频掉线重连

parent 927e2774
...@@ -8,6 +8,7 @@ class App extends React.Component { ...@@ -8,6 +8,7 @@ class App extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.jessibuca = null; this.jessibuca = null;
this.outTime = null;
this.showOperateBtns = true; this.showOperateBtns = true;
this.$container = null; this.$container = null;
this.forceNoOffscreen = false; this.forceNoOffscreen = false;
...@@ -75,8 +76,17 @@ class App extends React.Component { ...@@ -75,8 +76,17 @@ class App extends React.Component {
}; };
if (dom) { if (dom) {
this.jessibuca = new window.Jessibuca(jsc); this.jessibuca = new window.Jessibuca(jsc);
this.jessibuca.on("loadingTimeout", function () { this.jessibuca.on("error", (error) => {
console.log('timeout') 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 { ...@@ -109,6 +119,10 @@ class App extends React.Component {
isPlaying: false, isPlaying: false,
}); });
} }
if (this.outTime) {
clearTimeout(this.outTime);
this.outTime = null;
}
} }
renderCheckedArr() { renderCheckedArr() {
let { VideoInfo } = this.props; 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