I am using OpenTok and I am trying to swich with video display on/off. So I use the following pubOptions
var pubOptions;
if (show_video)
{
pubOptions= null;
}
else
{
pubOptions= { videoSource: null, style: {buttonDisplayModeo: 'off'}};
}
//Replace the first parameter with the replacement element ID:
session.on("streamCreated", function(event)
{
session.subscribe(event.stream);
});
session.connect(token, function(error)
{
publisher = OT.initPublisher("publisher_text",pubOptions);
session.publish(publisher);
});
But the video window is displayed in both cases.
Look at the following documentation: https://tokbox.com/opentok/tutorials/audio-video/js/#publish_audio_video_only
If you want to disable video after publishing, you'll need:
publisher.publishVideo(false);