TokBox Developer Evangelist here (I also help maintain the Cordova OpenTok plugin).
The Cordova OpenTok plugin uses the native OpenTok SDKs and places native iOS and Android views for the Publisher and Subscriber on top of a WebView div element. This means that the native views are superimposed on the div elements that are created in the DOM.
After you apply the CSS changes, you have to call OT.updateViews
to relay this information to the native layer indicating that the view was changed. The updateViews
method sends the DOM position, width, height, and etc over the JS bridge to the native layer which then uses that information to update the native view appropriately.
You can do something like this:
document.getElementById('publisher').style = 'display: none !important;';
OT.updateViews();
Note that in the code above, we are assuming that the publisher
div element has the Id set to publisher
. You can change the code to however you've set up your code.
Please note that hiding the view will simply hide it from the screen, but will not stop publishing of the video. To stop publishing, use either session.unpublish(publisher)
or publisher.destroy
.