Javascript library that reads, parses, and queues real-time metadata from an Icecast stream.
See each section below for a demo and test page for each module.
The source code for these modules and other Icecast compatible tools are available at icecast-metadata-js
Codec | Playback Method | ||
---|---|---|---|
MediaSource | HTML5 Audio | Web Audio |
IcecastMetadataPlayer will automatically select the playback method depending on browser compatibility.
<script src="icecast-metadata-player-1.17.9.main.min.js"></script> <script> const onMetadata = (metadata) => { document.getElementById("metadata").innerHTML = metadata.StreamTitle; }; const player = new IcecastMetadataPlayer( "https://dsmrad.io/stream/isics-all", // stream endpoint { onMetadata } // options (onMetadata callback) ); </script> <body> <button onclick="player.play();"> Play </button> <button onclick="player.stop();"> Stop </button> <p> Now Playing: <span id="metadata"></span> </p> </body>
<script src="icecast-metadata-stats-0.1.12.min.js"></script> <script> const onStats = (stats) => { document.getElementById("stats").innerHTML = stats.icy.StreamTitle; }; const stats = new IcecastMetadataStats( "https://dsmrad.io/stream/isics-all", // stream endpoint { onStats, sources: ["icy"] } // options (stats callback, stats sources) ); stats.start(); </script> <body> <p> Now Playing: <span id="stats"></span> </p> </body>