Open ehassaan opened 5 years ago
Thanks for filing the issue @HassaanAkbar! I've also answered the question here: https://stackoverflow.com/questions/54751291/initpublisher-creates-a-publisher-object-but-does-not-initialize-camera/54755174#54755174
I'll update you as we make progress 😄
Thanks @msach22 But i think the issue is not just related to permissions. I just created two buttons. One for initializing publisher and one for connecting session and start publishing. I gave all the permissions from the phone settings. Still the publisher isn't able to initializing. It just shows a placeholder image like before.
I
InitTB is called in constructor.
initTB() {
this.session = OT.initSession(this.apiKey, this.sessionId);
OT.addEventListener('exception', function (e) {
console.log("----EXCEPTION: ", e.message);
this.error = e.message;
});
this.session.on({
streamCreated: (event) => {
this.session.subscribe(event.stream, 'subscriber');
OT.updateViews();
},
streamDestroyed: (event) => {
console.log(`Stream ${event.stream.name} ended because ${event.reason}`);
OT.updateViews();
}
});
}
initPublisher() {
this.publisher = OT.initPublisher('publisherDiv');
}
startPublish() {
this.session.connect(this.token, (error) => {
console.log("connect error:", error);
console.log("publisher:", this.publisher);
this.session.publish(this.publisher);
});
}
@HassaanAkbar If you check the Android code - you will see that the native publisher is initialized, but the view is not super-imposed on the DOM element until the publish
method is called:
https://github.com/opentok/cordova-plugin-opentok/blob/master/src/android/OpenTokAndroidPlugin.java#L243
@msach22 any solution for this issue
@alaghusun60 I have a fix locally for this where the permissions are requested when the initPublisher
is called and not when publish
is called.
Hi, I found a simple solution change this: for this:
@gutierre69 using the CDN link would mean that you're using the OpenTok JS SDK and not the Cordova plugin.
@alaghusun60 I have a fix locally for this where the permissions are requested when the
initPublisher
is called and not whenpublish
is called.
@msach22 Could you please share the local fix code? I managed to make it work the first time. But when I repaeat a call, the camara seems to not initialize.
@msach22 Do you have any update?
Thanks!
Sorry folks, I'm not longer maintaining this project at this time so I'm unable to help here.
Bug Report
initPublisher creates a publisher object but does not intialize camera
Steps to reproduce
cordova-android: "^7.1.4" cordova-plugin-opentok: ^3.4.3 Android Device: Xiamo A1, Android 9 Node LTS v10.15.1 Also tested on emulator Android 7.0