A sample audio app for Android

Related tags

Video/Audio uamp
Overview

Universal Android Music Player Sample

The goal of this sample is to show how to implement an audio media app that works across multiple form factors and provides a consistent user experience on Android phones, tablets, Android Auto, Android Wear, Android TV, Google Cast devices, and with the Google Assistant.

To get started with UAMP please read the full guide.

Screenshot showing UAMP's UI for browsing albums and songs Screenshot showing UAMP's UI for playing a song

Pre-requisites

  • Android Studio 3.x

Getting Started

This sample uses the Gradle build system. To build this project, use the "gradlew build" command or use "Import Project" in Android Studio.

Support

If you've found an error in this sample, please file an issue

Patches are encouraged and may be submitted by forking this project and submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.

Music

Music provided by the Free Music Archive.

License

Copyright 2017 Google Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Comments
  • Request: make it work on pre-Lollipop versions of Android

    Request: make it work on pre-Lollipop versions of Android

    Lollipop (API 21) is running on about 3.3% according to the current statistics (from here: https://developer.android.com/about/dashboards/index.html ) .

    The sample works only from this API level. On previous, it crashes.

    If Google tried to show here how to address as many devices and screens, this sample works on a very small fraction of the available ones.

    Please make it support the majority of devices out there.

    opened by AndroidDeveloperLB 34
  • Error:Error: File path too long on Windows, keep below 240 characters

    Error:Error: File path too long on Windows, keep below 240 characters

    When I import the project ,it shows me Error:Error: File path too long on Windows, keep below 240 characters : D:\project\android-UniversalMusicPlayer-master\android-UniversalMusicPlayer-master\mobile\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\9.4.0\res\drawable-tvdpi-v4\common_google_signin_btn_icon_dark_disabled.9.png I have tried to rename the common_google_signin_btn_icon_dark_disabled.9.png,but it didn't work; how to solve this question?

    opened by lsw645 13
  • Crash!!!!!!!!!!!!

    Crash!!!!!!!!!!!!

    08-16 10:42:46.643 30212-30212/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                       Process: com.example.android.uamp, PID: 30212
                                                       java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.uamp/com.example.android.uamp.ui.MusicPlayerActivity}: java.lang.RuntimeException: com.google.android.gms.internal.zzsb$zza: No acceptable module found. Local version is 0 and remote version is 0.
                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2641)
                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2710)
                                                           at android.app.ActivityThread.access$800(ActivityThread.java:179)
                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561)
                                                           at android.os.Handler.dispatchMessage(Handler.java:111)
                                                           at android.os.Looper.loop(Looper.java:194)
                                                           at android.app.ActivityThread.main(ActivityThread.java:5803)
                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                           at java.lang.reflect.Method.invoke(Method.java:372)
                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1010)
                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
                                                        Caused by: java.lang.RuntimeException: com.google.android.gms.internal.zzsb$zza: No acceptable module found. Local version is 0 and remote version is 0.
                                                           at com.google.android.gms.internal.zzni.zzbg(Unknown Source)
                                                           at com.google.android.gms.internal.zzni.zza(Unknown Source)
                                                           at com.google.android.gms.cast.framework.CastContext.<init>(Unknown Source)
                                                           at com.google.android.gms.cast.framework.CastContext.getSharedInstance(Unknown Source)
                                                           at com.example.android.uamp.ui.ActionBarCastActivity.onCreate(ActionBarCastActivity.java:141)
                                                           at com.example.android.uamp.ui.BaseActivity.onCreate(BaseActivity.java:49)
                                                           at com.example.android.uamp.ui.MusicPlayerActivity.onCreate(MusicPlayerActivity.java:57)
                                                           at android.app.Activity.performCreate(Activity.java:6107)
                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2594)
                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2710) 
                                                           at android.app.ActivityThread.access$800(ActivityThread.java:179) 
                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561) 
                                                           at android.os.Handler.dispatchMessage(Handler.java:111) 
                                                           at android.os.Looper.loop(Looper.java:194) 
                                                           at android.app.ActivityThread.main(ActivityThread.java:5803) 
                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1010) 
                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) 
                                                        Caused by: com.google.android.gms.internal.zzsb$zza: No acceptable module found. Local version is 0 and remote version is 0.
                                                           at com.google.android.gms.internal.zzsb.zza(Unknown Source)
                                                           at com.google.android.gms.internal.zzni.zzbg(Unknown Source) 
                                                           at com.google.android.gms.internal.zzni.zza(Unknown Source) 
                                                           at com.google.android.gms.cast.framework.CastContext.<init>(Unknown Source) 
                                                           at com.google.android.gms.cast.framework.CastContext.getSharedInstance(Unknown Source) 
                                                           at com.example.android.uamp.ui.ActionBarCastActivity.onCreate(ActionBarCastActivity.java:141) 
                                                           at com.example.android.uamp.ui.BaseActivity.onCreate(BaseActivity.java:49) 
                                                           at com.example.android.uamp.ui.MusicPlayerActivity.onCreate(MusicPlayerActivity.java:57) 
                                                           at android.app.Activity.performCreate(Activity.java:6107) 
                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) 
                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2594) 
                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2710) 
                                                           at android.app.ActivityThread.access$800(ActivityThread.java:179) 
                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561) 
                                                           at android.os.Handler.dispatchMessage(Handler.java:111) 
                                                           at android.os.Looper.loop(Looper.java:194) 
                                                           at android.app.ActivityThread.main(ActivityThread.java:5803) 
                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1010) 
                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) 
    
    opened by tjzhou23 11
  • MediaBrowserServiceCompat with support-v4-24.1.1 doesn't works

    MediaBrowserServiceCompat with support-v4-24.1.1 doesn't works

    start a track open the FullScreenPlayerActivity go back

    W/MBServiceCompat: getMediaItem for callback that isn't registered id=BY_GENRE/Genre 1 W/MBServiceCompat: addSubscription for callback that isn't registered id=BY_GENRE/Genre 1

    opened by loki666 11
  • Unable to advance to next or other song while playing to Chromecast Audio

    Unable to advance to next or other song while playing to Chromecast Audio

    Hi, I've noticed that when I'm playing a song on the list (from the default Google server) to Chromecast Audio and select another song on the list or try to skip to the next song, an error is thrown (see log below) about 5 times and it doesn't progress to the next or selected song. Instead it just moves on to a random song on the list, or keeps playing the same song. This is with the code directly complied and run on a tablet, without any modification. Oh, and this does not happen when Chromecast is not being used. Can anyone please help? Thanks.

    11-15 03:08:49.792 18204-18204/com.example.android.uamp E/MediaNotificationServiceImpl: Unregistering trampoline BroadcastReceiver failed java.lang.IllegalArgumentException: Receiver not registered: yy@8f7a15d at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:789) at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1200) at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:576) at yx.b(:com.google.android.gms.DynamiteModulesC@11746440:105) at yp.onTransact(:com.google.android.gms.DynamiteModulesC@11746440:22) at android.os.Binder.transact(Binder.java:392) at com.google.android.gms.internal.zzed.zzb(Unknown Source) at com.google.android.gms.cast.framework.media.zze.onDestroy(Unknown Source) at com.google.android.gms.cast.framework.media.MediaNotificationService.onDestroy(Unknown Source) at android.app.ActivityThread.handleStopService(ActivityThread.java:3244) at android.app.ActivityThread.-wrap21(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1591) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5728) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749)

    bug 
    opened by ryanckim 10
  • Exception of Attribute

    Exception of Attribute "dotRadius" already defined with incompatible format.

    Hi-I tried to change the Android support libraries version(to 24.0.0), but it occurs some exception.

    C:\Users~\Downloads\Compressed\UniversalMusicPlayer\mobile\build\intermediates\res\merged\debug\values\values.xml Error:(352) Attribute "dotRadius" already defined with incompatible format. Error:(335) Original attribute defined here. Error:Execution failed for task ':mobile:processDebugResources'.

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users~\Android\Android-Sdk\build-tools\24.0.0\aapt.exe'' finished with non-zero exit value 1

    opened by ghost 10
  • Unable to start receiver android.support.v4.media.session.MediaButtonReceiver

    Unable to start receiver android.support.v4.media.session.MediaButtonReceiver

    fhas a bug from farbic like this (device running Android 4.x): Caused by java.lang.IllegalArgumentException: MediaButtonReceiver component may not be null. at android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase.(MediaSessionCompat.java) at android.support.v4.media.session.MediaSessionCompat.(MediaSessionCompat.java) at android.support.v4.media.session.MediaSessionCompat.(MediaSessionCompat.java) at com.zhulang.reader.audio.MusicService.onCreate(MusicService.java:162) at android.app.ActivityThread.handleCreateService(ActivityThread.java:2756) at android.app.ActivityThread.access$1800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5322) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) at dalvik.system.NativeStart.main(NativeStart.java)

    obsolete 
    opened by moon2009 9
  • Play Media by Custom URI

    Play Media by Custom URI

    How am i able to stream for example an mp3-Stream from an Radio-Station in the UAMP-App? The Source-Code doesnt show anything which could help me...

    My aim is to play a simple https://example.com/test.mp3-File which will be played.

    Either where are the Media-Files comming from in the Example-App?

    opened by herbertvonkaramalz 8
  • mediaBrowser.connect()  crash

    mediaBrowser.connect() crash

    In android 8.0 or above, I met a problem.

    when i called MediaBrowser.connect() ,it will crash sometimes.

    Caused by java.lang.IllegalStateException: connect() called while neither disconnecting nor disconnected (state=CONNECT_STATE_CONNECTING) at android.media.browse.MediaBrowser.connect(MediaBrowser.java:152) at android.support.v4.media.MediaBrowserCompatApi21.connect(Unknown Source:2) at android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21.connect(Unknown Source:2) at android.support.v4.media.MediaBrowserCompat.connect(Unknown Source:2)

    Looks like connect() being called multiple times.But I called disconnect() in onStop().

    I can't reproduce it ,I just saw it in the fabric log.

    bug 
    opened by lsp19880926 8
  • Bug: No lock screen image and controls

    Bug: No lock screen image and controls

    Each time I choose an item from the list, I can see it and the previous one flashes. Also the notification disappears and re-appears. In addition, each time I choose an item, I don't see its photo on the lock screen, and the notification on the lock screen doesn't have next&previous actions. See attached video: device-2018-07-01-022625.zip

    Are those intentional?

    bug 
    opened by AndroidDeveloperLB 8
  • Service and playback are stopped after killing the app.

    Service and playback are stopped after killing the app.

    Enter the full player screen, tap play-pause-play and then kill the app. Service is killed with it and playback as well. It happens because in onPlaybackStop() callback we're calling stopForeground(true) and foreground service becomes background and is attached to app lifecycle.

    obsolete 
    opened by kaganovych 8
  • How can i set a drawable file in MediaItem in automotive app?

    How can i set a drawable file in MediaItem in automotive app?

    I modified following code to set a simple MediaItem one Browsable and one playable. But Still it shows a system default art image.

    @Override
    public void onLoadChildren(final String parentMediaId, final Result<List<MediaBrowser.MediaItem>> result) {
        // Return the children of the given parent media item
        List<MediaBrowser.MediaItem> children = getChildren(parentMediaId);
        result.sendResult(children);
    }  
    private List<MediaBrowser.MediaItem> getChildren(String parentId) {
        int drawableResourceId = R.drawable.finallogo;
        Uri drawableUri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"
                + "com.examole.app" + "/" + drawableResourceId);
        List<MediaBrowser.MediaItem> children = new ArrayList<>();
        if (parentId.equals("root")) {
     children.add(new MediaBrowser.MediaItem(new MediaDescription.Builder()
    
                    .setMediaId("media_item_1")
                    .setTitle("Browsable Item")
                    .setSubtitle("test")
                    .setIconUri(drawableUri)
                    .build(),MediaBrowser.MediaItem.FLAG_BROWSABLE ));
        }else{
            children.add(new MediaBrowser.MediaItem(new MediaDescription.Builder()
                .setMediaId("media_item_1")
                .setTitle("Playable Item")
                .setSubtitle("test2")
                    .setIconUri(drawableUri)
                .build(), MediaBrowser.MediaItem.FLAG_PLAYABLE));
        }
        return children;
        }
    

    Can Someone please please help me on this issue. And there are no many examples for Automotive OS out there either. I would Love to know what is going on.

    opened by thivankasarathchandra 1
  • Use API 28 signature retrieval APIs for the allowlisting logic

    Use API 28 signature retrieval APIs for the allowlisting logic

    UAMP uses PackageInfo#signatures, see https://github.com/android/uamp/blob/2136c37bcef54da1ee350fd642fc61a744e86654/common/src/main/java/com/example/android/uamp/media/PackageValidator.kt#L107 - this is deprecated in API 28. The newer APIs involve using PackageInfo#signingInfo. The associated APIs on that class - apkContentsSigners, signingCertificateHistory, hasMultipleSigners - need careful attention to ensure they are used correctly. We could adjust UAMP to show proper usage of these APIs.

    For reference, this StackOverflow answer - https://stackoverflow.com/a/53407183 - has a reasonable-looking implementation. My understanding is that in the apkContentsSigners path, we should check that all certificates matches, while in the signingCertificateHistory path, we need to only check that one certificate matches.

    opened by SebastianJay 0
  • Android auto does not play whole album songs list

    Android auto does not play whole album songs list

    Android auto does not play whole album songs list

    I was testing the Jetpack compose media3 UAMP code. on the polestar emulator and Phone, I noticed the player activity in Auto (Polestar) emulator does not play all the songs from the album

    Steps to reproduce

    On polestar emulator play the Album Jazz in Paris which has 3 songs

    1. jazz in Paris
    2. The Messenger 3)Talkies

    now when we click on the song -> The messenger it plays only that song and when we click the previous button it goes to the start of that song only, not play the previous song (even after multiple previous clicks).

    the next song option is not available at all. Capture2

    Where as if we test it in the Phone we can play whole album.

    like this

    Capture3

    opened by pawaom 0
  • pattern to follow for Jetpack Media3

    pattern to follow for Jetpack Media3

    pattern to follow for Jetpack Media3

    The Android media3 video specifies https://www.youtube.com/watch?v=sTIBDcyCmCg&t=480s , mediacontroller is a player implementation, we can direclty pass it to the playerview,

    So do we need a mediaconnection class, or we can directly use the implement in the activity and serviceclass, like it was provied in the mediasessions demo

    https://github.com/androidx/media/tree/release/demos/session

    follows this pattern , should we follow this , then a lot of code is removed. Then UAMP compose/media3 demo still follows the old pattern , can there be a proper explanation, and if we need to follow the mediasession demo pattern, will the UAMP code be updated to that pattern.

    opened by pawaom 0
  • Any Plans to include Dagger Hilt and StateFlow in future Release with media3 and jetpack compose

    Any Plans to include Dagger Hilt and StateFlow in future Release with media3 and jetpack compose

    Any Plans to include Dagger Hilt and StateFlow in future Release with media3 and jetpack compose

    While the UAMP code has incorporated coroutines, media3 and jetpack compose in the new implementation , however why have they not included dagger hilt and stateflow both developed by google.

    Generally it is recommended to use latest technologies and we are required to keep projects updated to the latest android versions and other such requirements, the standard pattern is not followed with examples provided by google itself. comparing the mediasession demo provided by media3 and UAMP , both have followed totally different development paths. This can cause confusion among new developers as to which standard we should follow.

    opened by pawaom 0
  • Modernize build versions

    Modernize build versions

    Hit an issue with a too old version of gradle stopping it working in recent Android Studio.

    Happy to close, but since I updated some build dependencies, thought it worth offering it up. I understand if there are legacy reason why you don't want upgrades.

    opened by yschimke 2
