Search code examples
javaandroidurimedia-player

Unable to find sound files URI for Media Player


I want to play sound files when user click on certain text. I have sound files list in my database and the sound files are downloading successfully in my app. I am trying to play these files using MediaPlayer. The issue is I cannot find the URI required to play MediaPlayer. Thus resulting in null media-player object. I have tried nearly all the solutions listed on internet but non solved my issue. The path of sound file while downloading from database is

"/data/user/0/mypackage/files/Sound/diabetes_ur_sound_1_1_1_1.0.0.0.mp3".

Screenshot of one of the method that I used is attached with the debugger output.

Code: Code

Debugger Output: Debugging Output


Solution

  • The issue was in downloading sound files. Therefore the MediaPlayer object results in null.

    Now I am downloading the sound with help of static files and using the file path in MediaPlayer. Problem Solved