Agreed.
> 2. The browser has a bunch of I/O resources (cameras,
> microphones, displays, etc.).
> 3. The JS can attach to these I/O resources, but some of
> them cannot be shared (this is the only place where
> different pages interact.) So, it might or might not be
> possible for two pieces of JS to share the same camera.
Right - within the same JS object (not multiple tabs), it could clone
the MediaStream from the camera and send the data to multiple
PeerConnections (i.e. mesh conference).
If the device wanted is held by another tab, getUserMedia() and the user
interface could intervene to allow stealing of the camera/mic (and
muting of the other call); see #3 above. This could be invisible to the
other app (muting of the camera is outside of the JS's control anyways -
the user must always be able to mute camera/mic without going through
the JS app) - it would just return an "muted" image/silence instead of
real camera data.
This usecase is actually important - if you're on a call with someone
using tab A on Service 1, and a call comes in on tab B via Service 2,
what happens? (You're chatting on the interstellar communicator with
James Kirk of the Enterprise, when a call comes in on WebRTC_Skype from
your mother, which you *must* take...)
I think automatically "muting" all existing users of the selected
camera/mic is the correct solution (at least if the user selected the
in-use camera in the permission/cam-selection UI or selected Answer With
Video in an 'approved-to-access-camera-directly' app). To un-mute
(after ending the new call, or to switch back to the original call
without ending the new call) you'll probably need to interact with the
browser chrome muting controls. We could also allow an app to request
un-mute (which would prompt the user), and we should also notify the app
it was muted. So, no automatic un-mute if the new call ends.
In cases where the user selects the camera in a chrome preview, it
should be somehow marked as in-use. If it's allowed direct access, the
app should have some way to know the camera requested was already
in-use, and have the option to override (steal/mute) or not (which
speaks to needing some way to specify this in the getUserMedia()
constraints).
> 4. A piece of JS can therefore set up a PeerConnection
> and connect it to the other side, with it being plumbed
> to any resources that the JS can acquire.
Right.
>
> So, what are the implications of this:
> 1. Any piece of JS can create a new PeerConnection with DataChannel
> only, no matter how many already exist, including multiples in the same
> tab.
Yup. And this is where the 51-call limit to SIPCC comes in; 51 real
calls - not so likely; 51 DataChannel-only calls (in a game) - possible,
or in a combination of a few games.
Also, a game or other similar app might proactively connect you in an
'idle-but-open' state (with audio/video negotiated but inactive) to
other players nearby to allow those connections to be warmed up quickly
as needed (perhaps using DataChannel for direct renegotiation to enable
audio/video). Perhaps a stretch, but people will figure out
interesting/unexpected things to do with an enabling API like WebRTC.
> 2. Any piece of JS can create a new PeerConnection with
> incoming A/V only, no matter how many already exist, including multiples
> in the same tab.
Makes sense.
> 3. Any piece of JS can acquire a handle to a camera and/or microphone
> as long as at least one of those devices is free and use it to make a
> call.
And perhaps even if it isn't free, see above.
> What I think remains to be determined is whether one can have ahared
> access to a microphone or camera. But that's a question for getUserMedia(),
> not for PeerConnection.
Shared-video/mic between apps/tabs is a possible idea, but rather lower
utility and higher risk/complexity. But we should consider it in the UI
and permissions discussions.
> Note that I'm not suggesting that a given calling site must allow you to
> have multiple concurrent calls. For instance, GoogleTalk will not do so,
> no matter how many tabs you open. However, that's something that's
> implemented in JS, not in C++ and is at the discretion of the site.
Right. Within one app/tab, the JS can redirect the MediaStream where it
wants, and manage multiple PeerConnections/calls as it wishes (or
doesn't wish).
Randell Jesup