Releases(v2.0)
Owner
Android
Android
Silky - Android application to convert videos from applications such as YouTube, Facebook, Twitter into audio (.mp3)

Silky Español (actualmente la app se encuentra en desarrollo ) Descripcion Aplic

null 2 Aug 24, 2022
Video/Audio Downloader for Android, written with Jetpack Compose.

Seal Video/Audio Downloader for Android, written with Jetpack Compose.

junkfood 2.1k Dec 29, 2022
A fork of audio-analyzer-for-android in Google code, with a lot of enhancement.

Audio Spectrum Analyzer for Android A fork of Audio spectrum Analyzer for Android (See README.old for its original readme) This software shows the fre

null 74 Jan 1, 2023
A radio player mobile application which streams audio from Radio Sai Global Harmony.

A radio player mobile application which streams audio from Radio Sai Global Harmony.

Sai Rajendra Immadi 11 Nov 26, 2022
Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface.

Fermata Media Player About Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface. It is focused on

Andrey 227 Jan 6, 2023
Radio Player - A Flutter plugin to play streaming audio content with background support and lock screen controls.

A Flutter plugin to play streaming audio content with background support and lock screen controls. Installation To use this package, add

Ayotunde abdulsalam 1 Mar 14, 2022
Fire TV Sample App Android - Touch and D-Pad

