android 2.3 MediaPlayer MPEG AAC Audio - android

I am trying to play an audio recorded from iPhone in android. The following are the source code the playing the video in android. The extension of the file is MP4.
Uri savedUri = Uri.fromFile(savedUri_file);
MediaPlayer mediaPlayer = MediaPlayer.create(MainActivity.this, getImageUri());
mediaPlayer.start();
The MediaPlayer.create returns a null value. In VLC I have checked the codec information of the audio. It is MPEG AAC Audio (mp4a).
I need to play this in android 2.3. In jelly bean its is working fine. Also I tried with videoview in 2.3, its working. The audio is playing.
Also when I tried play the same file from SD card (by taping on the MP4 file) its played int he default player.
But when I am trying to play the audio created from android device its playing. The codec information of the audion file created from android is AMR Narrow Band (samr).
The following are the code used for creating audio from
NSMutableDictionary *defaultSettings = [[[NSMutableDictionary alloc] init]autorelease];
[defaultSettings setValue :[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
[defaultSettings setValue:[NSNumber numberWithFloat:16000.0] forKey:AVSampleRateKey];
[defaultSettings setValue:[NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey];
Any hints?

Related

android Exoplayer the video is streaming without audio why?

I have an Exoplayer example in my android TV application which stream udp url like below
udp://232.196.x.x:xxxx
the streaming working well but the video is playing without any audio or any sound.
i need to select the default audio track using DefaultTrackSelector

No audio/sound while playing .mkv movie on VideView

I'm working on android video player using VideoView. It plays all formats songs like mp4, 3gp and mkv. But when I play a movie having .mkv extension its still working fine but I can't hear its sound. Can you guys please help me like how to fix the problem for mkv files to pitch its sound?

AC-3 Codec - no audio

I'm playing a video using BetterVideoPlayer but video is playing but no audio is coming out. As i analysed, i found that this video is using AC-3 Codec(May be).
Google's Video player have also the same behaviour, but MX Player is also to play that video perfectly.

Windows Media Player cannot play MPEG-TS file created in Android.

I tested the StageFright record sample (frameworks/base/cmds/stagefright/record) to create a mpeg2 TS file. While it can be played on Android default Media player, it cannot be played in Windows Media Player or MPlayer. Any suggestions?
Note that I modified the original record sample source to create MPEG-TS file instead of MP4 file.
Which codec you used to create the mpeg2 TS file. May be difference in the codec used is the problem.

browsing and playing audio and video files in android

I am developing a project in which i need to play Audio and Video files. When audio player is clicked i should display only audio files from sdcard and play those files.
When video player is clicked i only need to display video files and play those video files.
I am using media player for playing the files.
MediaPlayer mp = new MediaPlayer();
String filepath = Environment.getExternalStorageDirectory()+"/f.mp3";
mp.setDataSource(filepath);
mp.start();
But My problem is,how to browse the audio/video files and set the data source dynamically when the user selects a particular file.
You Should use MediaStore which has separate ContentProvider for audio and video
http://developer.android.com/reference/android/provider/MediaStore.html
Audio : http://developer.android.com/reference/android/provider/MediaStore.Audio.html
Video : http://developer.android.com/reference/android/provider/MediaStore.Video.html

Categories

Resources