I'm trying to implement a video chat in Worklight using PhoneRTC. First, I add the Java files to my Worklight application and add the feature in my config.xml
. The problem is that when I use the PhoneRTC function in my main.js
I get an error in the conversion Converting circular structure to JSON ..
Here is my main.js
function wlCommonInit() {
}
var config = {
isInitiator : true,
stun : {
url : 'stun:stun.l.google.com:19302'
},
streams : {
audio : true,
video : false
}
}
var parameters = {
container : $('#videoContainer'),
local : {
position : [ 0, 0 ],
size : [ 100, 100 ]
}
};
function launch() {
if (WL.Client.getEnvironment() == WL.Environment.PREVIEW) {
WL.SimpleDialog
.show(
"Cordova Plugin",
"Please run the sample in either a Simulator/Emulator or physical device to see the response from the Cordova plug-in.",
[ {
text : "OK",
handler : function() {
WL.Logger.debug("Ok button pressed");
}
} ]);
} else {
cordova.exec(RTCSuccess, RTCFailure, "PhoneRTCPlugin", "setVideoView",parameters);
}
}
function RTCSuccess(data) {
WL.SimpleDialog.show("Response from plug-in", data, [ {
text : "OK",
handler : function() {
WL.Logger.debug("Ok button pressed");
}
} ]);
}
function RTCFailure(data) {
WL.SimpleDialog.show("Response from plug-in", data, [ {
text : "OK",
handler : function() {
WL.Logger.debug("Ok button pressed");
}
} ]);
}
Here is the complete project : https://mega.co.nz/#!gsAXga6L!Rc7yJDzj5GhQA-8gV45gFHFk3jPGmmRN0j5gV3ZihRw