How to play audio file on android?

15 hours ago 3
ARTICLE AD BOX

I use Javascript in one of my decks on Anki to load audio files located in a folder on my Android phone, but it doesn't work. Initially I thought the problem must be related to permissions and placed the audio files inside the Anki folder, but that didn't help. I supposed then that the problem must be with the path and have experimented with different paths ever since but still have not managed to solve the problem.

Does anybody know how to play local audio files on an Android phone?

Code for reference:

const words = document.querySelectorAll('.word'); words.forEach(word => { word.addEventListener('click', (event) => { clickedWord = event.target.textContent; const audio = new Audio('storage/amulated/0/AnkiDroid/audio/' + clickedWord + '.mp3'); audio.play(); }); });

(I "solved" the problem by creating a local server and access the files through the browser, but I would really want to access the files localy instead).

Any help is very appreciated.

Read Entire Article