我正在尝试使用 PhoneRTC 在 Worklight 中实现视频聊天。首先,我将 Java 文件添加到我的 Worklight 应用程序中,并将该功能添加到我的config.xml
. 问题是,当我在我的手机中使用 PhoneRTC 功能时,我main.js
在转换中遇到错误Converting circular structure to JSON ..
这是我的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");
}
} ]);
}
这是完整的项目:https ://mega.co.nz/#!gsAXga6L!Rc7yJDzj5GhQA-8gV45gFHFk3jPGmmRN0j5gV3ZihRw