[jitsi-dev] Jitsi Meet "Cannot read property 'getAudioTracks'" on second visit


#1

Hi,

I'm having an Jitsi Meet/Chromium issue which I think is related to the
camera permission granting.

When Chromium asks to get permission to the camera everything is working
but then it remembers the decision and the next time I'm back on the
site it will not ask and instead I get a lot of "Cannot read property
'getAudioTracks'".

Anyone seen this or having an idea of what could be wrong?

Cheers,
Markus

More details follows:

···

---
Jitsi Meet Version: * master d148161 (aug 29)

First time, everything is fine:

1) Login
2) Activate camera

Output:
Using Chrome extension for desktop sharing desktopsharing.js?v=2:216
Chrome versionmozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml,
like gecko) ubuntu chromium/36.0.1985.125 chrome/36.0.1985.125
safari/537.36 36 desktopsharing.js?v=2:186
init app.js?v=7:1121
This appears to be Chrome strophe.jingle.adapter.js?v=1:478
status 1 app.js?v=7:141
status 2 app.js?v=7:130
status 7 app.js?v=7:141
password is required app.js?v=7:772
status 1 app.js?v=7:141
connected app.js?v=7:117
onUserMediaSuccess strophe.jingle.adapter.js?v=1:634
hover in
blob:https%3A//meet.example.com/ced7dea6-16ec-493d-84d6-64c6dec2b708
videolayout.js?v=8:113
Joined MUC as cometeamorgan@conference.example.com/markus.kilas
muc.js?v=13:25
presence change from cometeamorgan@conference.example.com/markus.kilas
muc.js?v=13:132
UI enable dominant speaker markus.kilas markus.kilas true

Then close Chromium Browser and try again:

1) Login
2) Camera is already activated

Output:
Using Chrome extension for desktop sharing
Chrome versionmozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml,
like gecko) ubuntu chromium/36.0.1985.125 chrome/36.0.1985.125
safari/537.36 36
init
This appears to be Chrome
status 1
onUserMediaSuccess
hover in
blob:https%3A//meet.example.com/0de4cfaf-2928-45d0-b288-8cb977b7d9cf
status 2
status 7
password is required
status 1
6
Uncaught TypeError: Cannot read property 'getAudioTracks' of null
meet.example.com/app.js?v=7:893
connected
32
Uncaught TypeError: Cannot read property 'getAudioTracks' of null
meet.example.com/app.js?v=7:893
264
Uncaught TypeError: Cannot read property 'getAudioTracks' of null
app.js?v=7:893
isAudioMuted app.js?v=7:893
audioLevelUpdated app.js?v=7:417
(anonymous function)

The number of Uncaught TypeError continues to increase with about 10 per
second and the conference remains in the "Your conference is currently
being created..." mode.
---


#2

I was able to reproduce the issue also on the first time if I enable the
camera _before_ entering the XMPP username and password.

Therefore I suspect the issue is that Jitsi Meet tries to use some media
streams (?) before the authentication is performed and then gets stuck
in some bad state (my guess).

Best regards,
Markus

···

On 2014-09-01 12:08, Markus Kilås wrote:

Hi,

I'm having an Jitsi Meet/Chromium issue which I think is related to the
camera permission granting.

When Chromium asks to get permission to the camera everything is working
but then it remembers the decision and the next time I'm back on the
site it will not ask and instead I get a lot of "Cannot read property
'getAudioTracks'".

Anyone seen this or having an idea of what could be wrong?

Cheers,
Markus

More details follows:
---
Jitsi Meet Version: * master d148161 (aug 29)

First time, everything is fine:

1) Login
2) Activate camera

Output:
Using Chrome extension for desktop sharing desktopsharing.js?v=2:216
Chrome versionmozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml,
like gecko) ubuntu chromium/36.0.1985.125 chrome/36.0.1985.125
safari/537.36 36 desktopsharing.js?v=2:186
init app.js?v=7:1121
This appears to be Chrome strophe.jingle.adapter.js?v=1:478
status 1 app.js?v=7:141
status 2 app.js?v=7:130
status 7 app.js?v=7:141
password is required app.js?v=7:772
status 1 app.js?v=7:141
connected app.js?v=7:117
onUserMediaSuccess strophe.jingle.adapter.js?v=1:634
hover in
blob:https%3A//meet.example.com/ced7dea6-16ec-493d-84d6-64c6dec2b708
videolayout.js?v=8:113
Joined MUC as cometeamorgan@conference.example.com/markus.kilas
muc.js?v=13:25
presence change from cometeamorgan@conference.example.com/markus.kilas
muc.js?v=13:132
UI enable dominant speaker markus.kilas markus.kilas true

Then close Chromium Browser and try again:

1) Login
2) Camera is already activated

