Closed ibc closed 9 years ago
I need to do some checking about that. I will come back to you by tomorrow evening.
OK, that was quick: 1 - The Temasys plugin does not really support the "prototype" interface. From my reading, it is, in part due to a ActiveX/NPAPI limitation (not something we can influence) I suppose it would be possible to fake it, but I have doubts on the stability it would have.
2 - In this specific case, the MediaStreamTrack object is actually just a "fake" API that we create in the adapter. It's not un the plugin itself; See the following code from the adapter: MediaStreamTrack = {}; MediaStreamTrack.getSources = function (callback) { AdapterJS.WebRTCPlugin.callWhenPluginReady(function() { AdapterJS.WebRTCPlugin.plugin.GetSources(callback); }); We only added this API to provide access to MediaStreamTrack.getSources. Again, it's probably possible to fake the prototype, but since the MediaStreamTrack is actually different from myLocalStream.getVideoTracks()[0].class, I don't think this is the best idea.
3 - I actually disabled the stop API from the mediastreamtracks because it brought big stability issues. We have an open ticket, but it is not trivial and I don't have an ETA on this one. MediaStream.stop should work.
Hope this helps.
Hi, I understand. However it may be better if MediaStreamTrack
is defined in adapter.js as a function
(so it has prototype
) and then fill it with fake functions (those supported by the plugin when dealing with the like-MediaStreamTrack object):
MediaStreamTrack = function() {};
MediaStreamTrack.prototype.stop = function() {};
etc
Successfully tested the following code:
MediaStreamTrack = function() {};
MediaStreamTrack.prototype.stop = function() {};
MediaStreamTrack.getSources = function (callback) {
AdapterJS.WebRTCPlugin.callWhenPluginReady(function() {
AdapterJS.WebRTCPlugin.plugin.GetSources(callback);
});
};
However:
1) You will still not be able to call localStream.getVideoTracks().stop(),
2) Given the way the NPAPI/ActiveX interface works, I don't think I will be to set MediaStreamTrack.prototype.stop = the actual class function
in the future...
Therefore I am not sure this makes sense.
2015-01-05 8:51 GMT+01:00 johache notifications@github.com:
Successfully tested the following code:
MediaStreamTrack = function() {};MediaStreamTrack.prototype.stop = function() {};MediaStreamTrack.getSources = function (callback) { AdapterJS.WebRTCPlugin.callWhenPluginReady(function() { AdapterJS.WebRTCPlugin.plugin.GetSources(callback); }); };
However: 1) You will still not be able to call localStream.getVideoTracks().stop(),
Ok, my fault, I didn't ask for an empty stop() method, but just for a prototype object. In my code I check for (typeof MediaStreamTrack.prototype.stop === 'function') in order to call stop() on each track or call it on the MediaStream (deprecated in the spec). So by just adding:
MediaStreamTrack = function() {};
would be enough :)
But if MediaStreamTrack.prototype.stop does exists and is a function, then my check will fail.
2) Given the way the NPAPI/ActiveX interface works, I don't think I will be
to set MediaStreamTrack.prototype.stop = the actual class function in the future...
Therefore I am not sure this makes sense.
Agreed.
— Reply to this email directly or view it on GitHub https://github.com/Temasys/AdapterJS/issues/27#issuecomment-68677242.
Iñaki Baz Castillo ibc@aliax.net
But you'd still rather have
MediaStreamTrack = function() {};
than
MediaStreamTrack = {};
right?
I have no issue with that. @serrynaimo @ncurrier JS gurus, can I have it validated by any one of you?
Sure. If MediaStreamTrack
is not a function then it has no prototype
.
Any updates on this?
In order to check how to properly close/stop a MediaStream I check whether the
MediaStreamTrack.prototype.stop
exists or not. However theMediaStreamTrack
implementation of the plugin has noprototype
(it isundefined
).Would it be easy to add it? Otherwise I'll use another approach to check the existence of the
stop
method.