Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOMException: The user aborted a request #240

Open
xtrmbob opened this issue Jun 1, 2021 · 11 comments
Open

DOMException: The user aborted a request #240

xtrmbob opened this issue Jun 1, 2021 · 11 comments

Comments

@xtrmbob
Copy link

xtrmbob commented Jun 1, 2021

Hello,

I want to implement the opus-recorder package in my project but when i create a new instance i got this error

image

this.recorder = new Recorder({ encoderPath: '../controllers/waveWorker.min.js', wavBitDepth: 16, numberOfChannels: 1, mediaTrackConstraints: this.audioConstraints });

@chris-rudmin
Copy link
Owner

recorder.start() returns a promise which you can add error handling. user aborted a request usually means the user has refused to grant permissions to the site to access the microphone.

@philpln
Copy link

philpln commented Aug 4, 2021

My site is allowed to access the microphone and I get the same error...
It is weird because if I host it through live server on vs code, everything works fine but when I host is with flask, I get the same error when trying to call recorder.start.
Do you have any idea what yourld cause this?

@chris-rudmin
Copy link
Owner

@C4rb0ngit It could also be incorrect path to the hosted worker.

@philpln
Copy link

philpln commented Aug 4, 2021

sorry to ask probably stupid questions but what is the hosted worker?

@chris-rudmin
Copy link
Owner

chris-rudmin commented Aug 4, 2021 via email

@philpln
Copy link

philpln commented Aug 4, 2021

sorry but do you know how to do it in flask because I am very new to web dev and have no idea what to do / can't find anything online

@chris-rudmin
Copy link
Owner

@C4rb0ngit I do not know.

@philpln
Copy link

philpln commented Aug 6, 2021

Okay, thanks anyways. So basically I need to host my flask application on a server like ngix or apache and that's is?

@zzph
Copy link

zzph commented Oct 14, 2021

Ditto, I'm having the exact same issue here.

Could it be something other than the worker? Is there a way to verify the worker/encoderPath is working?

My webpack config (nextjs):

webpack: (config, options) => {
    config.module.rules.push({
        test: /encoderWorker\.min\.js$/,
        use: [{ loader: 'file-loader' }]
    })
    return config
  }

@ebrahimiaval
Copy link

ebrahimiaval commented Feb 7, 2022

In Next JS the encoder file inject in to the _next directory and encoderPath is like /_next/8bd8ff56898e42df5cb3621787b4e6d1.js and in next js we can not access to the root of _next directory.

how set the worker to change this path to static directory in _next directory?

when i set in in to the /_next/static/.... or /public/ and set the encoderPath its ok but when i want use automatically solution.

@uellenberg
Copy link

In Next JS the encoder file inject in to the _next directory and encoderPath is like /_next/8bd8ff56898e42df5cb3621787b4e6d1.js and in next js we can not access to the root of _next directory.

how set the worker to change this path to static directory in _next directory?

when i set in in to the /_next/static/.... or /public/ and set the encoderPath its ok but when i want use automatically solution.

I'm not sure if this is still relevant, but the solution to this is by using webpack asset modules instead of file-loader:

config.module.rules.push({
    test: /encoderWorker\.min\.js$/,
    type: "asset/resource",
});

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

No branches or pull requests

6 participants