-2

Here is the audio control. When I put the path in browser nothing is showing.

    <audio  controls="controls">
        <source src="E:/Songs/ROCK ON2/Rock On 2/You Know What I Mean(Mr-Jatt.com).mp3" />
    </audio>
jmargolisvt
  • 5,722
  • 4
  • 29
  • 46
Swadesh
  • 35
  • 1
  • 6

2 Answers2

0

You will need to url encode your file path. It doesn't know what to do with the spaces in your file name. So either encode it or remove all the spaces from every part of that path.

jmargolisvt
  • 5,722
  • 4
  • 29
  • 46
0

If you are trying to play local files you can use <input type="file"> to get file as a File object and create a Blob URL of file to set at .src of <audio> element at change event of <input type="file"> element.

<input type="file">
<audio controls></audio>
<script>
var input = document.querySelector("input[type=file]");
var audio = document.querySelector("audio");
input.onchange = function() {
  audio.src = URL.createObjectURL(input.files[0]);
}
</script>
guest271314
  • 1
  • 15
  • 104
  • 177