зеркало из https://github.com/nextcloud/spreed.git
Do not create audio and video elements without container in SimpleWebRTC
SimpleWebRTC automatically created an audio and video elements when a peer stream was added. Those elements were ignored by the Talk code (which creates its own elements as needed), so they were not needed but active nevertheless. In the case of the audio element this caused its audio to always be played, which would keep the audio from the other participant active even if the audio element handled by Talk was removed or muted. For consistency with the rest of its code now SimpleWebRTC creates the audio and video elements for a peer only if a container for them is provided. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Родитель
03de63175e
Коммит
57eb82f775
|
@ -263,35 +263,35 @@ SimpleWebRTC.prototype.disconnect = function() {
|
|||
SimpleWebRTC.prototype.handlePeerStreamAdded = function(peer) {
|
||||
const self = this
|
||||
const container = this.getRemoteVideoContainer()
|
||||
// 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)
|
||||
|
||||
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)
|
||||
this.emit('videoAdded', video, audio, peer)
|
||||
}
|
||||
|
||||
// send our mute status to new peer if we're muted
|
||||
// currently called with a small delay because it arrives before
|
||||
|
|
Загрузка…
Ссылка в новой задаче