improve error & exit handling on livestream viewer

This commit is contained in:
SrGooglo 2023-04-26 23:13:30 +00:00
parent 75cb2a811b
commit f1f5fa046b

View File

@ -1,4 +1,3 @@
import React from "react" import React from "react"
import * as antd from "antd" import * as antd from "antd"
import classnames from "classnames" import classnames from "classnames"
@ -133,6 +132,10 @@ export default class StreamViewer extends React.Component {
}).catch((error) => { }).catch((error) => {
console.error(error) console.error(error)
if (this.streamInfoInterval) {
this.streamInfoInterval = clearInterval(this.streamInfoInterval)
}
return null return null
}) })
@ -241,6 +244,8 @@ export default class StreamViewer extends React.Component {
this.exitPlayerAnimation() this.exitPlayerAnimation()
this.toggleCinemaMode(false)
if (this.streamInfoInterval) { if (this.streamInfoInterval) {
clearInterval(this.streamInfoInterval) clearInterval(this.streamInfoInterval)
} }
@ -360,20 +365,22 @@ export default class StreamViewer extends React.Component {
</div> </div>
</div> </div>
<div className="livestream_player_header_info"> {
this.state.stream.info && <div className="livestream_player_header_info">
<div className="livestream_player_header_info_title"> <div className="livestream_player_header_info_title">
<h1>{this.state.stream.info.title}</h1> <h1>{this.state.stream.info?.title}</h1>
</div> </div>
<div className="livestream_player_header_info_description"> <div className="livestream_player_header_info_description">
<Ticker <Ticker
mode="smooth" mode="smooth"
> >
{({ index }) => { {({ index }) => {
return <h4>{this.state.stream.info.description}</h4> return <h4>{this.state.stream.info?.description}</h4>
}} }}
</Ticker> </Ticker>
</div> </div>
</div> </div>
}
</> </>
: <antd.Skeleton active /> : <antd.Skeleton active />
} }