Output:
Using Chrome extension for desktop sharing
Chrome versionmozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml,
like gecko) ubuntu chromium/36.0.1985.125 chrome/36.0.1985.125
safari/537.36 36
init
This appears to be Chrome
status 1
onUserMediaSuccess
hover in
blob:https%3A//meet.example.com/0de4cfaf-2928-45d0-b288-8cb977b7d9cf
status 2
status 7
password is required
status 1
6
Uncaught TypeError: Cannot read property 'getAudioTracks' of null
meet.example.com/app.js?v=7:893
connected
32
Uncaught TypeError: Cannot read property 'getAudioTracks' of null
meet.example.com/app.js?v=7:893
264
Uncaught TypeError: Cannot read property 'getAudioTracks' of null
app.js?v=7:893
isAudioMuted app.js?v=7:893
audioLevelUpdated app.js?v=7:417
(anonymous function)

The number of Uncaught TypeError continues to increase with about 10 per
second and the conference remains in the "Your conference is currently
being created..." mode.
---


#3

The below hack resolves the issue by waiting to ask for camera/audio
permissions until after the login:

diff --git a/app.js b/app.js
index 7fb9c34..8b03da0 100644
--- a/app.js
+++ b/app.js
@@ -69,24 +69,6 @@ function init() {
         return;
     }

- obtainAudioAndVideoPermissions(function (stream) {
- var audioStream = new webkitMediaStream(stream);
- var videoStream = new webkitMediaStream(stream);
- var videoTracks = stream.getVideoTracks();
- var audioTracks = stream.getAudioTracks();
- for (var i = 0; i < videoTracks.length; i++) {
- audioStream.removeTrack(videoTracks[i]);
- }
- VideoLayout.changeLocalAudio(audioStream);
- startLocalRtpStatsCollector(audioStream);

···

On 2014-09-01 21:33, Markus Kilås wrote:

On 2014-09-01 12:08, Markus Kilås wrote:

Hi,

I'm having an Jitsi Meet/Chromium issue which I think is related to the
camera permission granting.

When Chromium asks to get permission to the camera everything is working
but then it remembers the decision and the next time I'm back on the
site it will not ask and instead I get a lot of "Cannot read property
'getAudioTracks'".

Anyone seen this or having an idea of what could be wrong?

Cheers,
Markus

More details follows:
---
Jitsi Meet Version: * master d148161 (aug 29)

First time, everything is fine:

1) Login
2) Activate camera

Output:
Using Chrome extension for desktop sharing desktopsharing.js?v=2:216
Chrome versionmozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml,
like gecko) ubuntu chromium/36.0.1985.125 chrome/36.0.1985.125
safari/537.36 36 desktopsharing.js?v=2:186
init app.js?v=7:1121
This appears to be Chrome strophe.jingle.adapter.js?v=1:478
status 1 app.js?v=7:141
status 2 app.js?v=7:130
status 7 app.js?v=7:141
password is required app.js?v=7:772
status 1 app.js?v=7:141
connected app.js?v=7:117
onUserMediaSuccess strophe.jingle.adapter.js?v=1:634
hover in
blob:https%3A//meet.example.com/ced7dea6-16ec-493d-84d6-64c6dec2b708
videolayout.js?v=8:113
Joined MUC as cometeamorgan@conference.example.com/markus.kilas
muc.js?v=13:25
presence change from cometeamorgan@conference.example.com/markus.kilas
muc.js?v=13:132
UI enable dominant speaker markus.kilas markus.kilas true

Then close Chromium Browser and try again:

1) Login
2) Camera is already activated

Output:
Using Chrome extension for desktop sharing
Chrome versionmozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml,
like gecko) ubuntu chromium/36.0.1985.125 chrome/36.0.1985.125
safari/537.36 36
init
This appears to be Chrome
status 1
onUserMediaSuccess
hover in
blob:https%3A//meet.example.com/0de4cfaf-2928-45d0-b288-8cb977b7d9cf
status 2
status 7
password is required
status 1
6
Uncaught TypeError: Cannot read property 'getAudioTracks' of null
meet.example.com/app.js?v=7:893
connected
32
Uncaught TypeError: Cannot read property 'getAudioTracks' of null
meet.example.com/app.js?v=7:893
264
Uncaught TypeError: Cannot read property 'getAudioTracks' of null
app.js?v=7:893
isAudioMuted app.js?v=7:893
audioLevelUpdated app.js?v=7:417
(anonymous function)

The number of Uncaught TypeError continues to increase with about 10 per
second and the conference remains in the "Your conference is currently
being created..." mode.
---

I was able to reproduce the issue also on the first time if I enable the
camera _before_ entering the XMPP username and password.

Therefore I suspect the issue is that Jitsi Meet tries to use some media
streams (?) before the authentication is performed and then gets stuck
in some bad state (my guess).

