songz / cordova-plugin-opentok

Cordova Plugin for OpenTok - add webrtc video to your iOS or Android App
Other
162 stars 270 forks source link

Opentok works fine on Nexus 5 but not on Galaxy S3 #86

Open quentinNex opened 10 years ago

quentinNex commented 10 years ago

Hi,

I am using the last version of the opentok plugin for Phonegap 3.5 and I have an issue. The video works fine on my Nexus 5 but the application freezes when I start to publish on my Samsung Galaxy S3.

It does not send any error messages in the log but the last messages are the following

D/CordovaLog(9744): file:///android_asset/www/opentok.js: Line 213 : JS Lib: creating publisher - 
I/Web Console(9744): JS Lib: creating publisher - :213
D/CordovaLog(9744): file:///android_asset/www/opentok.js: Line 196 : 3
I/Web Console(9744): 3:196
D/CordovaLog(9744): file:///android_asset/www/opentok.js: Line 169 : JS: Objects being updated in TBUpdateObjects
I/Web Console(9744): JS: Objects being updated in TBUpdateObjects:169
D/CordovaLog(9744): file:///android_asset/www/opentok.js: Line 174 : JS: Object updated
I/Web Console(9744): JS: Object updated:174
D/CordovaLog(9744): file:///android_asset/www/opentok.js: Line 176 : JS sessionId: TBPublisher
I/Web Console(9744): JS sessionId: TBPublisher:176
D/CordovaLog(9744): file:///android_asset/www/opentok.js: Line 196 : 3
I/Web Console(9744): 3:196
D/OTPlugin(9744): Initialize Plugin
W/ResourceType(9744): No package identifier when getting name for resource number 0x00000064
D/OTPlugin(9744): Found CordovaView ****** org.apache.cordova.CordovaWebView{426f7db8 VFEDH.CL .F...... 0,0-720,1230 #64}
I/OTPlugin(9744): updateView
08-29 18:00:26.025: I/OTPlugin(9744): initPublisher
I/OTPlugin(9744): view running on UIVIEW!!!
I/OTPlugin(9744): addEvent
I/OTPlugin(9744): adding new event - publisherEvents
D/dalvikvm(9744): Trying to load lib /data/app-lib/com.gestionsinistres.saretec-1/libopentok.so 0x426e8b90
I/OTPlugin(9744): initSession
0I/OTPlugin(9744): created new session with data: ["44959442","2_MX40NDk1OTQ0Mn5-VHVlIEF1ZyAyNiAwMTo0MTowOCBQRFQgMjAxNH4wLjAwMzQxODUwNTJ-fg"]
I/OTPlugin(9744): Added shared lib /data/app-lib/com.gestionsinistres.saretec-1/libopentok.so 0x426e8b90

As you can see the thing the phone is trying to do is adding the libopentok.so lib.

I didn't manage to find a similar issue on the net so I post it here. Any ideas ?

Here is the relevant Javascript code :

function connexionOpenTok() {   
    var sessionSub;
    var sessionPub;
    var publisher;

    console.log('Initialisation Visio...');

    var subDiv = '<div id="visioSubscriber"></div>'
    var subPub = '<div id="visioPublisher"></div>'

    $('#visioContainer').append(subDiv);
    $('#visioContainer').append(subPub);

    var apiKey = "SECRET"; 

    var sessionClientId = "2_MX40NDk1OTQ0Mn5-VHVlIEF1ZyAyNiAwMTo0MTowOCBQRFQgMjAxNH4wLjAwMzQxODUwNTJ-fg";

    var sessionClientPubToken = 'T1==cGFydG5lcl9pZD00NDk1OTQ0MiZzaWc9N2E1ZmYxOWMzNTAwOTAzYWIwYThmYWU0NTczNzdjMzgzZWJmYzRmMDpyb2xlPXB1Ymxpc2hlciZzZXNzaW9uX2lkPTJfTVg0ME5EazFPVFEwTW41LVZIVmxJRUYxWnlBeU5pQXdNVG8wTVRvd09DQlFSRlFnTWpBeE5INHdMakF3TXpReE9EVXdOVEotZmcmY3JlYXRlX3RpbWU9MTQwOTA0MjUzNyZub25jZT0wLjk5NDc5ODI1NzU3OTM3MTYmZXhwaXJlX3RpbWU9MTQxMTYzNDQyOA==';

    var sessionExpertId = '2_MX40NDk1OTQ0Mn5-VHVlIEF1ZyAyNiAwMTo0MjozNCBQRFQgMjAxNH4wLjQwMDE0MTA2fn4';
    var sessionExpertSubToken = 'T1==cGFydG5lcl9pZD00NDk1OTQ0MiZzaWc9YjJkNjAwZjY4Y2U1NmM4ZTVkZjJkNGIzNmU5YmI3Y2M1OGRlN2MwNTpyb2xlPXN1YnNjcmliZXImc2Vzc2lvbl9pZD0yX01YNDBORGsxT1RRME1uNS1WSFZsSUVGMVp5QXlOaUF3TVRvME1qb3pOQ0JRUkZRZ01qQXhOSDR3TGpRd01ERTBNVEEyZm40JmNyZWF0ZV90aW1lPTE0MDkwNDI1NzUmbm9uY2U9MC45NjE4MTA0NDIwNDQ3NTYmZXhwaXJlX3RpbWU9MTQxMTYzNDQyOA==';

    var width = $(window).width();
    var height = $(window).height();

    publisher = OT.initPublisher("visioPublisher", {width: width/5, height: height/5, zIndex: 3, publishAudio: false} );

    sessionPub = OT.initSession(apiKey, sessionClientId);

    sessionPub.connect(sessionClientPubToken, function(error) {
        console.log('lancement du publish');        
        sessionPub.publish(publisher);  

        sessionSub = OT.initSession(apiKey, sessionExpertId);

        sessionSub.once("streamCreated", function(event) {
            console.log('lancement du subscribe lance');
            sessionSub.subscribe(event.stream,"visioSubscriber", {width: width, height: height*0.8, zIndex: 2} );   
        }); 

        sessionSub.connect(sessionExpertSubToken, function(error) {
            if (error) {
                console.log(error);
            } else {
                console.log('connexion Expert Session OK');         
            }
        });         
    }); 
}
ghost commented 10 years ago

Seems like the latest opentok android sdk 2.2.1.jar have some issues. I was not able to publish videos using the latest version of the plugin on S3.. I downgraded the plugin to opentok android sdk 2.0 .jar, which resolved the issue.

songz commented 10 years ago

hmmm... interesting. I'll try to get my hands on an S3 to test.