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.js is not working ionic2 #232

Open vsrboth opened 7 years ago

vsrboth commented 7 years ago

I am trying to use this cordova plugin for ionic2 project; unfortunately, I am unable to make it. It doesn't seem to work. Please kindly find the following code example:

import { Component } from '@angular/core';
import { OpentokService } from '../../services/opentok-service';

declare var TB: any;

this.session = TB.initSession(this.apiKey, this.sessionId);
    this.session.on('streamCreated', (event) => {
      this.session.subscribe(event.stream, 'subscriber', {
        insertMode: 'append',
        width: '100%',
        height: '100%'
      });
    });

    this.session.on('sessionDisconnected', (event) => {

    });

    this.session.connect(this.token, (error) => {
      if (!error) {
        let publisher = TB.initPublisher('publisher', {
          insertMode: 'append',
          width: '100%',
          height: '100%'
        });

        this.session.publish(publisher);
      } else {
        alert('There was an error connecting to the session' + error.message);
      }
    });

Can anyone offer a hand on this? Thank you so much.

bmavi commented 7 years ago

Hello Dear,

Is your solution for opentok working with ionic 2 ? I'm also updating mine and getting issue.

Thanks

B Mavi

vsrboth commented 7 years ago

@bmavi sorry for late. I have found a way to make it working using opentok.js framework instead of this cordova plugin.

It's quite easy to integrate opentok.js in ionic2 :) Be sure to check permission on your android mobile phone during your development (run on a physical android device).

jomora15 commented 7 years ago

Hi @vsrboth Can you give me an example of how to integrate opentok with Ionic 2 ?? I've been trying for some time, and I'm not doing it

andreportaro commented 6 years ago

Please, I also need help on integrating on Ionic2. I'm running on a device; the device cant find opentok.js

msach22 commented 6 years ago

Hey @vsrboth @jomora15 @bmavi @andreportaro here's a basic 1:1 application using OpenTok and Ionic: https://github.com/opentok/opentok-ionic-samples

You have to run ionic serve so opentok.js can be copied into your www folder. After that, you can prepare for the platform.

You can also find the updated plugin using OpenTok iOS and Android 2.12.0 SDKs here: https://github.com/opentok/cordova-plugin-opentok

Please also note that not all of the publisher properties such as insertMode are available. The supported properties are listed here: https://github.com/opentok/cordova-plugin-opentok/blob/master/docs/ot.md#initPublisher

sm20030 commented 6 years ago

Have any of you tried and made Tokbox annotations work with iOS? In Android it works fine but in the latest version 10.3.3 of iOS using TokBox SDK Version 2.12.1 our Cordova app crashes when opening the video call. This only happens if the other party on the web has annotations turned on. If the annotations are off then no crash. Strange issue!

Error logs reveal a bunch of runtime memory related issues with only human readable information was "AudioToolbox". We thought this may be a permission issue but couldn't explain why it worked when annotations are turned off.

Note: Annotations have never worked in iOS. We can't seem to get the annotation layer on top of Tokbox video layer. This makes sense as the video player is not probably HTML based.

sm20030 commented 6 years ago

Never mind, looks like annotations are not supported even as a feature yet.

https://github.com/opentok/accelerator-annotation-js/issues/41

mfossel commented 6 years ago

@sm20030 Any luck solving this problem? we are also experiencing it. We can enter an already started call but whenever a new stream is created our iOs app crashes?

I see that you mention annotations, how do we turn these off?