remove logs

This commit is contained in:
Nick Mowen 2023-05-02 12:47:10 -06:00
parent b5752ee850
commit 000aaa74f7

View File

@ -126,9 +126,9 @@ class VideoRTC extends HTMLElement {
set src(value) { set src(value) {
if (typeof value !== 'string') value = value.toString(); if (typeof value !== 'string') value = value.toString();
if (value.startsWith('http')) { if (value.startsWith('http')) {
value = 'ws' + value.substring(4); value = `ws${value.substring(4)}`;
} else if (value.startsWith('/')) { } else if (value.startsWith('/')) {
value = 'ws' + location.origin.substring(4) + value; value = `ws${location.origin.substring(4)}${value}`;
} }
this.wsURL = value; this.wsURL = value;
@ -144,7 +144,7 @@ class VideoRTC extends HTMLElement {
this.video.play().catch((er) => { this.video.play().catch((er) => {
if (er.name === 'NotAllowedError' && !this.video.muted) { if (er.name === 'NotAllowedError' && !this.video.muted) {
this.video.muted = true; this.video.muted = true;
this.video.play().catch(() => console.debug); this.video.play().catch(() => { });
} }
}); });
} }
@ -469,13 +469,13 @@ class VideoRTC extends HTMLElement {
pc.addIceCandidate({ pc.addIceCandidate({
candidate: msg.value, candidate: msg.value,
sdpMid: '0', sdpMid: '0',
}).catch(() => console.debug); }).catch(() => { });
break; break;
case 'webrtc/answer': case 'webrtc/answer':
pc.setRemoteDescription({ pc.setRemoteDescription({
type: 'answer', type: 'answer',
sdp: msg.value, sdp: msg.value,
}).catch(() => console.debug); }).catch(() => { });
break; break;
case 'error': case 'error':
if (msg.value.indexOf('webrtc/offer') < 0) return; if (msg.value.indexOf('webrtc/offer') < 0) return;
@ -544,7 +544,7 @@ class VideoRTC extends HTMLElement {
onmjpeg() { onmjpeg() {
this.ondata = (data) => { this.ondata = (data) => {
this.video.controls = false; this.video.controls = false;
this.video.poster = 'data:image/jpeg;base64,' + VideoRTC.btoa(data); this.video.poster = `data:image/jpeg;base64,${VideoRTC.btoa(data)}`;
}; };
this.send({ type: 'mjpeg' }); this.send({ type: 'mjpeg' });
@ -600,26 +600,22 @@ class VideoStream extends VideoRTC {
* Custom GUI * Custom GUI
*/ */
oninit() { oninit() {
console.debug('stream.oninit');
super.oninit(); super.oninit();
const info = this.querySelector('.info'); const info = this.querySelector('.info');
this.insertBefore(this.video, info); this.insertBefore(this.video, info);
} }
onconnect() { onconnect() {
console.debug('stream.onconnect');
const result = super.onconnect(); const result = super.onconnect();
if (result) this.divMode = 'loading'; if (result) this.divMode = 'loading';
return result; return result;
} }
ondisconnect() { ondisconnect() {;
console.debug('stream.ondisconnect');
super.ondisconnect(); super.ondisconnect();
} }
onopen() { onopen() {
console.debug('stream.onopen');
const result = super.onopen(); const result = super.onopen();
this.onmessage['stream'] = (_) => { this.onmessage['stream'] = (_) => {
@ -629,12 +625,10 @@ class VideoStream extends VideoRTC {
} }
onclose() { onclose() {
console.debug('stream.onclose');
return super.onclose(); return super.onclose();
} }
onpcvideo(ev) { onpcvideo(ev) {
console.debug('stream.onpcvideo');
super.onpcvideo(ev); super.onpcvideo(ev);
if (this.pcState !== WebSocket.CLOSED) { if (this.pcState !== WebSocket.CLOSED) {