songz / cordova-plugin-opentok

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

Cordova is not defined #231

Closed vikas0vanvi closed 7 years ago

vikas0vanvi commented 7 years ago

i have included cordova.js in index.html still its showing cordova is not defined , i am testing it on device. any solution for this please ??

<html>
<head>
  <script type="text/javascript" src="cordova.js"></script>
  <script type="text/javascript" src="opentok.js"></script>
  <script src="js/app.js"></script>
</head>
<body ng-app="starter">
    <ion-nav-view></ion-nav-view>
</body>
</html>
vikas0vanvi commented 7 years ago

nvm i had to set timeout for this

setTimeout(function () {
// Very simple OpenTok Code for group video chat var publisher = TB.initPublisher(apiKey, 'myPublisherDiv');

    var session = TB.initSession(apiKey, sessionId);
    session.on({
        'streamCreated': function (event) {
            var div = document.createElement('div');
            div.setAttribute('id', 'stream' + event.stream.streamId);
            document.body.appendChild(div);
            session.subscribe(event.stream, div.id, { subscribeToAudio: false });
        }
    });
    session.connect(token, function () {
        session.publish(publisher);
    });
}, 10000)