Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

audioLevelUpdated not working on more the 2 subscribers #159

Open
Shtibel opened this issue Feb 18, 2019 · 4 comments
Open

audioLevelUpdated not working on more the 2 subscribers #159

Shtibel opened this issue Feb 18, 2019 · 4 comments

Comments

@Shtibel
Copy link

Shtibel commented Feb 18, 2019

bug report

Current behavior
If there is 1 publisher and 1 subscriber the audioLevelUpdated event works, But when a new user subscribes to the session it stops working.

Steps to reproduce
Create a session publish a video and audio from a device.
Then subscribe to the session from a second device with: insertMode: 'append'.
Start the audioLevelUpdated event and listen to the publisher and console.log it, see that the event is working 60 times a second with: insertMode: 'append'.
Then subscribe to the session from a third device, see that the console.log stops working on second device and it is not working on third device with: insertMode: 'append',

Example Project
We tested it with the: opentok-ionic-samples

What is the current bug behavior?
The audioLevelUpdated event stops working, no errors just stops working.

What is the expected correct behavior?
audioLevelUpdated event must continue working even if there is more than one subscriber.

Relevant logs and/or screenshots
See attached screenshot of the console.log
imgpsh_fullsize_anim

Hi @msach22,
We have a major problem with audioLevelUpdated.
On 1 on 1 session with 1 publisher and 1 subscriber the audioLevelUpdated event is working.
But when a new user joins the session the audioLevelUpdated stops working.
As we see on this issue: 140
You fixed the problem but now when we test it it is not working.

We try to work with the 3.4.2 version and the 3.4.3 version and it is not working.
We tested it with the opentok-ionic-samples code and it is not working.

Please can you test to see what is the problem?
Thank you!

@msach22
Copy link

msach22 commented Feb 20, 2019

@Shtibel Thanks for filing the issue. Can you please share which platform this is happening for? iOS, Android, or both?

@msach22
Copy link

msach22 commented Feb 21, 2019

@Shtibel Just following up on this. Can you please share the code that you're using when setting these event listeners? Are you overriding the subscriber or do you have a collection of subscribers with these event listeners set?

@Shtibel
Copy link
Author

Shtibel commented Feb 22, 2019

Hi @msach22
It happens on both

@vikaskonsam
Copy link

vikaskonsam commented Jun 5, 2020

Yes, there is an issue. I have tested this on iOS and this is what I think the problem is. When there are more the 1 subscribers, the audioLevelUpdated handler for the last connected subscriber is always called even though the audio is coming from the first connected subscriber.

this.subscriber.off('audioLevelUpdated').on('audioLevelUpdated', (event) => {
            if (movingAvg === null || movingAvg <= event.audioLevel) {
              movingAvg = event.audioLevel;
            } else {
              movingAvg = 0.7 * movingAvg + 0.3 * event.audioLevel;
            }
            // 1.5 scaling to map the -30 - 0 dBm range to [0,1]
            let logLevel = (Math.log(movingAvg) / Math.LN10) / 1.5 + 1;
            logLevel = Math.min(Math.max(logLevel, 0), 1);
            if (logLevel > 0.1) {
              console.log(event)
              this.speaking.emit(this.streamIndex);
            } else {
            }
});

When checking the logs, we see the stream details of the last connected subscriber.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants