eshaz / icecast-metadata-js

Browser and NodeJS packages for playing and reading Icecast compatible streaming audio with realtime metadata updates.
155 stars 20 forks source link

icecast-metadata-stats NodeJS support #182

Closed lawesw closed 10 months ago

lawesw commented 1 year ago

Hello!

I'm fairly new to JavaScript and I've having trouble getting icecast-metadata-js to work at all. I keep getting an error saying the module cant be found.

Error: Cannot find module 'icecast-metadata-stats'
Require stack:
- /Users/**username**/Downloads/metadata/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/**username**/Downloads/metadata/index.js:1:30)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/**username**/Downloads/metadata/index.js' ]
}

Even after after I have installed all the icecast-metadata packages?

CleanShot 2023-08-09 at 19 20 14@2x

Below is the code inside index.js

const IcecastMetadataStats = require('icecast-metadata-stats')

const statsListener = new IcecastMetadataStats(
  "https://dsmrad.io/stream/isics-all", {
    sources: ["icy"],
    onStats: (stats) => { console.log(stats.icy) }
  }
eshaz commented 1 year ago

What does your package.json file look like? Can you share a link to your code on github?

lawesw commented 1 year ago
 "name": "metadata",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "icecast-metadata-js": "^1.2.7",
    "icecast-metadata-player": "^1.16.5",
    "icecast-metadata-stats": "^0.1.10"
  }
}
eshaz commented 1 year ago

icecast-metadata-stats is meant to be used in the browser only, but you can put in a feature request here if you want to use it in NodeJS. It will take me some time to implement that though.

What are you trying to do with the library?

lawesw commented 1 year ago

Thanks! I'm trying to make a Node.js application that tracks song metadata of radio stations.

kdev commented 10 months ago

any updates on implementing this for node.js?

eshaz commented 10 months ago

@kdev, I've just released icecast-metadata-stats/0.1.11 that enables NodeJS support. Let me know if you run into any issues.