android-mediaplayer

mediaplayer getduration returns 0 only in my server files

限于喜欢 提交于 2021-02-20 03:49:38
问题 i'm trying to get the audio file duration from my server using media player MediaPlayer mp = new MediaPlayer(); try { mp.reset(); mp.setDataSource("link here"); mp.prepare(); }catch (IOException e){ e.printStackTrace(); } mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mediaPlayer) { Log.e("time",mp.getDuration()+" .."); } }); when i put my server file link , it always return 0 but when i use another link from the web it gives me

Android MediaPlayer is paused, volume buttons do not control multimedia

一笑奈何 提交于 2021-02-19 03:35:12
问题 I played a sample music (.mp3) using a sample code I found on the Internet. The code is something like MediaPlayer mp = new ... mp.setDataSource(... mp.setAudioStreamType(... mp.prepare(); mp.start(); The problem is that when the music is paused, the volume buttons do not control multimedia volume but notification volume. mp.pause(); This behaviour is different from other music players I have tested. Samsung's built-in Music, VLC, and other programs still showed multimedia volume when the

Android MediaPlayer: Play Audio Resource in Raw Based on URI

随声附和 提交于 2021-02-18 12:01:22
问题 The problem I am trying to solve is in an activity that needs to play back audio files. Most of the files will be user created (and saved into external storage), and therefore played with the following code (based on Google's example code): MediaPlayer mPlayer = new MediaPlayer(); mPlayer.setDataSource(filename); mPlayer.prepare(); mPlayer.start(); Some of the audio files, though, are going to be included with the app, are usually played with the following code: MediaPlayer mPlayer =

notify once the audio is finished playing

有些话、适合烂在心里 提交于 2021-02-18 10:56:25
问题 Well i am trying to implement basic functionality of voice recording , like Record , play/pause , stop i am able to do all of them but the only issue is how can i get notified once the audio gets finished playing. I mean if i play an audio file then once it gets finished playing i want a notification that it is stopped now. so far i have used mPlayer.start() // to start the audio mPlayer.stop(); // to stop the audio mPlayer.pause(); //to pause the audio i am just trying to find out how would

How to get amplitude of media player in Android ?

与世无争的帅哥 提交于 2021-02-11 18:19:56
问题 I want to develop an vu-meter and it reacts with sound, like a live-wallpaper Can anybody help me... 回答1: Use MediaRecorder.getMaxAmplitude This method returns the maximum absolute amplitude that was sampled since the last call to this method. Call this only after the setAudioSource(). http://developer.android.com/reference/android/media/MediaRecorder.html 回答2: I've post an answer in this other post that should help you. It gives you the amplitude of the output mix, but can even be specified

How to get amplitude of media player in Android ?

…衆ロ難τιáo~ 提交于 2021-02-11 18:18:14
问题 I want to develop an vu-meter and it reacts with sound, like a live-wallpaper Can anybody help me... 回答1: Use MediaRecorder.getMaxAmplitude This method returns the maximum absolute amplitude that was sampled since the last call to this method. Call this only after the setAudioSource(). http://developer.android.com/reference/android/media/MediaRecorder.html 回答2: I've post an answer in this other post that should help you. It gives you the amplitude of the output mix, but can even be specified

Native Crash tgkill+8 for MediaPlayer (Samsung Oreo 8.0)

会有一股神秘感。 提交于 2021-02-11 12:55:53
问题 We are seeing a weird tgkill native crash for all kinds of Samsung devices with Android Oreo 8.0. #00 pc 000000000006b818 /system/lib64/libc.so (tgkill+8) #01 pc 000000000001df10 /system/lib64/libc.so (abort+88) #02 pc 0000000000007f44 /system/lib64/liblog.so (__android_log_assert+304) #03 pc 0000000000015a94 /system/lib64/libutils.so (_ZN7android6Looper4wakeEv+192) #04 pc 0000000000695368 /system/framework/arm64/boot-framework.oat (android.os.Binder.restoreCallingIdentity [DEDUPED]+152) #05

Why does MediaPlayer.setLooping() cause an error when using VideoView?

不羁岁月 提交于 2021-02-10 23:43:35
问题 We are trying to use a VideoView to play a video in an Android Activiy. I've read the MediaPlayer documentation and studied its state diagram. We get a Media Player error if we call this method: MediaPlayer.setLooping() from this listener method: MediaPlayer.OnPreparedListener.onPrepared() The error message from LogCat: error (-38, 0) Note: We have tested on two physical devices and this only happens on our Motorola Xoom. If I comment out this line: mp.setLooping(false); everything works fine

Why does MediaPlayer.setLooping() cause an error when using VideoView?

谁都会走 提交于 2021-02-10 23:41:02
问题 We are trying to use a VideoView to play a video in an Android Activiy. I've read the MediaPlayer documentation and studied its state diagram. We get a Media Player error if we call this method: MediaPlayer.setLooping() from this listener method: MediaPlayer.OnPreparedListener.onPrepared() The error message from LogCat: error (-38, 0) Note: We have tested on two physical devices and this only happens on our Motorola Xoom. If I comment out this line: mp.setLooping(false); everything works fine

VideoView getCurrentPosition() irregularity on Acer Iconia A200

不打扰是莪最后的温柔 提交于 2021-02-07 11:16:57
问题 I have an application with a VideoView in it, I set a video to play in the VideoView. At some point while the video is playing it will get paused. Then after it is paused for some time it will begin to play the video again, but seek forward to the point that the video would be at if it had not been paused. So for instance Video starts playing Video paused at 6 seconds video stays paused for 10 seconds Video starts playing again <--- at this point I want the video to start playing at the 16