Verifying if a URL leads to a .mp3 file on AppLab

A student of mine is making an app that allows you to create custom music. However, my student wants to incorporate a feature that allows users to upload and use their own sounds in the app by giving the program a direct URL to their desired sound. My student doesn’t know how to check if the user has inputted a valid URL link that leads to a file that AppLab can decode into sound. I know that AppLab returns a warning in the console if it can’t find a sound at the desired URL, but neither my student nor I know how to take advantage of warnings in their js code. Does anyone have any ideas as to what we could do to make this a reality?

function validateSong(path, callback) {
    if (path.substr(path.length - 4, 4) !== ".mp3") {
        console.log("Invalid Params Must Be Of mp3 Origins");
        return callback(false)
    // if (path.match(/(?<=^(https:\/\/|sound:\/\/category_(accent|achievements|alerts|animals|app|background|bell|board_games|collect|digital|explosion|female_voiceovers|hits|human|instrumental|jump|loops|male_voiceovers|movement|music|nature|notifications|objects|points|poof|pop|projectile|puzzle|retro|slide|space|sports|swing|swish|tap|transition|whoosh))).*\.mp3/g) === null) {
    //     return callback("Local Assets have been disabled")
    // }
    // ^^ only enable this if you want it to disclude the asset || external directory
    // you can also make it so that external requests are blocked as well just make it !== instead of ===
    playSound(path, false, function (valid) {
        if (valid) {
            setTimeout(function () { callback(valid) }, 30)
        } else {

here’s what i came up with the commented out section i deemed somewhat necessary since your student wants external URLS rather than internal ones buut because of that it uses regex which is a tricky subject when getting started playSound has a callback to let you know if it was a failure or a success which may also take time to grasp as well i’m not sure if i would qualify it as elegant, perhaps anyone else has any other ideas?