0

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

Gara
  • 1
  • 3
  • Any reason why the code is duplicated? – Idan Adar Mar 25 '15 at 16:26
  • i'm sorry it's just a mistake. can you help me i have problem to integrate phonertc, and call his function in my worklight application – Gara Mar 25 '15 at 16:51
  • The code is not containing anything that can be debugged - provide your Worklight project. – Idan Adar Mar 25 '15 at 17:23
  • here is my worklight project , thanks for your help idan https://mega.co.nz/#!lh42nSaC!CfLW0_DX4WlSuuXaeliOgQBKGe8DfpANQX91FpiJa6c – Gara Mar 25 '15 at 17:36
  • The project contains errors: Project 'ChatPeerToPeerAndroid' is missing required library: 'C:/Users/gara/Desktop/phonertc-master/libs/android/libjingle_peerconnection.jar' - provide the missing JAR. – Idan Adar Mar 25 '15 at 17:42
  • sorry you can download the jar from here https://mega.co.nz/#!5woB2SYK!ffLYx79v5TcI3q8iGDrQergm1804BHbbDvGg-SiQr0Y , it's phonertc external jar for – Gara Mar 25 '15 at 17:47
  • I'm getting a different error: processMessage failed: Error: InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('button') does not support selection. – Idan Adar Mar 26 '15 at 06:04
  • okéy, can you jute try to integrate phonertc in any worklight application this the link to the library https://github.com/alongubkin/phonertc you can find the necessary library in /src/android/com/dooble/phonertc/ and the jar phonertc/libs/android/ , thanks alot for your help – Gara Mar 26 '15 at 09:23
  • can anybody else help me to integrate phonertc in worklight for android application – Gara Mar 26 '15 at 09:34
  • so Idan can we integrate phonertc with worklight using cordova.exec or existe other solution can you help me to resolve this problem – Gara Mar 26 '15 at 11:39
  • If I had an answer I would've written it, no? – Idan Adar Mar 26 '15 at 11:45

1 Answers1

0

In Worklight 6 integrating with 3rd party Cordova plug-ins is difficult and will not guarantee success.

However in MobileFirst 7.1 you can now create "pure Cordova" applications where the provided SDK is a Cordova plug-in, essentially untying you from any limitations previously imposed by the Worklight Hybrid application architecture.

With the updated application model (or rather, "standard" now) you could simply follow the PhoneRTC instructions as-is to install the PhoneRTC Cordova plug-in into your Cordova application.

Read more here: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/hello-world/integrating-mfpf-sdk-in-cordova-applications/

Idan Adar
  • 44,156
  • 13
  • 50
  • 89