首页 > 解决方案 > Can you link to external mp3 file and play it on server

问题描述

I'm doing a project where I can't host the actual audio files in the site folder so I have to link to a gofile mp3. When I do this playback works great on localhost but as soon as I upload to server it will not play the mp3. Is there something I am doing wrong?

Here is an example of where put in the external link and when it is asked to play.

  var sound1 = new Audio('https://srv-file16.gofile.io/download/LRQQr1/When%20the%20Summer%20Ends%20-%20Official%20Audio.mp3'); 

         if(form.userid.value == "GREY")
 {
    $(".modalDialog").css({"opacity":"0","pointer-events":"none"});
    setTimeout(location.reload.bind(location), 206000);

    sound1.play()

    rainbow.style.visibility='hidden'
    forehead.style.visibility='hidden'



  }

标签: javascripthtmlmp3html5-audioexternal-links

解决方案


推荐阅读