Closed GMacAussie closed 2 years ago
This is a bit more vexing than we initially thought. In essence, we are trying to make sure that having no initial/switching off background effects does not incur the CPU penalty (as mentioned in the pause API).
We have come to the conclusion that the only way to achieve this is by killing the existing publisher and recreating with the required videoSource (being the default camera or background effect output). This turns out to be a bit of an issue for us as we are using the AngularJS OpenTok wrapper (https://github.com/aullman/OpenTok-Angular), and we see some issues with the DOM element being destroyed - we are not sure why preventDefault() is failing to stop that but we are continuing to investigate.
Also, note that using setVideoSource() against the publisher won't work when trying to set the background effect processor output source since it is marked as 'custom' which the OpenTok library rejects (I believe it is the 1400 error).
To summarize:
Suggestions welcome.
Sorry for the all text but I figure I might as well finish this off. We implemented the publisher w/ DOM create/destroy by using AngularJS ng-if
. I have tempered my original question re a No-Op/Null/Pass-Through background effect however with some observations:
This library is pretty general, and can be used for any video source for any purpose, not just OpenTok. As such, it has no clue about 'publishers' a la OpenTok;
Given (1), it is the implementors responsibility to 'glue' this library into use with the OpenTok publisher, being input stream, output stream and the publisher object. This means that the implementor is responsible for set up/tear down of the effect;
To be able to have a No-Op/Null/Pass-Through background effect would require that this library is publisher-aware. That is, it would take care of getting and setting the publisher video source. It would also require some tinkering with the OpenTok publisher implementation to allow setVideoSource()
to work - it won't currently as it expects an actual camera not a 'custom' video track. It raises a 1400/SET_VIDEO_SOURCE_FAILURE in that case. The only other way to change publisher video source is to perform initPublisher
with the changed videoSource
setting which is a pretty big hammer with implications.
We are incorporating this library into our product (thank you!), however it seems there are a couple of choices with the background effect management:
Given (3) is not applicable, is it possible to have a No-Op/Null/Pass-Through background effect that would do nothing - including not loading assets - which can then be loaded over later on if the user selects an actual background effect?