android-music-player

Use .setDataSource to get mediaMetadata from currently playing music app

主宰稳场 提交于 2019-12-02 13:43:23
问题 I want to get MediaMetadata (song title / artist) from the current playing android audio source for any app (spotify, google play, soundcloud, YouTube, blackplayer, etc) and am trying to use MediaMetadataRetriever.setDatSource Currently I have a function 'getActiveNotifications' in 'MainActivity.java' that gets called whenever a button is pressed, my code looks like this: public void getActiveNotifications(View view) { String temp ="temp"; Log.i("myTag", "Logging active notifications:"); /

Use .setDataSource to get mediaMetadata from currently playing music app

為{幸葍}努か 提交于 2019-12-02 08:28:48
I want to get MediaMetadata (song title / artist) from the current playing android audio source for any app (spotify, google play, soundcloud, YouTube, blackplayer, etc) and am trying to use MediaMetadataRetriever.setDatSource Currently I have a function 'getActiveNotifications' in 'MainActivity.java' that gets called whenever a button is pressed, my code looks like this: public void getActiveNotifications(View view) { String temp ="temp"; Log.i("myTag", "Logging active notifications:"); //get data from MediaMetaData somehow? Always displays correct string in Logcat MediaMetadataRetriever mmr

how to know when audio is started playing in android

拥有回忆 提交于 2019-12-02 00:27:17
问题 In my application I want to get start time of music player when user started and end time when it stops.I don't want to start any music player in my app. I just want to track user activity in device. So i want my application to get any notification when user started the music . Do I get any intent for music player started and it stopped.Or do I get any intent for when user opens music files. Is there any other method other than intent to capture the start time and and time when user starts

how to know when audio is started playing in android

痞子三分冷 提交于 2019-12-01 21:24:36
In my application I want to get start time of music player when user started and end time when it stops.I don't want to start any music player in my app. I just want to track user activity in device. So i want my application to get any notification when user started the music . Do I get any intent for music player started and it stopped.Or do I get any intent for when user opens music files. Is there any other method other than intent to capture the start time and and time when user starts music player. Well you can implement the interface 'AudioManager.OnAudioFocusChangeListener' in which

Android MediaPlayer is preparing too long

倖福魔咒の 提交于 2019-12-01 17:53:43
Hey, I'm using MediaPlayer to play a regular ShoutCast stream. The code is straightforward with prepareAsync() and a handler to start the playback. While it works flawlessly with some streams like DI.FM or ETN.FM (http://u10.di.fm:80/di_progressive), with others (http://mp3.wpsu.org:8000/) it won't go past the prepare state. No other listeners are called either. //Uri streamUri = Uri.parse("http://u10.di.fm:80/di_progressive"); /* works */ Uri streamUri = Uri.parse("http://mp3.wpsu.org:8000/"); /* stuck on prepare state */ MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer

Android MediaPlayer is preparing too long

纵饮孤独 提交于 2019-12-01 17:43:14
问题 Hey, I'm using MediaPlayer to play a regular ShoutCast stream. The code is straightforward with prepareAsync() and a handler to start the playback. While it works flawlessly with some streams like DI.FM or ETN.FM (http://u10.di.fm:80/di_progressive), with others (http://mp3.wpsu.org:8000/) it won't go past the prepare state. No other listeners are called either. //Uri streamUri = Uri.parse("http://u10.di.fm:80/di_progressive"); /* works */ Uri streamUri = Uri.parse("http://mp3.wpsu.org:8000/"

Showing a common music player in all activities

瘦欲@ 提交于 2019-12-01 00:22:49
I'm working on an app for a band, which consists of several different activities such as an agenda, news section, album section et cetera. Since it's for a band, I would like to play the band's songs in the background. This isn't such a problem, but I would like to show a small music player on the bottom of all activities so users can always stop, skip, or replay a song if they want to. An example of this can be found in the apps of Mobile Roadie, for instance. However I have no idea how to do this. My best guess is creating a music player class with its own layout, and including this at the

How do I access the MediaMetadataRetriever.setDataSource(…) status codes?

倾然丶 夕夏残阳落幕 提交于 2019-11-30 08:04:49
问题 I'm getting the following error java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA and I'd like to know what this status is. I'm using the function MediaMetaDataRetriever.setDataSource(String filePath) 回答1: I got this error java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA when tried to call void setDataSource(String path) on an empty file. (0 bytes) You need to be 100% sure that path for the file is not null, not empty, the file itself exists and valid.

Android music player widget

↘锁芯ラ 提交于 2019-11-30 05:20:01
I'm working on a music player-widget (home screen widget).. It only needs to play 1 song, (Preferably with the MediaPlayer class). But I'm not sure how to implement it. I'm kind of inexperienced with Android development, just so that's mentioned. The class I have so far extends AppWidgetProvider , and I guess it is not a good idea to let this class handle the music-playing part, but rather a Service . And if so, how? Furthermore, I have 3 buttons: play, pause and stop, and I can distinguish which one has been pressed in onReceive(...) . Thanks in advance! Here is the class. public class

Android SeekBar setProgress is causing my MediaPlayer to skip

时间秒杀一切 提交于 2019-11-30 05:07:00
I'm trying to use a SeekBar to display both the length of a track played by a MediaPlayer class and to enable seeking within the track. Seeking within the track works well. However, updating the progress value using setProgress while the track is playing seems to cause a slight skip. In the onCreate method I create a Thread with a loop which updates the SeekBar's progress value for the current track. This loop resets when the track is changed. private void createProgressThread() { _progressUpdater = new Runnable() { @Override public void run() { //Exitting is set on destroy while(!_exitting) {