media-player

Android Media Player: Url is not set properly

别说谁变了你拦得住时间么 提交于 2019-12-25 02:59:36
问题 i tried a lot to play the music from localhost path but it is not playing i am getting an error as uri is not correctly given means it is going to catch block in the below code i have designed as this in xml file 2 buttons which is start and stop then populated the uri in java file can anyone help me in correcting the code below public class MusicAndroidActivity extends Activity { static MediaPlayer mPlayer; Button buttonPlay; Button buttonStop; @Override public void onCreate(Bundle

How to pause/resume a song in javafx?

偶尔善良 提交于 2019-12-25 02:57:11
问题 I'm making a playlist based mp3 player using javafx and I got everything working except how to pause/resume a song. I tried simply checking the player.Status() and using that but it didn't work so I stored the time of the song when pause() is clicked, in a Duration pausetime variable and it works that way but only once. What happens is: I click pause() , it works, click play() , it resumes the song but after that the pause button stops doing anything. Btw I'm using two separate ToggleButton

Mediaplayer WinForm won't play

丶灬走出姿态 提交于 2019-12-25 02:19:54
问题 I have this code which checks if a song has ended, and if it has selects the next one. I have the song names in a ListBox, so when the next song gets selected the first function triggers. Can you explain me why it doesn't play the song? private void Files_SelectedIndexChanged(object sender, EventArgs e) { player.URL = percorsi[Files.SelectedIndex]; } private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent er) { if (er.newState == 8) { Files.SetSelected(

Problem streaming video using media source extensions

蹲街弑〆低调 提交于 2019-12-24 17:31:08
问题 I seem to have a very strange problem. I am trying to play a video which is being streamed live using a web browser. For this, I am looking at the MediaSource object. I have got it in a way so that the video is taken from a server in chunks to be played. The problem is that the first chunk plays correctly then playback stops. To make this even more strange, if I put the computer to sleep after starting streaming, then wake it up andthe video will play as expected. Some Notes: I am currently

Android how to stop media player when new sound start in Recycleview

吃可爱长大的小学妹 提交于 2019-12-24 16:17:06
问题 I try to find solution but could not find it. My problem is that i have lots of items in recycleview. Each item has image and when i click that image it start sound for that image. Problem is when i start new sound previous sound do not stop, its keep playing until sound finish. After i click 15, 20 sounds app get crashed and i receive this error message: E/MediaPlayer: error (1, -19) Somehow i need to implement release and stop of the previous sound when i click on the new one. I try to find

VideoView plays ok, but not visible when swapping fullscreen views

ⅰ亾dé卋堺 提交于 2019-12-24 10:37:28
问题 I have some AsyncTask that loads a video stream into the player, so I want to show some Loading screen while it performs. Currently my onCreate code looks like this: final View loadingView = getLayoutInflater().inflate(R.layout.video_loading, null); final View playerView = getLayoutInflater().inflate(R.layout.player, null); final VideoView videoView = (VideoView) playerView.findViewById(R.id.canvas); Log.d(TAG, "Running video player for video " + videoId); new VideoPlayingTask(this, videoView

Android: Is there a way to change MediaPlayer urls?

寵の児 提交于 2019-12-24 10:04:29
问题 is there a way to change the urls without compiling the app or deployment once i pushed to the market? the url might change in future or point to different urls. currently i am hardcoding the urls somethign like this: try { url = "http://ofertaweb.ro/android/sleepandlovemusic/" + songs_array[counter] + ".mp3"; mediaPlayer.setDataSource(url); } 回答1: Do not hardcode your URL at project build time, consider writing code that dynamically resolve it at application run time. for example, you can

Android: Playing two sounds one after the other

一笑奈何 提交于 2019-12-24 08:24:04
问题 I am trying to play two sound items, one after the other MediaPlayer mp = null; protected void produceErrorSound(int index) { if (mp != null) { mp.reset(); mp.release(); } mp = MediaPlayer.create(this, index); mp.start(); } public void correctAnswerAndNext(){ produceErrorSound(R.raw.right1) ; produceErrorSound(R.raw.right1) ; } but only second sound is produced. is there any alternative approach? 回答1: I can't see any wait mechanism in your code. You can use an onCompletionListener to receive

Android: How get error of Media Player and use it?

眉间皱痕 提交于 2019-12-24 08:16:04
问题 I use SurfaceView for video player If in stream not load video , in logcat view error info(701,0) How get info(701,0) and use it ? Sample : if(error == 701){ .... } 回答1: Yes, you could use setOnErrorListener(..) to your VideoView and handle the errors there. Here is an example: mVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { switch(what){ case MediaPlayer.MEDIA_ERROR_UNKNOWN: // handle MEDIA_ERROR

Android local RTSP server (spoof), PVPlayer closes TCP socket after DESCRIBE reply sent

风流意气都作罢 提交于 2019-12-24 08:05:55
问题 I'm trying to "spoof" the android player. I want MediaPlayer (I'm using the VideoView wrapper) to connect to localhost so that I may reply to its RTSP requests. The application works fine when the underlying video system is the VisualOn type (VOME) however any device which uses the PacketView system (PVPlayer) the TCP connection is closed after I send the reply to the DESCRIBE request/challenge. I know for a fact the reply is not the issue. When I take the exact code (generating the same