{"id":19257523,"url":"https://github.com/takusemba/audiothief","last_synced_at":"2025-06-19T09:41:19.905Z","repository":{"id":57723491,"uuid":"153475864","full_name":"TakuSemba/AudioThief","owner":"TakuSemba","description":"Let you gain and release AudioFocus.","archived":false,"fork":false,"pushed_at":"2021-03-03T11:41:51.000Z","size":1516,"stargazers_count":41,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-21T15:41:09.317Z","etag":null,"topics":["android","audio","library","music","player","video"],"latest_commit_sha":null,"homepage":"","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/TakuSemba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-17T14:58:30.000Z","updated_at":"2024-02-19T06:19:26.000Z","dependencies_parsed_at":"2022-08-28T15:34:02.392Z","dependency_job_id":null,"html_url":"https://github.com/TakuSemba/AudioThief","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/TakuSemba/AudioThief","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TakuSemba%2FAudioThief","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TakuSemba%2FAudioThief/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TakuSemba%2FAudioThief/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TakuSemba%2FAudioThief/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TakuSemba","download_url":"https://codeload.github.com/TakuSemba/AudioThief/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TakuSemba%2FAudioThief/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260726563,"owners_count":23053181,"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":["android","audio","library","music","player","video"],"created_at":"2024-11-09T19:10:32.167Z","updated_at":"2025-06-19T09:41:14.870Z","avatar_url":"https://github.com/TakuSemba.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AudioThief\n\n\u003cimg src=\"https://github.com/TakuSemba/AudioThief/blob/master/arts/logo.png\"\u003e\n\n## Gradle\n\n```groovy\n\n//app/build.gradle\ndependencies {\n    implementation 'com.github.takusemba:audiothief:x.x.x'\n}\n```\n\n\u003cbr/\u003e\n\n\u003cimg src=\"https://github.com/TakuSemba/AudioThief/blob/master/arts/sample.gif\" align=\"right\" width=\"30%\"\u003e\n\n## Features\n![Platform](http://img.shields.io/badge/platform-android-green.svg?style=flat)\n![Download](https://api.bintray.com/packages/takusemba/maven/audiothief/images/download.svg)\n![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)\n![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat)\n\nSince multiple apps can play audio to the sample ouptut stream simultaneously, it is requred to handle AudioFocus correctly.\n\nHowever you do not want to call or set an alerm just to see if your impletemtation is working as you expected. \n\nAudioThief gain AudioFocus from your app and release it back.\n\n\u003cbr/\u003e\n\n## Usage\n\n#### 1. Add AudioThief dependency\n\n```groovy\n\ndependencies {\n    implementation 'com.github.takusemba:audiothief:x.x.x'\n}\n\n```\n\n#### 2. Edit your manifest.xml\n\n```xml\n\n\u003cmanifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\u003e\n  \u003c!--this permission is required if your app targets Android 9.0 (API level 28)--\u003e\n  \u003cuses-permission android:name=\"android.permission.FOREGROUND_SERVICE\"/\u003e\n\n  \u003capplication\u003e\n  \u003c!--...--\u003e\n    \u003cservice\n       android:name=\"com.takusemba.audiothief.AudioFocusGainService\"\n       android:exported=\"true\"\n       /\u003e\n  \u003c/application\u003e\n       \n\u003c/manifest\u003e\n\n```\n\n#### 3. Gain and Release AudioFocus\n\nYou can start a foreground service that gains AudioFocus via adb command, or simply start the srevice inside your app.\n\n```bash\nadb shell am startservice --ei AUDIO_REQUEST_KEY [audioRequestKey] your.package.name/com.takusemba.audiothief.AudioFocusGainService\n```\n\nIt holds AudioFocus until the foreground service stops.\n\n```\nadb shell am stopservice --ei AUDIO_REQUEST_KEY [audioRequestKey] your.package.name/com.takusemba.audiothief.AudioFocusGainService\n```\n\n## AudioRequestKey\n\nAudioRequestKey defines how you gain AudioFocus. That would be Int of 1, 2, 3, or 4.\n\n|  AudioRequestKey  |  FocusGain  |  Usage  |  Content Type  |\n| :---: | :---: | :---: | :---: |\n|  1  |  AUDIOFOCUS_GAIN  |  USAGE_MEDIA  |  CONTENT_TYPE_MOVIE  |\n|  2  |  AUDIOFOCUS_GAIN_TRANSIENT  |  USAGE_ALARM  |  CONTENT_TYPE_SONIFICATION  |\n|  3  |  AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK  |  USAGE_NOTIFICATION  |  CONTENT_TYPE_SONIFICATION  |\n|  4  |  AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE  |  USAGE_ALARM  |  CONTENT_TYPE_SONIFICATION  |\n\n\n## Sample\nClone this repo and check out the [app](https://github.com/TakuSemba/AudioThief/tree/master/app) module.\n\n## Author\n\n* **Taku Semba**\n    * **Github** - (https://github.com/takusemba)\n    * **Twitter** - (https://twitter.com/takusemba)\n    * **Facebook** - (https://www.facebook.com/takusemba)\n\n## Licence\n```\nCopyright 2017 Taku Semba.\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\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakusemba%2Faudiothief","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakusemba%2Faudiothief","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakusemba%2Faudiothief/lists"}