add catch() to play(), otherwise it throws
This commit is contained in:
@@ -39,8 +39,9 @@ export default class CallIncoming extends React.Component {
|
|||||||
|
|
||||||
this.resetDesc(topic, this.props);
|
this.resetDesc(topic, this.props);
|
||||||
if (this.props.callState == CALL_STATE_INCOMING_RECEIVED) {
|
if (this.props.callState == CALL_STATE_INCOMING_RECEIVED) {
|
||||||
RING_SOUND.play();
|
// play() throws if the user did not click the app first: https://goo.gl/xX8pDD.
|
||||||
this.ringTimer = setInterval(() => RING_SOUND.play(), 2000);
|
RING_SOUND.play().catch(_ => {});
|
||||||
|
this.ringTimer = setInterval(_ => {RING_SOUND.play().catch(_ => {})}, 2000);
|
||||||
this.props.onRinging(this.props.topic, this.props.seq);
|
this.props.onRinging(this.props.topic, this.props.seq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,8 @@ class CallPanel extends React.PureComponent {
|
|||||||
this.handleVideoOfferMsg(info);
|
this.handleVideoOfferMsg(info);
|
||||||
break;
|
break;
|
||||||
case 'ringing':
|
case 'ringing':
|
||||||
RING_SOUND.play();
|
// play() throws if the user did not click the app first: https://goo.gl/xX8pDD.
|
||||||
|
RING_SOUND.play().catch(_ => {});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.warn("Unknown call event", info.event);
|
console.warn("Unknown call event", info.event);
|
||||||
@@ -336,7 +337,7 @@ class CallPanel extends React.PureComponent {
|
|||||||
RING_SOUND.pause();
|
RING_SOUND.pause();
|
||||||
RING_SOUND.currentTime = 0;
|
RING_SOUND.currentTime = 0;
|
||||||
CALL_ENDED_SOUND.loop = true;
|
CALL_ENDED_SOUND.loop = true;
|
||||||
CALL_ENDED_SOUND.play();
|
CALL_ENDED_SOUND.play().catch(_ => {});
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
this.handleCloseClick();
|
this.handleCloseClick();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|||||||
Reference in New Issue
Block a user