Best regards,
Markus

-
- for (i = 0; i < audioTracks.length; i++) {
- videoStream.removeTrack(audioTracks[i]);
- }
- VideoLayout.changeLocalVideo(videoStream, true);
- maybeDoJoin();
- });
-
     var jid = document.getElementById('jid').value ||
config.hosts.anonymousdomain || config.hosts.domain || window
     connect(jid);
}
@@ -123,6 +105,25 @@ function connect(jid, password) {
             if(password)
                 authenticatedUser = true;
             maybeDoJoin();
+
+ obtainAudioAndVideoPermissions(function (stream) {
+ var audioStream = new webkitMediaStream(stream);
+ var videoStream = new webkitMediaStream(stream);
+ var videoTracks = stream.getVideoTracks();
+ var audioTracks = stream.getAudioTracks();
+ for (var i = 0; i < videoTracks.length; i++) {
+ audioStream.removeTrack(videoTracks[i]);
+ }
+ VideoLayout.changeLocalAudio(audioStream);
+ startLocalRtpStatsCollector(audioStream);
+
+ for (i = 0; i < audioTracks.length; i++) {
+ videoStream.removeTrack(audioTracks[i]);
+ }
+ VideoLayout.changeLocalVideo(videoStream, true);
+ maybeDoJoin();
+ });
+

Not sure if it will work in an anonymous setup or if there is a better
way of fixing the issue.

Cheers,
Markus


#4

Hi,

I'm having an Jitsi Meet/Chromium issue which I think is related to the
camera permission granting.

When Chromium asks to get permission to the camera everything is working
but then it remembers the decision and the next time I'm back on the
site it will not ask and instead I get a lot of "Cannot read property
'getAudioTracks'".

Anyone seen this or having an idea of what could be wrong?

[...]

Not sure if it will work in an anonymous setup or if there is a better
way of fixing the issue.

Might have been caused by my commits
https://github.com/jitsi/jitsi-meet/commit/54ea1da98e9e7ac8e8069c38b8dc113a4f38e530
or
https://github.com/jitsi/jitsi-meet/commit/c6f7e192d0f8f8daa0607c748c5e4959cbe63e4b

I'll take a look tomorrow. Thanks!

···

Am 01.09.2014 22:18, schrieb Markus Kilås:

On 2014-09-01 21:33, Markus Kilås wrote:

On 2014-09-01 12:08, Markus Kilås wrote:


#5

Not sure if it will work in an anonymous setup or if there is a better
way of fixing the issue.

the problem is that the audio and video stream is not attached to the new connection when reconnecting. Working on a fix.


#6

Hey Philipp,

Seems to work fine!

Here are the steps I performed to verify:

1. Reverting my own patch
$ git checkout -- app.js

2. Reload cache in Chromium
Ctrl+Shift+Del

3. Access https://meet.example.com
(Camera is started)

4. Login
...
Uncaught TypeError: Cannot read property 'getAudioTracks' of null
app.js?v=7:893

5. Now apply patch
$ patch -p1 < /tmp/gumearlyfix.patch

6. Reload cache in Chromium

7. Access Meet
(Camera is started)

8. Login

Using Chrome extension for desktop sharing desktopsharing.js?v=2:216
Chrome versionmozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml,
like gecko) ubuntu chromium/36.0.1985.125 chrome/36.0.1985.125
safari/537.36 36 desktopsharing.js?v=2:186
init app.js?v=7:1128
This appears to be Chrome strophe.jingle.adapter.js?v=1:478
status 1 app.js?v=7:148
onUserMediaSuccess strophe.jingle.adapter.js?v=1:634
hover in
blob:https%3A//meet.example.com/41f3b8f5-43a7-4510-8002-2255358daa19
videolayout.js?v=8:113
status 2 app.js?v=7:137
status 7 app.js?v=7:148
password is required app.js?v=7:779
status 1 app.js?v=7:148
connected app.js?v=7:124
Joined MUC as clothetwentygot@conference.example.com/markus.kilas
muc.js?v=13:25
presence change from clothetwentygot@conference.example.com/markus.kilas
muc.js?v=13:132
presence change from clothetwentygot@conference.example.com/markus.kilas
muc.js?v=13:132
chat markus test

Cheers,
Markus

···

On 2014-09-02 17:16, Philipp Hancke wrote:

hey Markus,

[..]

Not sure if it will work in an anonymous setup or if there is a better
way of fixing the issue.

can you try the attached patch please and let me know if that fixes the
issue? This should be enough hopefully.

Thanks for reporting this, completly unforeseen complications

philipp


#7

Not sure if it will work in an anonymous setup or if there is a better
way of fixing the issue.

Fixed in https://github.com/jitsi/jitsi-meet/commit/df9ac36aa0f24938c2a5d48948eec38ec09a3bc5

thanks Markus!