I am trying to create a one to one video streaming Ionic app. In the app I have a button "Connect", On click of "Connect" the publisher initialized and on click of "Disconnect" button I disconnect the session.What I want it to work like :
- Click Connect - Publisher Initialized
- Click Disconnect - Session Disconnect
- Click Connect - Publisher Initialized (But here I get the error)
OpenTok:Publisher:error _connectivityAttemptPinger should have been cleaned up +0ms
OpenTok:Publisher:error OT.Publisher State Change Failed: +209ms 'PublishingToSession' cannot transition to 'PublishingToSession'
OpenTok:Publisher:error OT.Publisher.onPublishingTimeout +15s
OpenTok:GlobalExceptionHandler:error OT.exception :: title: Unable to Publish (1500) msg: ICEWorkflow +0ms
OpenTok:Session:error 1500 +0ms Session.publish :: Could not publish in a reasonable amount of time
OpenTok:Session:error 1500 +9ms Session.publish :: Session.publish :: Could not publish in a reasonable amount of time
The code is below:
tokBoxInit() {
if (OT.checkSystemRequirements() == 1) {
this.session = OT.initSession(this.apiKey, this.sessionId);
console.log(this.session);
this.session.connect(this.token, function(error) {
if (error) {
console.log("Error connecting: ", error.name, error.message);
} else {
console.log("Connected to the session.");
}
});
this.publisher = OT.initPublisher('publisher',{insertMode: 'append',width: '100%',height: '100%'});
this.publisher.on({
streamCreated: function (event) {},
streamDestroyed: function (event) {}
});
this.session.on({
sessionConnected: (event: any) => {
console.log("Session Connected Listener");
this.connected = true; // Status to show Connect/Disconnect Button
this.session.publish(this.publisher);
}
});
}
}