android-mediaplayer

Android Music Seekbar is not working (Idle)

我只是一个虾纸丫 提交于 2020-01-18 05:45:28
问题 I am playing mp3 file from url, but SeekBar is not updating while playing song. When i am trying to move forcefully then song playing from start. Below code i am using to play and update SeekBar. I wanted to create a seekBar that track the progress of a mediaplayer but it doesnt work out quite well, the music is playing but the seekbar stay idle. Is there something that I left out? I think i am not not calling updateSeekBar() method from correct position...so Tried by change position of

App stops working when mediaplayer is stopped in Service Class

北战南征 提交于 2020-01-17 17:25:51
问题 I am making a media player which plays music using an URL. I implemented a foreground service and also a notification. They are working fine. The problem is when I implement .stop function in media player , which is (rathu.stop)in my code, Apps gives an error displaying app stops working. I understand that I have used stop media player function in onDestroy method of service, but I dont know other place to implement that function. Then I have to set that method to a Onclicklistner also.

Android MediaPlayer setNextMediaPlayer not working

人走茶凉 提交于 2020-01-17 06:14:07
问题 My objective is to create a VideoView that can play videos in a pre-defined play list. I'm trying to use MediaPlayer.setNextMediaPlayer(...) to allow a seamless transition between two videos. However, when the first video finishes playing, the 2nd video will not start automatically as it should according to the documentation. Xamarin Android Code : Queue<MediaPlayer> MediaPlayerList = null; private void PlayVideo() { MediaPlayerList = new Queue<MediaPlayer>(); //Let's go ahead and create all

How to close a VideoView Activity (currently have to press back twice)

别等时光非礼了梦想. 提交于 2020-01-16 04:22:05
问题 I have a simple Activity to preview a video in FullScreen. The layout of the Activity is: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/black" android:fillViewport="true"> <VideoView android:id="@+id/video" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout

How to stop the mediaplayer playing from other methods

梦想与她 提交于 2020-01-14 06:22:07
问题 I am using this setOnClickListener() inside an one of the method in my Android App.Here I have used A mediaPlayer, which is declared locally. Like this I also have two more methods which all uses mediaplayer. Also I have declared a global Mediaplayer & used it in various places of my onCreate(). public void setOnClickListenerWithMedia(ImageView iv,final int drawable,final int sound) { iv.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated

Android MediaPlayer error -1004 (ERROR_IO)

你说的曾经没有我的故事 提交于 2020-01-13 13:10:09
问题 My application plays audio stream Here the code: MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.setDataSource(url); mediaPlayer.prepare(); mediaPlayer.start(); url is local file (127.0.0.1) I use my own HttpServer which runs on the same phone. After call to mediaPlayer.prepare(); I get the error: error (1, -1004) which is ERROR_IO Any idea what is this error? Thanks, Costa. 回答1: the problem is php5 which sends a 500 http

Android MediaPlayer error -1004 (ERROR_IO)

丶灬走出姿态 提交于 2020-01-13 13:09:17
问题 My application plays audio stream Here the code: MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.setDataSource(url); mediaPlayer.prepare(); mediaPlayer.start(); url is local file (127.0.0.1) I use my own HttpServer which runs on the same phone. After call to mediaPlayer.prepare(); I get the error: error (1, -1004) which is ERROR_IO Any idea what is this error? Thanks, Costa. 回答1: the problem is php5 which sends a 500 http

mediaPlayer.getCurrentPosition() > mediaPlayer.getDuration() at the end of playing mp3 file

不问归期 提交于 2020-01-13 09:36:29
问题 I'm playing mp3 file streamed from the network in my application, some mp3 files has weird behavior: mediaPlayer.getCurrentPosition() is larger than mediaPlayer.getDuration() at the end, for about 3 seconds. The mp3 files are CBR encoded. What might be the reason of this? 回答1: Finally solved the problem by converting the mp3 files, this is the command I'm using: lame --mp3input -t -m s -b 128 --cbr input.mp3 output.mp3 回答2: There is a few reasons you can get this behavior. First it appears

Android java.io.IOException with audio streaming

∥☆過路亽.° 提交于 2020-01-13 05:52:51
问题 When I am running audioplayer in streaming by using webservices I am getting IOException 08-19 09:24:54.235: WARN/System.err(394): java.io.IOException: Prepare failed.: status=0x64 08-19 09:24:54.235: WARN/System.err(394): at android.media.MediaPlayer.prepare(Native Method) 08-19 09:24:54.235: WARN/System.err(394): at com.sparsh.xavier.media.activity.AudioPlayerActivity$6$1.run(AudioPlayerActivity.java:183) 08-19 09:24:54.295: WARN/System.err(394): at android.os.Handler.handleCallback(Handler

MediaPlayer: Couldn't open file on client side; Error(-38,0) and more

巧了我就是萌 提交于 2020-01-12 14:27:07
问题 I'm learning Android and I've created an activity that has two buttons:A ToggleButton(Play/Pause) and a Button(Next). I have two songs that would like to be cycled upon pressing Next. I have an array int [] songs={R.raw.song1,R.raw.song2}; I overrode the onClick in my Activity. The first song plays fine; but after pressing Next, I get the following errors: Couldn't open file on client side, trying server side E/MediaPlayer(3107): start called in state 4 E/MediaPlayer(3107): error (-38, 0) E