I'm writing a nw.js desktop app. And I want to play some audio file on html page.
If I load some audio from the app path, it will work, like <audio src="test.wav"></audio>
However , for most time. I'd like to load some other audio file on my computer,out of the app folder. Which didn't work. the code is below:
So what is the right way to do this?
<!DOCTYPE html>
<html>
<head>
<title>test audio</title>
</head>
<body style="width: 100%; height: 100%;">
<audio src="/Users/shidanlifuhetian/Desktop/45.wav" crossorigin="anonymous" controls="controls">
</audio>
</body>
</html>
Found the solution after several try.
just add file://
before src attribute.
like this:
<audio src="file:///Users/shidanlifuhetian/Desktop/45.wav" crossorigin="anonymous" controls="controls">
</audio>