Opentok audioLevelUpdated published event not working as expected on Safari

五迷三道 提交于 2019-12-13 05:50:10

问题


I'm experiencing an issue when trying to capture the audio levels from the Opentok publisher. My code works perfectly on Chrome (Version 70.0.3538.110) but are not working as expected on Safari (Version 12.0.1). I'm using @opentok/client Version 2.15.4 and opentok node server Version 2.8.0.

Here is my code:

this.publisher.on('audioLevelUpdated', (event) => {
  console.log("event.audioLevel: " + event.audioLevel);
  // etc...

In Chrome, I get the following as expected:

In Safari, the value of 'event.audioLevel' is 0 after after a short period of time (about 5 seconds) for some reason:

Any thoughts as to why this is happening? Any help is much appreciated!


回答1:


I just tried this using Safari 12 and it was working fine. Try updating to the latest Safari 12 and see whether you are still seeing this problem. Quite a few WebRTC related bugs have been fixed in Safari 12.

Here is the jsbin I put together to test the audio level.

https://output.jsbin.com/sugeyim

const publisher = OT.initPublisher();
const audioEl = document.querySelector('#audioLevel');
publisher.on('audioLevelUpdated', ({audioLevel}) => {
  audioEl.innerHTML = audioLevel;
});


来源:https://stackoverflow.com/questions/53709450/opentok-audiolevelupdated-published-event-not-working-as-expected-on-safari

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!