FlashWavRecorder icon indicating copy to clipboard operation
FlashWavRecorder copied to clipboard

Microphone levels are dispatched very slowly

Open tehmaestro opened this issue 9 years ago • 2 comments

Hey, I've got a problem with the microphone_level event. It is being fired something like once a second, which is really slow, and doesn't allow for a smooth levels animation. Am I missing a setting somewhere? Can I increase the event call frequency? Thanks.

tehmaestro avatar Mar 07 '15 22:03 tehmaestro

Hi, are you able to reproduce this behaviour on the demo page? http://michalstocki.github.io/FlashWavRecorder/html/ What is your browser and platform (OS, version)?

michalstocki avatar Mar 07 '15 22:03 michalstocki

No, the demo works just fine .. I'm on Windows 7 and Internet Explorer 11. I've gone through my code multiple times, and it's basically the same as the one in the demo .. Here's some of my code:

        window.fwr_event_handler = function fwr_event_handler() {
            switch (arguments[0]) {
                case "ready":
                    window.FWRecorder.connect("mic-flash", 0);
                    window.FWRecorder.showPermissionWindow();
                    break;

                case "permission_panel_closed":
                    window.FWRecorder.defaultSize();
                    break;

                case "microphone_connected":
                    self.set('canRecord', true);
                    self.set('micEnabled', true);
                    break;

                case "microphone_not_connected":
                    self.set('notAllowed', true);
                    break;
                case "microphone_level":
                    var level = arguments[1];
                    var levels = document.getElementById("levels");
                    var percent= Math.floor(level * 100);
                    levels.style.height = percent+ "%";
                    break;
            }

So basically, if I put a console.log("test") in microphone_level, in your demo, test is written something like 10 times a second, where as in my example, it only gets written once a second.

PS: I'm using this in an Ember.js project, so there's a lot of javascript .. don't know how that gets in the way.

tehmaestro avatar Mar 08 '15 06:03 tehmaestro