- From: Harald Alvestrand <harald@alvestrand.no>
- Date: Mon, 19 Sep 2011 16:18:50 +0200
- To: Adam Bergkvist <adam.bergkvist@ericsson.com>
- CC: "Tommy Widenflycht (ᛏᚮᛘᛘᚤ)" <tommyw@google.com>, "public-webrtc@w3.org" <public-webrtc@w3.org>
On 09/19/2011 04:01 PM, Adam Bergkvist wrote: > On 2011-09-15 20:08, Tommy Widenflycht (ᛏᚮᛘᛘᚤ) wrote: >> Suggestion: can the enabled attribute of a MediaStreamTrack take into >> account its own state as well as its parent(s) state? This would make >> it very easy to find out if a track is on or off. >> >> Example: >> >> var mediaStream2 = new MediaStream(mediaStream1); >> >> // mediaStream1.tracks[0].enabled == true // >> mediaStream2.tracks[0].enabled == true >> >> mediaStream1.tracks[0].enabled = false; >> >> // mediaStream1.tracks[0].enabled == false // >> mediaStream2.tracks[0].enabled == false >> >> mediaStream2.tracks[0].enabled = false; >> >> // mediaStream1.tracks[0].enabled == false // >> mediaStream2.tracks[0].enabled == false >> >> mediaStream1.tracks[0].enabled = true; >> >> // mediaStream1.tracks[0].enabled == true // >> mediaStream2.tracks[0].enabled == false > Since your tracks can have different states in the parent and the child, > it's clearly separate MediaStreamTrack instances, but they are still > related somehow. It seems from your example that tracks in forked > streams have a tri-state, "not set" (ask parent), "enabled", and > "disabled", is that correct? This would make it possible to build tree > structures of MediaStreamTracks where you would have to traverse the > tree to find the enable/disable state of a track. I don't think it's a tri-state, you only have to ask parent if it's enabled. If this were C++, I would claim that enabled() has to be an accessor, not an exposed variable, since it does a computation to return its value. Not sure how this is normally done in Javascript. Since the value of "enabled" doesn't depend on just what "enabled" is set to, this statement: mediastream2.tracks[0].enabled = mediastream2.tracks[0].enabled might cause a change of state. That's confusing. > I can see a point with a master enable/disable switch here, but > depending on which track in the tree you enable or disable it would have > a different number of side-effects which could be confusing for web > developers. > > BR > Adam
Received on Monday, 19 September 2011 14:19:30 UTC