media-player

Android playing stream m3u using mediaPlayer

旧时模样 提交于 2019-12-06 10:02:59
问题 I'm building an application that play streaming m3u file from web. I'm using mediaPlayer class and it works. Here's the code : String test_path = "http://cast.idvps.com:8000/djwirya.m3u"; try { mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.setDataSource(test_path); mediaPlayer.prepareAsync(); } catch (IOException e) {Log.e("Error", "No Stream");} mediaPlayer.start(); It was working perfectly. But, after a whie I compiled it again, there's no sound. pls help.... THX

Playing audio from MediaStore on a Media Player Android

廉价感情. 提交于 2019-12-06 09:00:39
问题 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 回答1: 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

Android play sound during phone call

亡梦爱人 提交于 2019-12-06 08:27:33
问题 I want to play music from android phone when some one receives a call. I am able to play music but other side can not listen that music. How can I make other side to listen to music(what should be the coding so that music playback can be inserted into mic for other side to hear)? I am getting mixed suggestion regarding this feature.check here it is possible 回答1: If you're still curious, the reason you cannot play to the other side is that Android's hardware usually doesn't interconnect the

MediaPlayer making APP not responding

a 夏天 提交于 2019-12-06 07:43:37
I have an activity that's using a MediaPlayer to play video content. The activity simulates a TV device by playing different HLS video streams on key up/down presses. After watching some video for a longer time (approx. > 15 mins), when I press any key the APP is not responding and is getting to a Force Close screen. Here's what I'm doing on every key event up/down: //I'm creating the media player object only once, after every channel switch i do: if(mMediaPlayer.isPlaying()) { mMediaPlayer.stop(); mMediaPlayer.reset(); } try { mMediaPlayer.setDataSource(app.channels.get(current_index)

ffmpeg av_seek_frame with AVSEEK_FLAG_ANY causes grey screen

有些话、适合烂在心里 提交于 2019-12-06 07:36:35
问题 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

Gapless Playback with android MediaPlayer

守給你的承諾、 提交于 2019-12-06 06:37:50
问题 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? 回答1: When a playback finishes, the player

Add Custom Controls to MoviePlayer in iPhone 3.0 SDK

时光总嘲笑我的痴心妄想 提交于 2019-12-06 04:58:12
I'd like to add custom controls to the mediaPlayer control view much as this asker: Add Custom Controls to MoviePlayer However, the solution posted in the above question is depreciated in 3.0. Does anyone know of a way to do this with the new SDK? So far I have added an overlayView to the moviePlayer view and can display my own controls on touch, but I can't seem to pass the touch on to the moviePlayer view to get it to display the native controls. I've been using touchesBegan and touchesEnded to no avail. Any help is appreciated. look at this sample project http://developer.apple.com/iphone

Closing MediaPlayer properly

折月煮酒 提交于 2019-12-06 04:31:56
I've got a MediaPlayer activity that I thought I was finished with until I noticed the verbose LogCat output and saw this constantly repeating. 01-17 17:03:50.466: D/StatusBarPolicy(209): iconIndex=1 01-17 17:03:50.476: V/StatusBarPolicy(209): cdmaLevel:1;max:4 01-17 17:03:50.476: D/StatusBarPolicy(209): iconLevel:1 01-17 17:03:50.476: D/StatusBarService(209): updateIcon slot=phone_signal index=20 viewIndex=14 old=StatusBarIcon(pkg=com.android.systemui id=0x7f020007 level=0 visible=true num=0 ) icon=StatusBarIcon(pkg=com.android.systemui id=0x7f020008 level=0 visible=true num=0 ) 01-17 17:03

How to set up Streaming audio with MediaExtractor and MediaCodec?

旧巷老猫 提交于 2019-12-06 03:51:15
问题 I am trying to stream incoming AMR_NB. I can't use MediaPlayer directly because it requires a seekable file. I would like to use MediaCodec, but to use MediaCodec I need (I think... please correct me!) MediaExtractor to give me things like the presentationTime. Is that true? Can I use MediaCodec without MediaExtractor? MediaExtractor seems to require seekable files. The documentation only specifically says so for one of the setDataSource operations but when I tried to use any of the others it

How to calculate the audio amplitude in real time (android)

瘦欲@ 提交于 2019-12-06 03:29:54
问题 I am working on an Android app where I need to calculate the audio amplitude in real time. As of now I am using MediaPlayer to play the track. Is there a way to calculate its amplitude in real time while playing it? Here is my code: int counterPlayer = 0; static double[] drawingBufferForPlayer = new double[100]; private byte[] mBytes; private byte[] mFFTBytes; private Visualizer mVisualizer; public void link(final MediaPlayer player) { if(player == null) { throw new NullPointerException(