diff --git a/resources/html/webrtcgateway/test/components/app.jsx b/resources/html/webrtcgateway/test/components/app.jsx index 8609e0d..909d7a0 100644 --- a/resources/html/webrtcgateway/test/components/app.jsx +++ b/resources/html/webrtcgateway/test/components/app.jsx @@ -1,167 +1,167 @@ var SylkTest = React.createClass({ getInitialState: function() { return { connection: null, connectionState: null, account: null, registrationState: null, currentCall: null, callState: null, }; }, getServerUrl: function() { return window.location.protocol.replace('http', 'ws') + '//' + window.location.host + '/webrtcgateway/ws'; }, connectionStateChanged: function(oldState, newState) { switch (newState) { case 'closed': this.setState({connection: null, connectionState: newState}); break; case 'disconnected': if (this.state.currentCall) { this.state.currentCall.terminate(); } this.setState({account: null, registrationState: null, currentCall: null, callState: null, connectionState: newState}); break; default: this.setState({connectionState: newState}); break; } }, registrationStateChanged: function(oldState, newState, data) { var state = newState; if (newState === 'failed') { state += ' (' + data.reason + ')' } this.setState({registrationState: state}); }, callStateChanged: function(oldState, newState, data) { var state = newState; var currentCall = this.state.currentCall; if (newState === 'terminated') { state += ' (' + data.reason + ')'; currentCall = null; setTimeout(() => { if (this.state.currentCall === null) { this.setState({callState: null}); } }, 4000); } this.setState({currentCall: currentCall, callState: state}); }, setAccount: function(account) { if (account !== null) { account.on('registrationStateChanged', this.registrationStateChanged); account.on('incomingCall', this.handleNewCall); account.on('outgoingCall', this.handleNewCall); } this.setState({account: account}); }, handleNewCall: function(call) { if (this.state.currentCall !== null) { call.terminate(); } else { call.on('stateChanged', this.callStateChanged); this.setState({currentCall: call, callState: call.state}); } }, toggleConnect: function(event) { event.preventDefault(); if (this.state.connection === null) { var connection = sylkrtc.createConnection({server: this.getServerUrl()}); connection.on('stateChanged', this.connectionStateChanged); this.setState({connection: connection}); } else { this.state.connection.close(); } }, render: function() { var accountBox; var callBox; var videoBox; var ringtonePlayer; if (sylkrtc.isWebRTCSupported()) { accountBox = ; if (this.state.callState === 'established') { videoBox = } else { if (this.state.currentCall) { ringtonePlayer = } if (this.state.currentCall === null || this.state.currentCall.direction === 'outgoing') { callBox = } else { callBox = } } } else { accountBox =

Your browser does not support WebRTC

Too bad! Checkout the WebRTC support across browsers in the link below.
Is WebRTC ready yet?

; } return (
-
); } });