Hello,
we are implementing video chatting between 2persons. here enable/disable buttons is there. when i click enable button video chatting ok, but when click disable button showing error like "
The stream was unable to connect due to a network error. Make sure your connection isn't blocked by a firewall
". pls give some solution on it..
I use the latest opentok Android SDK to development an application. My purpose is to provide a button to let user can publish / unpublish camera. It works to unpublish the camera OT.initPublisher("publisherContainer", publisherOptions).publishVideo(false);, but it doesn't work to republish when I use OT.initPublisher("publisherContainer", publisherOptions).publishVideo(true);.
<script src="//static.opentok.com/webrtc/v2.2/js/opentok.min.js" ></script>
$(document).ready(function () {
var apikey = "xxxxx";
var sessionI = "@Session["SessionId"]";
var token = "@Session["Token"]";
var videoOn = true;
var session = OT.initSession(apikey, sessionI);
session.connect(token, function (err) {
if (err) {
alert("Vendor video call disconnected");
}
else {
var publisherOptions = {
insertMode: "append",
height: "260px",
width: "450px",
}
var publisher = OT.initPublisher("publisherContainer", publisherOptions);
$('#disablevideo').click(function () {
if (videoOn == true)
{
publisher.destroy();
publisher = OT.initPublisher("publisherContainer", publisherOptions).publishVideo(false);
videoOn = false;
session.publish(publisher);
}
else {
publisher.destroy();
publisher = OT.initPublisher("publisherContainer", publisherOptions).publishVideo(true);
videoOn = true;
session.publish(publisher);
}
});
session.publish(publisher);
}
});
session.on("streamCreated", function (event) {
var options = {
insertMode: 'append',
height: "450px",
width: "720px",
}
session.subscribe(event.stream, 'containerElementId', options)
$("#vendoename").hide();
clearInterval(interval);
});
thank you.