Icecast SDK for JavaScript
NodeJS / Typescript SDK for Icecast APIs
Icecast APIs
https://icecast.org/docs/icecast-trunk/server_stats/
https://icecast.org/docs/icecast-trunk/admin_interface/
Install
Use npm
to install the module
npm install icecast-sdk-js
Or use yarn
to install the module
yarn add icecast-sdk-js
Usage
Get Stats
import IcecastServer from 'icecast-sdk-js'
const hostUrl = 'http://locahost:8000'
const ic = new IcecastServer(hostUrl)
;(async () => {
const stats = await ic.getStats()
console.log(stats)
})()
Update Source Title (Requires Icecast Server admin username and password)
import IcecastServer from 'icecast-sdk-js'
const { IC_HOST, IC_USERNAME, IC_PASSWORD } = process.env || {}
const ic = new IcecastServer(IC_HOST, { username: IC_USERNAME, password: IC_PASSWORD })
;(async () => {
const mountpoint = 'testmountpoint'
const title = 'test title'
try {
const source = await ic.updateSource(mountpoint, title)
console.log(source)
} catch (error) {
console.log(error.response.data)
}
})()