Audio is not defined inside node modules #528
Unanswered
growindiedev
asked this question in
Help & Support
Replies: 1 comment 1 reply
-
Right now (idk, this right) is you need to create another lib to talk with it instead, I use svelte and I use that ways to fix that error. Cause you need to use async function with it. If you want to look to my lib, here on my Github. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building a music player using amplitudejs library. I'm using the new app directory of Next 13. My app works fine in development mode but when I try to make build it or deploy it, it throws an error. I looked into a similar vercel/next.js#17963. But it doesn't help in my scenario. I have isolated the problem but don't know how to fix it. The problem is caused by amplitudejs library. When I remove the amplitudejs import from the component. The build works fine, both in development as well as in production. Here's my repository 🙏🏼
Here's the structure of my component -
`
"use client";
import React, { useEffect, useRef, useContext, useState } from "react";
import { StateContext } from "./StateProvider";
import Amplitude from "amplitudejs";
const AudioPlayer = () => {
const slider = useRef(null);
const { ownedSongs } = useContext(StateContext);
useEffect(() => {
Amplitude?.init({
callbacks: {
timeupdate: function () {
let percentage = Amplitude.getSongPlayedPercentage();
}, [ownedSongs]);
........
.......
``
Beta Was this translation helpful? Give feedback.
All reactions