All Projects → TakuSemba → AudioThief

TakuSemba / AudioThief

Licence: Apache-2.0 license
Let you gain and release AudioFocus.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to AudioThief

Eleven
CyanogenMod/LineageOS Eleven music player
Stars: ✭ 29 (-27.5%)
Mutual labels:  player
audio-player
🎵 Music player with custom controls, playlist, filters, and search.
Stars: ✭ 137 (+242.5%)
Mutual labels:  player
VideoTimelineView
Video timeline UI for iOS Apps
Stars: ✭ 103 (+157.5%)
Mutual labels:  player
pushtape-player.js
Customizable JS audio page player with global playback controls and autoscan (mutationobserver), built on Soundmanager2.
Stars: ✭ 27 (-32.5%)
Mutual labels:  player
linux-show-player
Linux Show Player - Cue player designed for stage productions
Stars: ✭ 147 (+267.5%)
Mutual labels:  player
angular-youtube-player
Simple youtube player created with angular and typescript. See demo.
Stars: ✭ 35 (-12.5%)
Mutual labels:  player
vuetify-audio
A Vue audio player base on Vuetify UI framework: https://wilsonwu.github.io/dist/index.html#/vuetifyaudio
Stars: ✭ 137 (+242.5%)
Mutual labels:  player
aplay-
a simple BitPerfect player
Stars: ✭ 23 (-42.5%)
Mutual labels:  player
zx tape player
Just another tape player has been written in Flutter for iOS and Android. The application is able to find tapes and theirs images using https://zxInfo.dk public API and upload them to ZX-Spectrum compatible computers by the audio output of the smartphone. Now it supports TAP and TZX tape images only.
Stars: ✭ 26 (-35%)
Mutual labels:  player
Rise-Media-Player
One media player for everything you own or stream; whether it's music or videos, online or offline Rise Media Player does it all. And it's beautiful and native with the latest version of WinUI.
Stars: ✭ 600 (+1400%)
Mutual labels:  player
media-player
An modern, clean media player built using web technologies
Stars: ✭ 44 (+10%)
Mutual labels:  player
danmaku-player
An HTML5 danmaku video player for real-time image processing using WebGl and Web Components.融合了webgl和web components的实时图像处理弹幕播放器
Stars: ✭ 40 (+0%)
Mutual labels:  player
CBPlayer
一个内置P2P的神奇播放器
Stars: ✭ 60 (+50%)
Mutual labels:  player
douban.fm
简洁的豆瓣电台命令行版。
Stars: ✭ 13 (-67.5%)
Mutual labels:  player
simple-cloud-music
简洁的的第三方网易云音乐播放器
Stars: ✭ 306 (+665%)
Mutual labels:  player
LocalPreferences
Better alternative for Unity's PlayerPrefs
Stars: ✭ 33 (-17.5%)
Mutual labels:  player
mpc-qt
Media Player Classic Qute Theater
Stars: ✭ 125 (+212.5%)
Mutual labels:  player
StickMan-3D
StickMan 3D: First Round | indie fighting game | C++ OpenGL
Stars: ✭ 60 (+50%)
Mutual labels:  player
deplayer
Decentralized mediaplayer which runs entirely in the browser.
Stars: ✭ 14 (-65%)
Mutual labels:  player
RecPlayer-iOS
A simple iOS application that records audio and plays it back. (+some animations)
Stars: ✭ 21 (-47.5%)
Mutual labels:  player

AudioThief

Gradle

//app/build.gradle
dependencies {
    implementation 'com.github.takusemba:audiothief:x.x.x'
}

Features

Platform Download License API

Since multiple apps can play audio to the sample ouptut stream simultaneously, it is requred to handle AudioFocus correctly.

However you do not want to call or set an alerm just to see if your impletemtation is working as you expected.

AudioThief gain AudioFocus from your app and release it back.


Usage

1. Add AudioThief dependency

dependencies {
    implementation 'com.github.takusemba:audiothief:x.x.x'
}

2. Edit your manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  <!--this permission is required if your app targets Android 9.0 (API level 28)-->
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

  <application>
  <!--...-->
    <service
       android:name="com.takusemba.audiothief.AudioFocusGainService"
       android:exported="true"
       />
  </application>
       
</manifest>

3. Gain and Release AudioFocus

You can start a foreground service that gains AudioFocus via adb command, or simply start the srevice inside your app.

adb shell am startservice --ei AUDIO_REQUEST_KEY [audioRequestKey] your.package.name/com.takusemba.audiothief.AudioFocusGainService

It holds AudioFocus until the foreground service stops.

adb shell am stopservice --ei AUDIO_REQUEST_KEY [audioRequestKey] your.package.name/com.takusemba.audiothief.AudioFocusGainService

AudioRequestKey

AudioRequestKey defines how you gain AudioFocus. That would be Int of 1, 2, 3, or 4.

AudioRequestKey FocusGain Usage Content Type
1 AUDIOFOCUS_GAIN USAGE_MEDIA CONTENT_TYPE_MOVIE
2 AUDIOFOCUS_GAIN_TRANSIENT USAGE_ALARM CONTENT_TYPE_SONIFICATION
3 AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK USAGE_NOTIFICATION CONTENT_TYPE_SONIFICATION
4 AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE USAGE_ALARM CONTENT_TYPE_SONIFICATION

Sample

Clone this repo and check out the app module.

Author

Licence

Copyright 2017 Taku Semba.

Licensed 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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].