{"action":"created","issue":{"url":"https://api.github.com/repos/songz/cordova-plugin-opentok/issues/186","labels_url":"https://api.github.com/repos/songz/cordova-plugin-opentok/issues/186/labels{/name}","comments_url":"https://api.github.com/repos/songz/cordova-plugin-opentok/issues/186/comments","events_url":"https://api.github.com/repos/songz/cordova-plugin-opentok/issues/186/events","html_url":"https://github.com/songz/cordova-plugin-opentok/issues/186","id":91815477,"number":186,"title":"Loosing functionality after subscribing to a stream.","user":{"login":"G-Penchev","id":10497665,"avatar_url":"https://avatars.githubusercontent.com/u/10497665?v=3","gravatar_id":"","url":"https://api.github.com/users/G-Penchev","html_url":"https://github.com/G-Penchev","followers_url":"https://api.github.com/users/G-Penchev/followers","following_url":"https://api.github.com/users/G-Penchev/following{/other_user}","gists_url":"https://api.github.com/users/G-Penchev/gists{/gist_id}","starred_url":"https://api.github.com/users/G-Penchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/G-Penchev/subscriptions","organizations_url":"https://api.github.com/users/G-Penchev/orgs","repos_url":"https://api.github.com/users/G-Penchev/repos","events_url":"https://api.github.com/users/G-Penchev/events{/privacy}","received_events_url":"https://api.github.com/users/G-Penchev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-29T14:13:07Z","updated_at":"2015-06-30T08:45:36Z","closed_at":null,"body":"I have a implemented a video conferencing functionality to a web application by using this plugin. My main goal is to make it work on iPad. All the code is placed in a separate file and is being initialized when the video conference view is invoked. I listen for the deviceready event and do all the stuff by the book. \r\n\r\nI have three buttons: mute voice, end the call and switch between front and rear cameras which invoke methods from session and publisher objects. Everything is working as it should in the browser.\r\n\r\n\r\nOn a device though at the specific moment when a user subscribes to a stream all of the functionality stops working. The code is not blocking and there is no error thrown which means that the session and publisher objects still reference opentok.js. I can still use the application, but I cannot mute or even end the call because when session.disconnect() is called nothing happens. Not even the TB.updateViews() works. When the orientation is changed the video windows are not resizing as they have before another user joined the session. All the rest of the javascript works, and the app switches to a different view, but the native video windows are still on top. \r\n\r\nThe DOM elements are all created dynamically, here is a sample of the code ...\r\n\r\nfunction initiateConsult(scope, element) {\r\n    var apiKey = \"blablabla\",\r\n        sessionId = \"bla\",\r\n        token = \"bla bla\",\r\n        publisher,\r\n        session;\r\n\r\n    session = TB.initSession(apiKey, sessionId);\r\n    console.log(\"call started\");\r\n\r\n    var publisherChild = angular.element(document.createElement('div'));\r\n    var publisherDiv = angular.element(element[0].children[0].children[0]);\r\n\r\n    var subscriberChild = angular.element(document.createElement('div'));\r\n    var subscriberDiv = angular.element(element[0].children[0].children[1]);\r\n    subscriberChild.attr('id', 'myPublisherDiv');\r\n    subscriberDiv.append(subscriberChild);\r\n    publisher = TB.initPublisher(apiKey, 'myPublisherDiv');\r\n\r\n\r\n    session.on({\r\n        'streamCreated': function(event) {\r\n            publisherChild.attr('id', 'stream' + event.stream.streamId);\r\n            publisherDiv.append(publisherChild);\r\n            session.subscribe(event.stream, publisherChild.attr('id'), {\r\n                subscribeToAudio: true\r\n            }, {\r\n                subscribeToVideo: true\r\n            });\r\n\r\n            TB.updateViews();\r\n\r\n        },\r\n        'streamDestroyed': function(event) {\r\n            session.disconnect();\r\n        },\r\n        'sessionDisconnected': function(event) {\r\n            stopTimer();\r\n            scope.endConference(); //moves to the different view\r\n            console.log('teleconsult session has been disconnected');\r\n        }\r\n    });\r\n    session.connect(token, function() {\r\n        session.publish(publisher);\r\n        TB.updateViews();\r\n    });\r\n\r\n    var cameraPosition = \"front\";\r\n    var publishAudio = true;\r\n\r\n    document.getElementById('endCall').onclick = function() {\r\n        session.disconnect();\r\n        session = null;\r\n        console.log(\"call ended\");\r\n    };\r\n\r\n    var cameraPosition = \"front\";\r\n    var publishAudio = true;\r\n    var publishVideo = true;\r\n\r\n\r\n    document.getElementById('switchCameras').onclick = function() {\r\n        if (publisher !== null) {\r\n            if (cameraPosition === \"front\") {\r\n                cameraPosition = \"back\";\r\n            } else {\r\n                cameraPosition = \"front\";\r\n            }\r\n            publisher.setCameraPosition(cameraPosition);\r\n        }\r\n    };\r\n\r\n    document.getElementById('muteMic').onclick = function() {\r\n        if (publisher !== null) {\r\n            if (publishAudio === false) {\r\n                publishAudio = true;\r\n                document.getElementById('muteMic').innerHTML = \"Mute mic\";\r\n            } else {\r\n                publishAudio = false;\r\n                document.getElementById('muteMic').innerHTML = \"Unmute mic\";\r\n            }\r\n            publisher.publishAudio(publishAudio);\r\n        }\r\n    };\r\n}"},"comment":{"url":"https://api.github.com/repos/songz/cordova-plugin-opentok/issues/comments/117059031","html_url":"https://github.com/songz/cordova-plugin-opentok/issues/186#issuecomment-117059031","issue_url":"https://api.github.com/repos/songz/cordova-plugin-opentok/issues/186","id":117059031,"user":{"login":"G-Penchev","id":10497665,"avatar_url":"https://avatars.githubusercontent.com/u/10497665?v=3","gravatar_id":"","url":"https://api.github.com/users/G-Penchev","html_url":"https://github.com/G-Penchev","followers_url":"https://api.github.com/users/G-Penchev/followers","following_url":"https://api.github.com/users/G-Penchev/following{/other_user}","gists_url":"https://api.github.com/users/G-Penchev/gists{/gist_id}","starred_url":"https://api.github.com/users/G-Penchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/G-Penchev/subscriptions","organizations_url":"https://api.github.com/users/G-Penchev/orgs","repos_url":"https://api.github.com/users/G-Penchev/repos","events_url":"https://api.github.com/users/G-Penchev/events{/privacy}","received_events_url":"https://api.github.com/users/G-Penchev/received_events","type":"User","site_admin":false},"created_at":"2015-06-30T08:45:36Z","updated_at":"2015-06-30T08:45:36Z","body":"Here are some extracted logs from the console at the specific moment when another user connects: \r\n\r\n![screen shot 2015-06-30 at 11 49 25 am](https://cloud.githubusercontent.com/assets/10497665/8427085/71a35478-1f1d-11e5-87f5-830b8383fc97.png)\r\n"}}