Make private properties more private
calebboyd opened this issue · 4 comments
I ran into this issue when trying to load Twilio on the iPad.
Referring to these properties specifically:
https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/js/MediaStream.js#L66-L70
Twilio has a method that looks like this:
PeerConnection.prototype.attachAudio = function(callback) {
if (this.stream) {
var audioTracks = this.stream.audioTracks || this.stream.getAudioTracks();
audioTracks[0].enabled = true;
}
if (callback && typeof callback == "function") {
callback();
}
}
As you can see it errors when accessing the [0].enabled
property of this.stream.audioTracks
I've filed an issue in Twilio to prefer spec.. But it would probably be good for the module hide its private state better anyway.
Also.. Thank you for a great plugin!
Why is Twilo calling stream.audioTracks
? A MediaStream does not have such a property...
I have no idea -- it is pretty odd... I'll let you know If I hear back from them on the matter.. Thanks for making that change
Prior to Chrome 26, audioTracks
was a property on MediaStream
. Chrome 26 introduced the getAudioTracks()
method. The compat code could probably be changed to
var audioTracks = typeof this.stream.getAudioTracks === 'function'
? this.stream.getAudioTracks() : this.stream.audioTracks;
Just saw this, Thanks for the clarification @markandrus