{"action":"created","issue":{"url":"https://api.github.com/repos/eface2face/cordova-plugin-iosrtc/issues/166","repository_url":"https://api.github.com/repos/eface2face/cordova-plugin-iosrtc","labels_url":"https://api.github.com/repos/eface2face/cordova-plugin-iosrtc/issues/166/labels{/name}","comments_url":"https://api.github.com/repos/eface2face/cordova-plugin-iosrtc/issues/166/comments","events_url":"https://api.github.com/repos/eface2face/cordova-plugin-iosrtc/issues/166/events","html_url":"https://github.com/eface2face/cordova-plugin-iosrtc/issues/166","id":150042812,"number":166,"title":"[JS addTrack] _audioTracks and _videoTracks undefined ","user":{"login":"Toumassa","id":6512024,"avatar_url":"https://avatars.githubusercontent.com/u/6512024?v=3","gravatar_id":"","url":"https://api.github.com/users/Toumassa","html_url":"https://github.com/Toumassa","followers_url":"https://api.github.com/users/Toumassa/followers","following_url":"https://api.github.com/users/Toumassa/following{/other_user}","gists_url":"https://api.github.com/users/Toumassa/gists{/gist_id}","starred_url":"https://api.github.com/users/Toumassa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toumassa/subscriptions","organizations_url":"https://api.github.com/users/Toumassa/orgs","repos_url":"https://api.github.com/users/Toumassa/repos","events_url":"https://api.github.com/users/Toumassa/events{/privacy}","received_events_url":"https://api.github.com/users/Toumassa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-21T11:16:16Z","updated_at":"2016-04-21T13:58:21Z","closed_at":"2016-04-21T11:44:30Z","body":"HI, i am trying to get jitsi-meet working with this cool plugin. I successfully assigned variables (getUserMedia, enumerateDevices ...) inside of an iframe loading jitsi-meet. I know it works because the chat works.\r\n\r\nThe problem is when i create a room (or join) i see in logs :\r\n> TypeError: undefined is not an object (evaluating 'track.id')\r\n\r\nAfter investigating i found that this._audioTracks and thisVideoTracks are undefined inside of this procedure (cordova-plugin-iostrc.js) so it fails at second if:\r\n```\r\nMediaStream.prototype.addTrack = function (track) {\r\n\tdebug('addTrack() [track:%o]', track);\r\n\r\n\tif (!(track instanceof MediaStreamTrack)) {\r\n\t\tthrow new Error('argument must be an instance of MediaStreamTrack');\r\n\t}\r\n\tif (this._audioTracks[track.id] || this._videoTracks[track.id]) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (track.kind === 'audio') {\r\n\t\tthis._audioTracks[track.id] = track;\r\n\t} else if (track.kind === 'video') {\r\n\t\tthis._videoTracks[track.id] = track;\r\n\t} else {\r\n\t\tthrow new Error('unknown kind attribute: ' + track.kind);\r\n\t}\r\n\r\n\taddListenerForTrackEnded.call(this, track);\r\n\r\n\texec(null, null, 'iosrtcPlugin', 'MediaStream_addTrack', [this.id, track.id]);\r\n};\r\n```\r\nI think that these objects aren't initialized.\r\nThanks\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/eface2face/cordova-plugin-iosrtc/issues/comments/212931929","html_url":"https://github.com/eface2face/cordova-plugin-iosrtc/issues/166#issuecomment-212931929","issue_url":"https://api.github.com/repos/eface2face/cordova-plugin-iosrtc/issues/166","id":212931929,"user":{"login":"Toumassa","id":6512024,"avatar_url":"https://avatars.githubusercontent.com/u/6512024?v=3","gravatar_id":"","url":"https://api.github.com/users/Toumassa","html_url":"https://github.com/Toumassa","followers_url":"https://api.github.com/users/Toumassa/followers","following_url":"https://api.github.com/users/Toumassa/following{/other_user}","gists_url":"https://api.github.com/users/Toumassa/gists{/gist_id}","starred_url":"https://api.github.com/users/Toumassa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toumassa/subscriptions","organizations_url":"https://api.github.com/users/Toumassa/orgs","repos_url":"https://api.github.com/users/Toumassa/repos","events_url":"https://api.github.com/users/Toumassa/events{/privacy}","received_events_url":"https://api.github.com/users/Toumassa/received_events","type":"User","site_admin":false},"created_at":"2016-04-21T13:58:21Z","updated_at":"2016-04-21T13:58:21Z","body":"I do this to have access to the parent globals\r\n\r\n```\r\nnavigator.mediaDevices = parent.navigator.mediaDevices;\r\n\tnavigator.getUserMedia = parent.navigator.getUserMedia;\r\n\t//navigator.webkitGetUserMedia = parent.navigator.webkitGetUserMedia;\r\n\tnavigator.mediaDevices.getUserMedia = parent.navigator.mediaDevices.getUserMedia;\r\n\tnavigator.mediaDevices.enumerateDevices =  parent.navigator.mediaDevices.enumerateDevices;\r\n\twindow.RTCPeerConnection = parent.window.RTCPeerConnection;\r\n\twindow.webkitRTCPeerConnection = parent.window.webkitRTCPeerConnection;\r\n\twindow.RTCSessionDescription = parent.window.RTCSessionDescription;\r\n\twindow.RTCIceCandidate = parent.window.RTCIceCandidate;\r\n\twindow.MediaStream = parent.window.MediaStream;\r\n\twindow.webkitMediaStream = parent.window.webkitMediaStream;\r\n\twindow.MediaStreamTrack = parent.window.MediaStreamTrack;\r\n```\r\n>BTW:I don't know how the plugin will behave when there is an iframe around. I don't think it will work by just \"copying\" to the iframe the global variables exported by the plugin.\r\n\r\nAs far as the parent frame is defined before the child and i can access i though i could use it as \"pointer\". But maybe you're right. Will try to avoid iframe."}}