android-mediaplayer

Streaming audio and video from a url? [closed]

谁说我不能喝 提交于 2019-12-30 07:27:12
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I want to be able to stream video and audion from a url directly into a android video player. How or what is the best way for going

Get mp3 duration in android

[亡魂溺海] 提交于 2019-12-30 04:00:46
问题 How to get mp3 track duration without creating MediaPlayer instance? I just need to show mp3 song length in mp3 file list, so I think that I shouldn't create MediaPlayer object for each of tracks in the list And another: sometimes MediaPlayer returns wrong duration of the song ( I think its so because bitrate of those files is dinamic ). How can I get right duration of the song? 回答1: You can use the MediaMetadataRetriever to get the duration of a song. Use the METADATA_KEY_DURATION in

How to get the frame from video file in android

末鹿安然 提交于 2019-12-30 03:09:46
问题 The MediaMetadataRetriever.getFrameAtTime() always returns same frames when ever call. Have a look my code private ArrayList<Bitmap> getFrames(String path){ try { ArrayList<Bitmap> bArray = new ArrayList<Bitmap>(); bArray.clear(); MediaMetadataRetriever mRetriever = new MediaMetadataRetriever(); mRetriever.setDataSource(getDataSource(path)); for (int i = 3000; i <60000; i=i+5000) { bArray.add(mRetriever.getFrameAtTime(i, MediaMetadataRetriever.OPTION_CLOSEST_SYNC)); } return bArray; } catch

Android media player bug

时光怂恿深爱的人放手 提交于 2019-12-29 09:07:55
问题 I have the media player playing an mp3 when I load my application. But I had to move this application and now every time I load the application this gives a force close error. The media player is opened like this: final MediaPlayer mp = MediaPlayer.create(Splash.this, R.raw.indra); mp.start(); I know its the media player which causes the error as when I comment the lines above out the application works. Is there any other ways I can try to load the mp3? Thanks Edit: MediaPlayer mp = new

Playing default android sound of button, clicking onTouch() method

人走茶凉 提交于 2019-12-29 03:58:05
问题 In my android app I have some buttons, that should work with onTouch() method, course I need to change button's text, when finger in ACTION_DOWN position. But this buttons should to play default android sound of button clicking (like in onClick() method). Where I can find such sound? I think, it must be in SDK, but how can I find it? And what methods are better for such operation? I'm using MediaPlayer. Listing: public boolean onTouch(View v, MotionEvent event) { int action = event.getAction(

javafxports how to call android native Media Player

隐身守侯 提交于 2019-12-27 15:57:53
问题 As the javafxports Media is not yet implemented I'm looking to use the Android Native MediaPlayer instead. Does anyone know how to do this. 回答1: If you have a look at the GoNative sample here (docs and code), you'll find a way to add Android native code to your JavaFX project. This is a simple example of adding android.media.MediaPlayer to a JavaFX project using the Gluon plugin. Based on a Single View project, let's add first an interface with the required audio method signatures: public

Streaming Audio from A URL in Android using MediaPlayer?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-27 12:08:58
问题 I've been trying to stream mp3's over http using Android's built in MediaPlayer class. The documentation would suggest to me that this should be as easy as : MediaPlayer mp = new MediaPlayer(); mp.setDataSource(URL_OF_FILE); mp.prepare(); mp.start(); However I am getting the following repeatedly. I have tried different URLs as well. Please don't tell me that streaming doesn't work on mp3's. E/PlayerDriver( 31): Command PLAYER_SET_DATA_SOURCE completed with an error or info PVMFErrNotSupported

Draw custom Seekbar on Android

僤鯓⒐⒋嵵緔 提交于 2019-12-25 19:54:49
问题 I know there are a lot of libraries about that on GitHub and several questions on stack overflow about this argument. But no of those fit my needs. I just need to draw something like this : The progress line must be yellow with no thumb. Thank you in advance. 回答1: You can use something similar to what I explained here. Just use a rectangle instead of a circle. Use on-size changed to compute the actual size of the rectangle and have a method to change the percentage and re-compute your

Draw custom Seekbar on Android

夙愿已清 提交于 2019-12-25 19:54:46
问题 I know there are a lot of libraries about that on GitHub and several questions on stack overflow about this argument. But no of those fit my needs. I just need to draw something like this : The progress line must be yellow with no thumb. Thank you in advance. 回答1: You can use something similar to what I explained here. Just use a rectangle instead of a circle. Use on-size changed to compute the actual size of the rectangle and have a method to change the percentage and re-compute your

How to get the No of track from an Artist in mediastore

断了今生、忘了曾经 提交于 2019-12-25 18:02:59
问题 I am trying to get the no of track in Artist table using mediastore. I am able to get all the artist name but when I try to get the NUMBER_OF_TRACKS I am getting error .I searched and found this But this is not the problem in my case .Here is my code try { String[] proj = {MediaStore.Audio.Artists._ID, MediaStore.Audio.Artists.ARTIST, MediaStore.Audio.ArtistsColumns.NUMBER_OF_TRACKS, MediaStore.Audio.Artists.ARTIST_KEY ,MediaStore.Audio.Artists.NUMBER_OF_ALBUMS };// Can include more data for