media-player

Android MediaPlayer bug when using reset() and release() calls

和自甴很熟 提交于 2019-12-03 04:36:13
The bug I'm seeing is on the calls to reset() and release() never returning thus leaving my application in an indefinitely stopping state. It doesn't matter if I call stop() before reset() or release() the hang can always be reproduced. Anyone experienced any similar issues with the MediaPlayer locking up? Any tips? I'm working on a multi-threaded application. The DDMS reports the following when looking at the threads that are holding: CLASS | METHOD | FILE | LINE | NATIVE android.media.MediaPlayer _release MediaPlayer.java -2 true android.media.MediaPlayer release MediaPlayer.java 1049 false

OnCompletion listener with MediaPlayer

青春壹個敷衍的年華 提交于 2019-12-03 04:30:54
How do i use the OnCompletion listener for some music? I would like to press a button to go to another activity that plays some music and then goes back when the music playback is finished. I allready coded the other stuff. I just cant figure out how to use the OnCompletion listener? You should put the code that should be run when the music is completed in the OnCompletionListener , for example: mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { finish(); // finish current activity } }); mPlayer.setOnErrorListener(new

Streaming with Android MediaPlayer in SDK 8

不羁岁月 提交于 2019-12-03 04:27:16
问题 SDK level 8 (Froyo) has introduced the native capability for the MediaPlayer to connect to a streaming source, like Shoutcast. Previous SDK versions were able to do workarounds, such as run a local proxy on the device (see NPR). I took the same approach as NPR and am using a StreamProxy. However, NPR first checks if the currently running SDK is less than 8. If so, it uses the proxy. Otherwise, it connects directly. My StreamProxy requests metadata from the Shoutcast server, so it does not

How do I include http headers with MediaPlayer setDataSource?

喜欢而已 提交于 2019-12-03 04:24:50
问题 I am passing a URI to the setDataSource method of the MediaPlayer object. I am targeting api version less than 14, so believe that I cannot use the new method that allows headers to be included. How can I include headers (specifically, authentication header) with the MediaPlayer request and still support older Android devices? My code looks like: mediaPlayer.setDataSource(url); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.prepareAsync(); 回答1: Background: The method

How to play radio live stream .asx video/x-ms-asf? [closed]

做~自己de王妃 提交于 2019-12-03 03:23:16
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Is there any 3rd-party library in Android or Java that can play radio live stream? File extension: .asx MIME type: video/x-ms-asf Unfortunately, MediaPlayer does not support this format! Here is the url of the live stream: http:// 38.96.148.75 /SunnahAudio

Android Media Player: Download to File and Stream From File

北城以北 提交于 2019-12-03 02:02:10
问题 I'm using Android's MediaPlayer to play MP3 files that are simultaneously downloaded from the internet using the DownloadManager . I'm aware of the MediaPlayer 's capability to stream directly, but I don't want to use that: The obvious advantage you get by downloading and simultaneously streaming from file is that this way, the file gets stored and is available locally afterwards. This works in principle - the MediaPlayer starts to play the file even if it not fully downloaded. (BTW my

android media player - how to disable range request? (broken audio streaming on Nexus 7)

我是研究僧i 提交于 2019-12-03 01:23:30
问题 I have a audio streaming app, which runs a local proxy server. The local proxy server makes a http connection to a internet streaming source, gets and buffers locally the streaming data. Then, inside in the app, I use MediaPlayer to connect to the local proxy server, using the method mediaPlayer.setDataSource(...); // the url of the local proxy server Everything was fine (with plenty of Android devices and different OS versions - 1.5...4.0), until Nexus 7 release. In Nexus 7, the media player

Android MediaPlayer full path to file

烈酒焚心 提交于 2019-12-03 00:50:28
I need to get the full path to a file somewhere on the phone (any location) and play it with MediaPlayer. ive heard of using a file chooser for Android (by launching an intent). In the test code, I just copied a resource to a another file, got the path and passed it to AudioVideoEntry (as i show later, a very simple and thin wrapper around MediaPlayer) Here's the test code I've written: private String ave_path; private String ave_file_name = "my_media_content"; private InputStream ave_fis; private OutputStream ave_fos; public void testAudioVideoEntry() { //get the Activity Module_JournalEntry

Black screen when returning to video playback activity in Android

不羁的心 提交于 2019-12-02 23:24:53
I'm currently developing the android application ServeStream and I've encountered and problem that I can't fix. My application will stream music and video using the android MediaPlayer class. I've modeled my class after the example found at: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/MediaPlayerDemo_Video.html The difference between this example and my own code is my MediaPlayer is runs in a service which allows it to continue playback in the background. The problem with the example android code is if I'm watching a video and I leave the current

MediaPlayer error -2147483648 when playing file on internal storage

随声附和 提交于 2019-12-02 22:11:45
I'm using the Audio Capture sample on android.com to record and play back audio on actual devices. (Motorola touch pad, and Samsung Galaxy S). When I define the audio file path as mFile = Environment.getExternalStorageDirectory().getAbsolutePath(); record and playback works. But if I set the audio file as mFile = getFilesDir().getAbsolutePath(); OR mFile = getDir("media", Context.MODE_PRIVATE).getAbsolutePath(); OR mFile = getDir("media", Context.MODE_WORLD_READABLE).getAbsolutePath(); record seems to work, but playback fails with ERROR/MediaPlayer(4559): error (1, -2147483648) What function