mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-17 16:50:31 +00:00
Update WebRTC module state logging
This commit is contained in:
parent
4c699d634b
commit
92f3e6378f
1 changed files with 5 additions and 5 deletions
|
|
@ -36,26 +36,26 @@ const ice = (() => {
|
|||
log.debug('[rtc] ice candidate error', event)
|
||||
},
|
||||
onIceStateChange: event => {
|
||||
const t = event.target;
|
||||
log.debug(`[rtc] ICE state: ${t.iceGatheringState}`)
|
||||
|
||||
switch (event.target.iceGatheringState) {
|
||||
case 'gathering':
|
||||
log.debug('[rtc] ice gathering');
|
||||
timeForIceGathering = setTimeout(() => {
|
||||
log.warn(`[rtc] ice gathering was aborted due to timeout ${ICE_TIMEOUT}ms`);
|
||||
// sendCandidates();
|
||||
}, ICE_TIMEOUT);
|
||||
break;
|
||||
case 'complete':
|
||||
log.debug('[rtc] ice gathering has been completed');
|
||||
if (timeForIceGathering) {
|
||||
clearTimeout(timeForIceGathering);
|
||||
}
|
||||
}
|
||||
},
|
||||
onIceConnectionStateChange: () => {
|
||||
log.debug('[rtc] <- iceConnectionState', connection.iceConnectionState);
|
||||
log.debug(`[rtc] ICE connection state: ${connection.iceConnectionState}`);
|
||||
switch (connection.iceConnectionState) {
|
||||
case 'connected':
|
||||
log.info('[rtc] connected...');
|
||||
connected = true;
|
||||
break;
|
||||
case 'disconnected':
|
||||
|
|
@ -120,7 +120,7 @@ export const webrtc = {
|
|||
connection.onicecandidate = ice.onIceCandidate;
|
||||
connection.onicecandidateerror = ice.onIceCandidateError;
|
||||
connection.onconnectionstatechange = _ => {
|
||||
console.debug(`[rtc] connection state -> ${connection.connectionState}`)
|
||||
console.debug(`[rtc] connection state: ${connection.connectionState}`)
|
||||
}
|
||||
connection.ontrack = event => {
|
||||
mediaStream.addTrack(event.track);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue