android-music-player

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

How to start the default music player from my app?

强颜欢笑 提交于 2019-12-13 13:55:18
问题 I make a app with a ListView . When I tap on a ListView item, a .ogg soundfile should start playing. Not in my app, but in the default music player app of the user. How can I do this? 回答1: Try this Intent it = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse("file:///sdcard/song.mp3"); it.setDataAndType(uri, "audio/mp3"); startActivity(it); Or Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it)

How to change the duration of the audiotrack by an infinite loop?

我是研究僧i 提交于 2019-12-13 06:11:56
问题 How to change the duration of the audiotrack by an infinite loop? I understand that I must apply the following line before audioTrack.play() : audioTrack.setLoopPoints (0, generatedSnd.length, -1); For example, I want the duration will be half a second, therefore, the "duration" variable of type "int" isn't valid. To do so I want the sound to play repeatedly and control the time to stop with a Timer. The code is: private int duration = 1; // seconds private int sampleRate = 44100; private

How can I add persistent media controls like Apollo or Google music

孤街醉人 提交于 2019-12-12 21:46:46
问题 I would like to add music controls such as play/pause, next, and back as well as show a thumbnail and song title to the bottom of an application like in the Google music app. When the thumbnail or title is tapped on, I want to bring up a detailed view of song, including a seek bar. I am wondering what the best approach for this would be. Should I just add a relative layout the the bottom of my apps xml, and add on click listeners, or can this be accomplished simply with something like the

How to get all .mp3 files from raw folder to custom array listview and play that song?

我的梦境 提交于 2019-12-12 07:01:42
问题 I am developing one app that can play .mp3 file.So,In this app i have created one custom listview adapter for populating the .mp3 files from raw folder to listview and created one model class and in my raw folder i have 20 .mp3 files.So, I want to add this all raw folder .mp3 files to listview in each row.after that when user click that particular listview item at that time play that song given position. Note: I am not importing that .mp3 files from SDCARD. Here this my adapter public class

How to convert audio Mediastore Duration to minutes and seconds?

廉价感情. 提交于 2019-12-12 02:02:44
问题 I'm using the audio player tutorial from androidhive.info and in the SongsManager.java I'm trying to convert duration to minutes and seconds. I've managed to do it but I keep getting a NumberFormatException which I don't know how to deal with. Part of the code is here: public ArrayList<HashMap<String, String>> getPlayList(Context c) { String selectionMimeType = MediaStore.Files.FileColumns.MIME_TYPE + "=?"; /*use content provider to get beginning of database query that queries for all audio

Manifest merger failed while adding io.github.jeancsanchez.jcplayer:jcplayer:0.0.2

旧巷老猫 提交于 2019-12-11 16:11:56
问题 I am trying add jc player in my project. but when i try to sync gradle the give the following error. what should i do? Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher_round) from AndroidManifest.xml:14:9-49 is also present at [io.github.jeancsanchez.jcplayer:jcplayer:0.0.2] AndroidManifest.xml:14:9-43 value=(@mipmap/ic_launcher). Suggestion: add 'tools:replace="android:icon"' to element at

Caused by: java.lang.RuntimeException: Cannot initialize effect engine for type: 0bed4300-ddd6-11db-8f34-0002a5d5c51b Error: -3

我只是一个虾纸丫 提交于 2019-12-11 09:52:12
问题 I am testing equalizer in my Android Version 7.1.1 but it shows a Runtime Exception but It's perfectly working on below version 7.0. When I try to initialize equalizer : private static UUID EQUALIZER_UUID; mp = MediaPlayer.create(this, R.raw.a); mp.start(); if(hasEqualizer()) { equalizer = new Equalizer(0, mp.getAudioSessionId()); equalizer = equalizerUtil.getEqualizer(mp); Log.d("No. of Presets",String.valueOf(equalizer.getNumberOfPresets())); } public static boolean hasEqualizer() { for

How to save “now playing” list of Music Player App in Android?

可紊 提交于 2019-12-11 05:35:59
问题 I'm going to create a simple Musicplayer for Android using Service. But I don't know the best way to save list of nowplaying. I used a database to store the list, but in this way, each time I start main player activity, I must read database and store to an array list and each time I update nowplaying, I must update the database. This way make waste of time and sometime data between Database and Arraylist is difficult to synchonized. What's the best way to solve this problem? - Store

Play multiple songs with Android intent

不羁的心 提交于 2019-12-11 01:49:08
问题 In my application, I need to launch the Android Music Player. And, for now, it works perfectly : Intent intent = new Intent(android.content.Intent.ACTION_VIEW); File file = new File(file_path); intent.setDataAndType(Uri.fromFile(file), "audio/*"); startActivity(Intent.createChooser(intent, "...")); But the user can't use the "next" and "prev" buttons to switch music. That's why I try to launch multiple songs at once (a playlist). And I don't really know how to do this! Give an array to the