android-mediaplayer

Android MediaPlayer.Create() returns null

谁说我不能喝 提交于 2019-12-17 20:48:56
问题 I am developing an Android App that plays some sounds. For that I am creating an object of MediaPlayer. Below is the code: mp = MediaPlayer.create(this, R.raw.testSound); Here mp is null for Android 2.3.3 (API Level 10), i tried with other versions of Android (2.1, 2.2 etc.) it works fine. However with Android 2.3.3 (API Level 10) MediaPlayer.create() call returns null. The sound file (testSound.wav) is a wav file. I tried parsing the wav file to see if it is corrupted or not. It seems just

Stop MediaPlayer service when app goes in Background

拥有回忆 提交于 2019-12-17 20:36:11
问题 I have a media player service that plays music in the background of my app throughout activities like : public class Music extends Service { MediaPlayer player; @Override public IBinder onBind(Intent intent) { return null; } public void onCreate() { player = MediaPlayer.create(this, R.raw.music); player.setLooping(true); } public int onStartCommand(Intent intent, int flags, int startId) { player.start(); return Service.START_NOT_STICKY; } public void onDestroy() { player.stop(); player

MediaPlayer cannot render to TextureView after image render

与世无争的帅哥 提交于 2019-12-17 19:48:13
问题 I have a MediaPlayer rendering videos to a TextureView . This is working. Now, I want to display a still image on this TextureView for a given time, then get the MediaPlayer to render a video to the same TextureView . Here's my code to render the bitmap: Canvas canvas = mTextureView.lockCanvas(); canvas.drawBitmap(sourceBitmap, matrix, new Paint()); mTextureView.unlockCanvasAndPost(canvas); After this, any attempts to play videos result in ERROR_INVALID_OPERATION (-38) being triggered from

Playing audio files one after another

别说谁变了你拦得住时间么 提交于 2019-12-17 19:21:30
问题 I have a list of audio files like this, int music_numbers[] = { R.raw.one, R.raw.two, R.raw.three, R.raw.four, R.raw.five, R.raw.six, R.raw.seven, R.raw.eight, R.raw.nine }; I need to play this one by one - when i send 100 to this play_numbers method - i am intend to play digit wise.. I have done this - but i unable to do this one after another.. private void _play_numbers(final String i) { // TODO Auto-generated method stub mPlayer = MediaPlayer.create(PlayFileActivity.this, R.raw.payment);

Android Media Player Library [closed]

半世苍凉 提交于 2019-12-17 18:57:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Just finished my code to use the default Media Player from Android, pretty pleased with the media player untill I saw the supported file-extensions. No wmv, no flv etc. etc. So I'm wondering, does somebody knows a library for Android to view the video's... If not, could you give me a little advice how to

Get Album Art With Album Name Android

◇◆丶佛笑我妖孽 提交于 2019-12-17 17:48:31
问题 I want to display album art with album name in listview. But i am not getting the way to display album art. I have tried from cover art on android. Here is my Code : Cursor cursor = managedQuery(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, null, null, null, null); if (cursor == null) { //Query Failed , Handle error. } else if (!cursor.moveToFirst()) { //No media on the device. } else { int titleColumn = cursor.getColumnIndex(android.provider.MediaStore.Audio.Albums.ALBUM_ART); int id =

Playing video using textureview in recyclerview

旧时模样 提交于 2019-12-17 17:33:40
问题 I am trying to implement a list with videos like vine or Instagram app. Where they play video plays when list item is shown or fully visible and video pauses when list item gets hided. I am using textureview with media player to play a video from url and added it as list item in recyclerview. Following is my code. VideosAdapter Class: public class VideosAdapter extends RecyclerView.Adapter<VideosAdapter.ViewHolder> { Context context; private ArrayList<String> urls; public static class

how to get frames of video file in android

纵然是瞬间 提交于 2019-12-17 17:14:59
问题 I want to get the frames of a video file to show in a gallery view in android. and how to edit frames, for example Select frame sections use selected sections delete selected sections copy selected sections cut selected sections paste into the head paste into the tail 回答1: You can use the MediaMetadataRetriever class. It has getFrameAt() method wherein you can specify the time of the frame that you want to get. For details refer to MediaMetadataRetriever 回答2: Actually, MediaMetadataRetriever

how to get frames of video file in android

被刻印的时光 ゝ 提交于 2019-12-17 17:13:19
问题 I want to get the frames of a video file to show in a gallery view in android. and how to edit frames, for example Select frame sections use selected sections delete selected sections copy selected sections cut selected sections paste into the head paste into the tail 回答1: You can use the MediaMetadataRetriever class. It has getFrameAt() method wherein you can specify the time of the frame that you want to get. For details refer to MediaMetadataRetriever 回答2: Actually, MediaMetadataRetriever

Not able to get getDuration() for AAC file using ExoPlayer

♀尐吖头ヾ 提交于 2019-12-17 14:58:42
问题 I have been trying to stream a URL using ExoPlayer . The URLs: STREAM_URL_1 = "http://storage.googleapis.com/exoplayer-test-media-0/play.mp3" STREAM_URL_2 = "https://s3-ap-southeast-1.amazonaws.com/ok.talk.channels/zakirkhan/Zakir+khan+-+when+my+father+took+my+gf%27s+call.aac" Both URLs play but I am not able to get the getDuration() for STREAM_URL_2 which is an .aac file. The .mp3 works. The following is how I do it. How do I get the getDuration() for the 2nd URL. Even seekTo() doesn't work