icecast server for icecast-metadata-player

I have an icecast2 server running on a vps with a mount point connected to a liquidsoap source.
Everything is fine, i can access my stream from the browser at the address: http://IP:PORT/mount and I can see the Currenty Playing song’s name and artist from the /status.xsl.

My goal is to get the stream audio and metadata in a javascript application.

I tried to simply put my stream url in a <audio> tag and fetch the metadata from the /status.xsl and that’s works fine but problem is that the metadata aren’t updated and fetching in a setInterval is not the way.

So I need an other solution here…

I found that maybe icecast-metadata-player is what i need. But when I try the basic setup :

const player = new IcecastMetadataPlayer("http://IP:PORT/mount", { 
   onMetadata: (metadata) => { console.log(metadata); },   
   metadataTypes: ["ogg", "icy"], 
});

I’m getting the following error:
GET http://IP:PORT/mount net::ERR_EMPTY_RESPONSE

For the javascript part, I tried with some examples streams and there is no problem so I don’t think that the error is from icecast-metadata-player.

I have ufw on the vps with port 8000 which is the one for the icecast server open.

So I’m probably missing something on the icecast’s server configuration to allow icecast-metadata-player to access it.

Here is the config:

<icecast>
    <location>Earth</location>
    <admin>icemaster@localhost</admin>

    <limits>
        <clients>100</clients>
        <sources>10</sources>
        <queue-size>524288</queue-size>
        <client-timeout>30</client-timeout>
        <header-timeout>15</header-timeout>
        <source-timeout>10</source-timeout>
        <burst-on-connect>1</burst-on-connect>
        <burst-size>65535</burst-size>
    </limits>

    <authentication>
        <source-password>hackme</source-password>
        <relay-password>hackme</relay-password>
        <admin-user>admin</admin-user>
        <admin-password>hackme</admin-password>
    </authentication>
    
    <hostname>IP ADRESS</hostname>
    
    <listen-socket>
        <port>8000</port>
    </listen-socket>
    
    <http-headers>
        <header name="Access-Control-Allow-Origin" value="*" />
    </http-headers>
    
    
    
    <!-- Normal mounts -->
    
    <mount type="normal">
            <mount-name>/test.ogg</mount-name>
            <stream-name>radio test</stream-name>
    
        <password>pass</password>
        <public>1</public>
    </mount>
    
    <fileserve>1</fileserve>
    
    <paths>
        <basedir>/usr/share/icecast2</basedir>
    
        <logdir>/var/log/icecast2</logdir>
        <webroot>/usr/share/icecast2/web</webroot>
        <adminroot>/usr/share/icecast2/admin</adminroot>
      
        <alias source="/" destination="/status.xsl"/>
    </paths>
    
    <logging>
        <accesslog>access.log</accesslog>
        <errorlog>error.log</errorlog>
     
        <loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
        <logsize>10000</logsize> <!-- Max size of a logfile -->
    </logging>
    
    <security>
        <chroot>0</chroot>
    </security>
</icecast>