{"id":13566271,"url":"https://github.com/googlesamples/android-media-controller","last_synced_at":"2025-04-04T13:12:52.803Z","repository":{"id":22069663,"uuid":"95148718","full_name":"googlesamples/android-media-controller","owner":"googlesamples","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-09T11:19:02.000Z","size":12122,"stargazers_count":461,"open_issues_count":11,"forks_count":131,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-03-28T12:08:34.758Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/googlesamples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-22T19:17:37.000Z","updated_at":"2025-03-28T06:49:10.000Z","dependencies_parsed_at":"2023-01-12T08:30:29.159Z","dependency_job_id":"cd33abdc-4c08-490f-bbc5-d336f3b38516","html_url":"https://github.com/googlesamples/android-media-controller","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlesamples%2Fandroid-media-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlesamples%2Fandroid-media-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlesamples%2Fandroid-media-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlesamples%2Fandroid-media-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googlesamples","download_url":"https://codeload.github.com/googlesamples/android-media-controller/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182378,"owners_count":20897380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:02:05.853Z","updated_at":"2025-04-04T13:12:52.784Z","avatar_url":"https://github.com/googlesamples.png","language":"Kotlin","funding_links":[],"categories":["HarmonyOS","Kotlin"],"sub_categories":["Windows Manager"],"readme":"Media Controller Test\n=====================\nCreate a simple MediaController that connects to a MediaBrowserService\nin order to test inter-app media controls.\nThis tool is described in the Android documentation: [Using the media controller test app](https://developer.android.com/guide/topics/media-apps/audio-app/media-controller-test).\n\nThis app works with the Universal Android Music Player sample,\nor any other app that implements the media APIs.\nhttps://github.com/googlesamples/android-UniversalMusicPlayer\n\n\nUsage\n=====\n\n1. Select an app from the list of those presented.\n   * Only apps that register a service with an intent filter action of\n   \"android.media.browse.MediaBrowserService\" will be shown.\n2. Select the type of action to perform to start the player. Options are:\n   * Search: Sends the text provided as a search via _prepareFromSearch()_ or\n   _playFromSearch()_.\n   * Media ID: Sends the text provided as a media ID via _prepareFromMediaId()_ or\n   _playFromMediaId()_.\n   * URI: Sends the text provided as a URI via _prepareFromUri()_ or\n   _playFromUri()_.\n   * No Input: Calls the methods _prepare()_ or _play()_ directly.\n3. Text below the ```PREPARE``` and ```PLAY``` buttons updates based on changes to\n   the media player state via _onPlaybackStateChanged_ and _onMetadataChanged_ and\n   includes the current player state reported via _PlaybackStateCompat.getState()_.\n4. Swipe to the left to see typical media controls with the media's art as a\n   background, if provided.\n5. Press ```back``` to return to the list of media apps.\n\nVia ADB\n-------\n\nIt's also possible to launch the app via ADB and the Activity manager (am).\n\nParameter | Extra Name\n----------|-----------\nPackage name | `com.example.android.mediacontroller.PACKAGE_NAME`\nSearch term | `com.example.android.mediacontroller.SEARCH`\nMedia ID | `com.example.android.mediacontroller.MEDIA_ID`\nURI | `com.example.android.mediacontroller.URI`\n\nTo start the app and connect to UAMP:\n\n`adb shell am start -n com.example.android.mediacontroller/.LaunchActivity --es com.example.android.mediacontroller.PACKAGE_NAME \"com.example.android.uamp\"`\n\nTo perform a search with the term \"jazz?\" one would use:\n\n`adb shell am start -n com.example.android.mediacontroller/.MediaAppControllerActivity --es com.example.android.mediacontroller.SEARCH \"jazz?\"`\n\nVerification\n============\n\nAudio Focus\n-----------\n\nThis app allows for testing how media apps respond to audio focus changes.\n\nThe app allows requesting and abandoning the following types of audio focus:\n\n* AUDIOFOCUS_GAIN\n* AUDIOFOCUS_GAIN_TRANSIENT\n* AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK\n\nFor more information on audio focus please see\n[Managing Audio Focus](https://developer.android.com/guide/topics/media-apps/audio-focus.html).\n\nSupported Actions\n-----------------\n\nThis tool displays the supported actions as reported by the MediaSession in the call to\n[MediaSessionCompat.setPlaybackState()](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.html#setPlaybackState(android.support.v4.media.session.PlaybackStateCompat))\nas a list of prepare and play actions on the main screen. For actions that are not declared as\nsupported, it also colors the buttons red on the controller screen.\n\nSee the screenshots below for examples.\n\nScreenshots\n===========\n\n![](screenshots/screenshots.png \"Controls, URIs, Playback\")\n\n\nLicense\n=======\n\nCopyright 2017 Google Inc. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglesamples%2Fandroid-media-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglesamples%2Fandroid-media-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglesamples%2Fandroid-media-controller/lists"}