Fire TV Sample App Android - Touch and D-Pad This sample Android project demonstrates how to build the main UI of a Fire TV application in order to su

Amazon 10 Nov 11, 2022
Sample HLS Video player in Kotlin with mvvm

HLSVideoPlayer Sample HLS Video player in Kotlin with mvvm Note: mvvm is partially implemented due to time constraint, so here is a scope for improvem

null 0 Apr 9, 2022
An app that can initiate call functionality in VoicePing app via broadcast

Guard App An app that can initiate call functionality in VoicePing app via broad

null 1 Jan 13, 2022
FFmpeg compiled for Android. Execute FFmpeg commands with ease in your Android app.

FFMPEG video operations FFmpeg compiled for Android. Execute FFmpeg commands with ease in your Android app. Getting Started This project is provide in

Simform Solutions 277 Jan 2, 2023
Android podcast app made with Jetpack Compose and ExoPlayer.

Podcast App Android podcast app made with Jetpack Compose and ExoPlayer. Podcast information provided by Listen Notes API. Features Jetpack Compose UI

Fabian 302 Jan 2, 2023
Transistor - Simple Radio App for Android

Transistor is an app with a minimalistic approach for listening to radio programs over the internet, which may not be to everyone's liking

y20k 421 Dec 29, 2022
Convert your YouTube channel into a native Android app using YouTube Data API v3.

