Open jlengstorf opened 9 years ago
This sounds odd... the local video should never be automatically attached to anything but the element designated by localVideoEl. How are you creating the connection back to the admin? The normal way would be to add it to the existing connection but since renegotiation is not supported yet...
Sorry, it is attached to the element designated by localVideoEl
— I modified those functions to select different elements based on context, but it's still using the correct elements. That all behaves normally.
The weird part is that audio controls are completely dead for some reason. (Especially the fact that I can't directly target the video
element with vanilla JS using the muted
element or volume settings.)
In case it helps, here's how I modified getLocalVideoContainer()
:
SimpleWebRTC.prototype.getLocalVideoContainer = function () {
var cfg = this.config;
// Configures which element should hold the local video
var whichEl = cfg.videoElements.local;
// Admin needs to feed local into the admin element
if (cfg.isAdmin) {
whichEl = cfg.videoElements.admin;
}
// The attendee selected for solo needs local fed into that element
if (cfg.isSoloAttendee) {
whichEl = cfg.videoElements.solo;
}
this.logger.info('isAdmin: ', cfg.isAdmin);
this.logger.info('Local Video Container: ', whichEl);
var el = this.getEl(whichEl);
if (el && el.tagName === 'VIDEO') {
el.oncontextmenu = function () { return false; };
return el;
} else if (el) {
var video = document.createElement('video');
video.oncontextmenu = function () { return false; };
el.appendChild(video);
return video;
} else {
return;
}
};
After posting the last comment, I realized I wasn't dumping the config.localVideo
options to check them.
I was passing mirror: false
and leaving everything else to defaults. I just explicitly added the other settings:
localVideo: {
autoplay: true,
mirror: false, // We do this manually because otherwise it messes with styles
muted: true
}
And now it behaves as expected, including responding to the mute()
and unmute()
commands.
So it appears that the issue is with passing config to attachMediaStream()
and, somehow, causing the audio control methods to fail when all config settings aren't explicitly set.
Am I wrong in assuming that these have default settings? Or am I breaking it by overriding the config object with just one property?
that sounds really odd... attachMediaStream should use it's own defaults that just override in https://github.com/HenrikJoreteg/attachMediaStream/blob/master/attachmediastream.js#L12-16
The only thing I can imagine that goes wrong is attachMediaStream creating a new element and then the rest of the things being confused about which element to mute.
It does sound odd, but explicitly setting those config options removed the issue — that wouldn't do anything to tell the app which element should be muted that wasn't already being done, I imagine.
Looking at the code, though, it doesn't seem possible to leave defaults blank, so... magic?
When starting video at a later time with
webrtc.startLocalVideo()
, I'm seeing an issue where the local video doesn't mute. It also doesn't respond towebrtc.mute()
.I'm working on a modified copy of SimpleWebRTC, so there is a possibility that I've introduced this bug, but I haven't touched any of the actual RTC code.
The way I've set up the app is:
webrtc.startLocalVideo()
on their browserThe video loads fine, and from the admin side there is no issue.
However, on the user side, the video is not muted, causing echo and feedback.
webrtc.config.localVideo.muted
istrue
.In addition, calling
webrtc.mute()
on the user's computer has no effect. Adding themuted
attribute to thevideo
element also doesn't fix the issue. The only way to get the audio to stop — as far as I can tell, at least — is to actually delete thevideo
element from the DOM.I'm not sure if any of the below is helpful, but this is what the admin's browser received for
setRemoteDescription
according tochrome://webrtc-internals/
:Please let me know if I can add any additional info here to help. I'm not familiar enough with WebRTC to get too far into this, so any help is greatly appreciated.
Thanks!