media-player

Audio focus client died with media player playing music in background

限于喜欢 提交于 2019-12-11 01:53:55
问题 I have created a music player which plays music through service, but after some time when i am outside the app music stops at random time, and i am getting the Log massage "Audio focus client died",i am not able to figure this out..why this is happening I am not attaching any code source because this is really a simple code that is not doing any complex task Just one service that playing music and one Audio focus helper which monitor the focus of audio.. 回答1: It may be because the Android OS

Android- Mediaplayer streaming issue with test devices

扶醉桌前 提交于 2019-12-11 00:27:43
问题 I currently have a mediaplayer that is given a streamable datasource. I have two test devices: HTC Thunderbolt and a Samsung Galaxy SII Skyrocket. The HTC device is able to stream the files perfectly fine; however, the galaxy sII cannot at all, and gives me a bunch of media player error codes. I am implementing everything related to the media player properly...however, i can't get my head around this issue...how come it'll work on one phone but not the other? its the same link. Any ideas?

The server is not correctly configured (-12939)

时光总嘲笑我的痴心妄想 提交于 2019-12-10 22:23:26
问题 Trying to play MP3 from server without first downloading the file locally. Callback for MPMoviePlayerPlaybackDidFinishNotification comes with this: NSConcreteNotification 0x7e1c980 {name = MPMoviePlayerPlaybackDidFinishNotification; object = <ItemMediaPlayer: 0x7856740>; userInfo = { MPMoviePlayerPlaybackDidFinishReasonUserInfoKey = 1; error = "Error Domain=MediaPlayerErrorDomain Code=-12939 \"The server is not correctly configured.\" UserInfo=0x7e243d0 {NSLocalizedDescription=The server is

Sound sometimes remains silent when playing more sounds in a row, why?

江枫思渺然 提交于 2019-12-10 22:21:58
问题 I encountered with a weird problem and hope that someone can answer it.. I have 4x4 buttons, each of them plays a short 1 second sound if I click on it. My code for it: Button_1= (Button) findViewById(R.id.button1); Button_1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (sound!=null){ sound.stop(); sound.release(); sound=null; } sound = MediaPlayer.create(Main.this, R.raw.short_sound); sound.start(); } }); So what happens is that I touch all the

Android MediaPlayer Error(1, -2147483648) when playing an mp3 locally

99封情书 提交于 2019-12-10 20:18:51
问题 Shortly after Android 4.4 came out my code which has been working correctly since 2.2 suddenly went buggy. My code will query the music database for a given music file. The path is returned in the query and this path is then passed onto the MediaPlayer. Code: String uri = "content://media/internal/audio/media"; String[] columns = [audio_id as _id, title, album, artist, album_id, _data]; String where = "album = 'XX'"; Cursor c = this.getContentResolver().query(uri, columns, where, null,

windows phone 8.1 music library get current media queue

杀马特。学长 韩版系。学妹 提交于 2019-12-10 18:27:20
问题 How to get current media queue in windows phone 8.1 (runtime) as in windows phone 8 MediaPlayer.Queue Is it available or we have to implement? Similarly IsShuffled functionality is there ? 回答1: The MediaPlayer API belongs to the Microsoft.Xna.Framework.Media namespace which is no longer available for WinRT components. So you can't use it but you can implement your own logic for it using the MediaElement API which has sufficient properties for a media player except for the logic of queuing etc

Recording Audio and Playing Audio at the same time

。_饼干妹妹 提交于 2019-12-10 18:27:20
问题 In my application i am recording input from the microphone and at a certain point i am playing a sound (while the recording is still going). Now the recorder "stops" to record (mrec.stop() may still be used), the LogCat entry for this seems to be: 07-03 18:40:34.811: INFO/AudioHardwareALSA(2179): Output standby called!!. Turn off PCM device. I am testing on two phones, one is a Samsung Galaxy S and one is a Samsung Galaxy 3. On the Galaxy S everything works as expected (which is that the

MediaPlayer thinks aac* audio file is a video file?

☆樱花仙子☆ 提交于 2019-12-10 17:19:35
问题 The code runs fine but way am I geting this Erro log Erro log: 08-28 08:44:24.281: E/MediaPlayer(32454): mOnVideoSizeChangedListener is null. Failed to send MEDIA_SET_VIDEO_SIZE message. I try to convert the audio file to different format set up listeners and so on ... I really need a help with this one. Her is the whole MediaPlayer Log: Log: 08-28 08:44:24.121: V/MediaPlayer-JNI(32454): native_setup 08-28 08:44:24.131: V/MediaPlayer(32454): constructor 08-28 08:44:24.146: D/dalvikvm(32454):

Android Stop background music when Home key pressed

大兔子大兔子 提交于 2019-12-10 17:16:16
问题 I am developing an app which has multiple activities. User can navigate to any activity. I start background music from first main activity and it keeps playing throughout the application. Now I want that whenever user presses HOME key, the media player should pause playing and when user comes back to app, it starts playing again. First I made media player static and was pausing music in onPause() and playing in onResume() but it creates a jerk while switching between activities. I hope you

load a MediaPlayer from a Uri in a context assets

喜你入骨 提交于 2019-12-10 14:59:51
问题 I have an audio file in my assets directory. assets/audio/dance.mp3. If I run context.getAssets().list("audio"); it shows up. But when I try to use MediaPlayer.create(context,uri) it always fails and returns null. none of this seems to work private void tryLoad(String path,Context context) { Uri uri = Uri.parse(path); this.audioPlayer = MediaPlayer.create(context,uri); if (this.audioPlayer == null) { Log.d(TAG, "loadAudio: audioPlayer is null. current assets"+ uri.toString()) ; } else { Log.d