diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-06-04 02:38:01 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-01-25 01:05:26 +0300 |
commit | 5b99bfc6edddedf6db6ba130fe1822ca573c35f4 (patch) | |
tree | b8d8a6da6d30e6d8c6d22285a09e6a2f4ffdc456 /src/utils | |
parent | b085cd869e8b45511028cced1c73eed163e33b3b (diff) |
Remove unused "remoteVideosEl" property
The "removeVideosEl" property was always empty, so neither the property
nor the code that depends on the property being set are needed.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/webrtc/simplewebrtc/simplewebrtc.js | 65 | ||||
-rw-r--r-- | src/utils/webrtc/webrtc.js | 1 |
2 files changed, 0 insertions, 66 deletions
diff --git a/src/utils/webrtc/simplewebrtc/simplewebrtc.js b/src/utils/webrtc/simplewebrtc/simplewebrtc.js index f36578b87..16373c007 100644 --- a/src/utils/webrtc/simplewebrtc/simplewebrtc.js +++ b/src/utils/webrtc/simplewebrtc/simplewebrtc.js @@ -17,7 +17,6 @@ function SimpleWebRTC(opts) { connection: null, debug: false, localVideoEl: '', - remoteVideosEl: '', enableDataChannels: true, enableSimulcast: false, maxBitrates: { @@ -177,9 +176,6 @@ function SimpleWebRTC(opts) { self.connection.emit('message', payload) }) - this.webrtc.on('peerStreamAdded', this.handlePeerStreamAdded.bind(this)) - this.webrtc.on('peerStreamRemoved', this.handlePeerStreamRemoved.bind(this)) - // echo cancellation attempts if (this.config.adjustPeerVolume) { this.webrtc.on('speaking', this.setVolumeForAll.bind(this, this.config.peerVolumeWhenSpeaking)) @@ -221,14 +217,10 @@ function SimpleWebRTC(opts) { // screensharing events this.webrtc.on('localScreen', function(stream) { const el = document.createElement('video') - const container = self.getRemoteVideoContainer() el.oncontextmenu = function() { return false } el.id = 'localScreen' attachMediaStream(stream, el) - if (container) { - container.appendChild(el) - } self.emit('localScreenAdded', el) self.connection.emit('shareScreen') @@ -273,54 +265,6 @@ SimpleWebRTC.prototype.disconnect = function() { this.emit('disconnected') } -SimpleWebRTC.prototype.handlePeerStreamAdded = function(peer) { - const container = this.getRemoteVideoContainer() - if (container) { - // If there is a video track Chromium does not play audio in a video element - // until the video track starts to play; an audio element is thus needed to - // play audio when the remote peer starts with the camera available but - // disabled. - const audio = attachMediaStream(peer.stream, null, { audio: true }) - const video = attachMediaStream(peer.stream) - - video.muted = true - - // At least Firefox, Opera and Edge move the video to a wrong position - // instead of keeping it unchanged when "transform: scaleX(1)" is used - // ("transform: scaleX(-1)" is fine); as it should have no effect the - // transform is removed. - if (video.style.transform === 'scaleX(1)') { - video.style.transform = '' - } - - // store video element as part of peer for easy removal - peer.audioEl = audio - peer.videoEl = video - audio.id = this.getDomId(peer) + '-audio' - video.id = this.getDomId(peer) - - container.appendChild(audio) - container.appendChild(video) - - this.emit('videoAdded', video, audio, peer) - } -} - -SimpleWebRTC.prototype.handlePeerStreamRemoved = function(peer) { - const container = this.getRemoteVideoContainer() - const audioEl = peer.audioEl - const videoEl = peer.videoEl - if (this.config.autoRemoveVideos && container && audioEl) { - container.removeChild(audioEl) - } - if (this.config.autoRemoveVideos && container && videoEl) { - container.removeChild(videoEl) - } - if (videoEl) { - this.emit('videoRemoved', videoEl, peer) - } -} - SimpleWebRTC.prototype.getDomId = function(peer) { return [peer.id, peer.type, peer.broadcaster ? 'broadcasting' : 'incoming'].join('_') } @@ -386,10 +330,6 @@ SimpleWebRTC.prototype.getLocalVideoContainer = function() { } } -SimpleWebRTC.prototype.getRemoteVideoContainer = function() { - return this.getEl(this.config.remoteVideosEl) -} - SimpleWebRTC.prototype.shareScreen = function(mode, cb) { this.webrtc.startScreenShare(mode, cb) } @@ -401,11 +341,6 @@ SimpleWebRTC.prototype.getLocalScreen = function() { SimpleWebRTC.prototype.stopScreenShare = function() { this.connection.emit('unshareScreen') const videoEl = document.getElementById('localScreen') - const container = this.getRemoteVideoContainer() - - if (this.config.autoRemoveVideos && container && videoEl) { - container.removeChild(videoEl) - } // a hack to emit the event the removes the video // element that we want diff --git a/src/utils/webrtc/webrtc.js b/src/utils/webrtc/webrtc.js index 33cf62aaf..ec3fa18c0 100644 --- a/src/utils/webrtc/webrtc.js +++ b/src/utils/webrtc/webrtc.js @@ -651,7 +651,6 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local }) webrtc = new SimpleWebRTC({ - remoteVideosEl: '', autoRequestMedia: true, debug: false, autoAdjustMic: false, |