Convert your YouTube channel into an app. Screenshots • Description • Features • Configuration • Documentation Screenshots Description Channelify is a

Aculix Technologies LLP 121 Dec 26, 2022
Noice is an android app that allows you to create your own set of background sounds by mixing clips from environmental sources.

A native Android app to relax, improve focus and boost productivity with minimal background noise.

Ashutosh Gangwar 666 Jan 3, 2023
An offline music player android app, with modern UI and powerful features

Pulse Music An offline music player android app, with modern UI and powerful features If you liked this repo, fork it and leave a STAR. Your support m

Sharath 7 Apr 11, 2022
SocyMusic is an open-source Android music player written in Java with the aim of creating an easy-to-use app for exchanging and listening to top-quality music. Help us create it!

SocyMusic SocyMusic is an open-source Android music player written entirely in Java. It's objectives are to provide top-quality music to everyone for

Benji 23 Dec 26, 2022
Dicio assistant app for Android

Dicio assistant Dicio is a free and open source voice assistant running on Android. It supports many different skills and input/output methods, and it

Stypox 376 Dec 31, 2022
Android app that uses Spotify API to recommend new music based on your listening history

Android app that uses Spotify API to recommend new music based on your listening history. Written in Kotlin and uses Spotify Web API and Android SDK. New music is presented in swipe cards where a left swipe plays the next song and a right swipe can add the app to your liked songs in Spotify.

null 3 Jun 5, 2022
Proof of concept app for Android permanent denial-of-service vulnerability CVE-2020-0443

CVE-2020-0443 This is a proof of concept app that exploits CVE-2020-0443 to brick any Android device. After running the app and rebooting, the device

Sithija 11 Dec 21, 2022