【问题标题】:Using PhoneRTC with Worklight将 PhoneRTC 与 Worklight 一起使用
【发布时间】:2026-02-10 09:35:01
【问题描述】:

我正在尝试使用 PhoneRTC 在 Worklight 中实现视频聊天。首先,我将 Java 文件添加到我的 Worklight 应用程序中,并将该功能添加到我的 config.xml 中。问题是当我在main.js 中使用PhoneRTC 函数时,我在转换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

【问题讨论】:

  • 重复代码有什么原因吗?
  • 很抱歉,这只是一个错误。你能帮我集成phonertc,并在我的worklight应用程序中调用他的函数
  • 代码不包含任何可调试的内容 - 提供您的 Worklight 项目。
  • 这是我的工作灯项目,感谢您的帮助 idan mega.co.nz/…
  • 项目包含错误:项目 'ChatPeerToPeerAndroid' 缺少必需的库:'C:/Users/gara/Desktop/phonertc-master/libs/android/libjingle_peerconnection.jar' - 提供缺少的 JAR。

标签: javascript ibm-mobilefirst cordova-plugins phonertc


【解决方案1】:

在 Worklight 6 中与第 3 方 Cordova 插件集成很困难,并且不能保证成功。

但是,在 MobileFirst 7.1 中,您现在可以创建“纯 Cordova”应用程序,其中提供的 SDK 是一个 Cordova 插件,从本质上让您摆脱之前由 Worklight Hybrid 应用程序架构施加的任何限制。

使用更新的应用程序模型(或者更确切地说,现在是“标准”),您可以简单地按照 PhoneRTC 说明将 PhoneRTC Cordova 插件安装到您的 Cordova 应用程序中。

在这里阅读更多:https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/hello-world/integrating-mfpf-sdk-in-cordova-applications/

【讨论】: