media-player

How to resume activity with audio in Android?

无人久伴 提交于 2019-12-04 15:20:33
I have implemented media player. I have only one Activity. When I'm starting the activity, my music starts to play and when I press the back button the music clip is in pause state, and again when I resume my activity, the music resumes properly. But there is error after I try to resume my Application after song got over. The app crashed, and I'm getting exception for IllegalStateException in back-press method( mp.pause(); ). Please have a look at below code and suggest if I am doing something wrong. public class Audio_Activity extends Activity { private MediaPlayer mp; Button btnStartStop ;

Gapless Playback with android MediaPlayer

北慕城南 提交于 2019-12-04 14:46:04
I'm trying to repeatedly play a audio continuously, without any gap. I've tried, mediaplayer.setLooping(true); But it gives a gap between repeat time. And tried this, mediaplayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { mediaplayer.start(); } }); It gives a gap also. I've tried with different audio format. But neither way worked for me. Is there any other way in android? Ganesh When a playback finishes, the player engine would check if all tracks are completed and once done, it will check for the looping flag. Based

Creating a notification for MediaPlayer with an Android Foreground Service

半城伤御伤魂 提交于 2019-12-04 14:12:02
Here is the problem. I am currently working on an application that must provide : A Radio Player (AAC live streaming from an url) And a PodCast player (MP3 Streaming from an url) The application must be able to run in background (Android Service) and be exposed to the user with a persistant notification in the Notification Bar (Android Foreground Service) (ONE problem per question so here i'll be asking for the notification) Since i have several class for managing players, i though creating a generic class for the noticication would be a good idea. Here is the kind of view i would like to

How can I make android mediaplayer play sound?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 14:03:07
问题 I don't know why it doesn't works, there is no error logged in logcat, but I cannot hear a sound. public static void DeclararSonido(int numero, Context contexto){ switch(numero){ case 0: mp = MediaPlayer.create(contexto, R.raw.alan); break; } } public static void TocarPiedra( int posicion, Context contexto){ DeclararSonido(posicion, contexto); mp.start(); mp.stop(); mp.release(); } public static void TocarSirena(Context contexto){ MediaPlayer mp2= MediaPlayer.create(contexto, R.raw.doh); mp2

ffmpeg av_seek_frame with AVSEEK_FLAG_ANY causes grey screen

穿精又带淫゛_ 提交于 2019-12-04 13:02:22
Problem: omxplayer's source code calls the ffmpeg av_seek_frame() method using the AVSEEK_FLAG_BACKWARD flag. Although not 100% sure, I believe this seeks to the closest i-frame. Instead, I want to seek to exact locations, so I modified the source code such that the av_seek_frame() method now uses the AVSEEK_FLAG_ANY flag. Now, when the movie loads, I get a grey screen, generally for 1 second, during which I can hear the audio. I have tried this on multiple computers (I am actually synchronizing them, therefore, at the same time too) so it is not a n isolated incident. My guess is that seeking

'JWPlayer-iOS-SDK/JWPlayerController.h' file not found

蹲街弑〆低调 提交于 2019-12-04 12:40:32
Followed the steps given at : https://developer.jwplayer.com/sdk/ios/docs/developer-guide/intro/getting-started/ to import JWPlayer For troubleshooting: https://developer.jwplayer.com/sdk/ios/docs/developer-guide/troubleshooting/troubleshooting/ Also installed cocoapods and in Podfile added: pod 'JWPlayer-SDK', '~> 2.4.3' ran pod install command later. What am I missing? By cocoa pod installation you must use below path to import: #import <JWPlayer-SDK/JWPlayerController.h> And by adding framework it is said at document this path: #import <JWPlayer-iOS-SDK/JWPlayerController.h> But I faced Not

Playing audio from MediaStore on a Media Player Android

泄露秘密 提交于 2019-12-04 12:03:33
Is there a way to play audio obtained from MediaStore through the use of the MediaPLayer, Or am I going in the completely wrong direction? I've looked and MediaStore.Audio so far but nothing is really helping me. I just need to know if I'm on the right track First, I assume you have basic knowledge of querying a ContentProvider and working with Cursors. If you dont, I suggest you research it here Once you have a basic knowledge of how to use a ContentProvider, query the URI MediaStore.Audio.Media.EXTERNAL_CONTENT_URI for the column Audio.Media.DATA , along with any other fields you need. Let's

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

非 Y 不嫁゛ 提交于 2019-12-04 09:59:09
问题 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

Android MediaPlayer full path to file

被刻印的时光 ゝ 提交于 2019-12-04 08:45:59
问题 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;

Android: Simultaneous video playback and recording

◇◆丶佛笑我妖孽 提交于 2019-12-04 08:43:11
I'm developing a video chat like application for Android. Can I record and play video on the screen at the same time? Can I compose the videos over one another (FaceTime style) or do the y have to be side by side? Can I use the MediaPlayer and MediaRecorder classes or do I have to use lower level APIs? Avner, To answer to your question bit wise 1> Can I record and play video on the screen at the same time? Ans : yes you can. 2> Can I compose the videos over one another (FaceTime style) or do the y have to be side by side? Ans: You can not have PIP(Picture in picture) (http://stackoverflow.com