Search code examples
androidandroid-mediarecorder

Android - How to play audio along with video using Media libraries in Android


I have been trying for a couple of days now to play an mp4 file that I recorded using the Android MediaRecorder sample. http://developer.android.com/samples/MediaRecorder/index.html

I am using this sample over here MediaDecoder to play the video. This is able to play the video but I cannot seem to play the sound at all. http://developer.android.com/samples/BasicMediaDecoder/index.html

Do I need to create another MediaExtractor to decode the audio track from the above piece? Should I be using an AudioTrack? for this. The mime type of the audio is an AAC {audio/mp4a-latm}

A similar question was asked here but there was no answer. Playing audio with video using MediaDecoder


Solution

  • You can check grafika, it's provided by Google to give some right samples working around Video/Audio decode&encode issue, and also here is a good place to refer.