{"id":18426254,"url":"https://github.com/doublesymmetry/kotlinaudio","last_synced_at":"2025-04-07T16:32:36.120Z","repository":{"id":39790166,"uuid":"396870728","full_name":"doublesymmetry/KotlinAudio","owner":"doublesymmetry","description":"KotlinAudio is an Android audio player written in Kotlin, making it simpler to work with audio playback from streams and files.","archived":false,"fork":false,"pushed_at":"2024-04-02T18:21:49.000Z","size":12409,"stargazers_count":40,"open_issues_count":12,"forks_count":61,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-05-01T11:31:58.489Z","etag":null,"topics":["android","audio","kotlin"],"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/doublesymmetry.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-08-16T16:10:40.000Z","updated_at":"2024-04-25T11:59:03.000Z","dependencies_parsed_at":"2024-03-05T09:25:31.798Z","dependency_job_id":"825fc4e4-7325-4e76-94a6-c679a1ecd25e","html_url":"https://github.com/doublesymmetry/KotlinAudio","commit_stats":null,"previous_names":[],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doublesymmetry%2FKotlinAudio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doublesymmetry%2FKotlinAudio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doublesymmetry%2FKotlinAudio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doublesymmetry%2FKotlinAudio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doublesymmetry","download_url":"https://codeload.github.com/doublesymmetry/KotlinAudio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223286456,"owners_count":17120000,"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","kotlin"],"created_at":"2024-11-06T05:07:27.193Z","updated_at":"2024-11-06T05:07:27.814Z","avatar_url":"https://github.com/doublesymmetry.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KotlinAudio\n\n[![](https://jitpack.io/v/doublesymmetry/KotlinAudio.svg)](https://jitpack.io/#doublesymmetry/KotlinAudio)\n\nKotlinAudio is an Android audio player written in Kotlin, making it simpler to work with audio playback from streams and files.\n\nInspired by [SwiftAudioEx](https://github.com/doublesymmetry/SwiftAudioEx). Our aim is to have feature parity with the iOS equivalent.\n\n\u003cdiv align=\"left\" valign=\"middle\"\u003e\n\u003ca href=\"https://runblaze.dev\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://www.runblaze.dev/logo_dark.png\"\u003e\n   \u003cimg align=\"right\" src=\"https://www.runblaze.dev/logo_light.png\" height=\"102px\"/\u003e\n \u003c/picture\u003e\n\u003c/a\u003e\n\n\u003cbr style=\"display: none;\"/\u003e\n\n_[Blaze](https://runblaze.dev) sponsors KotlinAudio by providing super fast Apple Silicon based macOS Github Action Runners. Use the discount code `RNTP50` at checkout to get 50% off your first year._\n\n\u003c/div\u003e\n\n## Example\n\nTo see the audio player in action, run the example project!\nTo run the example project, clone the repo, then open in Android Studio.\nChoose \"kotlin-audio-example\" in the run target and run it in a simulator\n(or on an actual device).\n\n## Requirements\n\nminSDK 21\n\n## Installation\n\n### Gradle\n\n```gradle\nimplementation 'com.github.doublesymmetry:kotlinaudio:v2.0.0'\n```\n\n## Usage\n\n### AudioPlayer\n\nTo get started playing some audio:\n\n```swift\nlet player = AudioPlayer()\nlet audioItem = DefaultAudioItem(audioUrl: \"someUrl\", type: MediaType.DEFAULT)\nplayer.load(item: audioItem, playWhenReady: true) // Load the item and start playing when the player is ready.\n```\n\nTo listen for events in the `AudioPlayer`, subscribe to events found in the `event` property of the `AudioPlayer`.\nTo subscribe to an event:\n\n```kotlin\n// jetpack compose\nval state = player.event.stateChange.collectAsState(initial = AudioPlayerState.IDLE)\n\n// normal\nplayer.event.stateChange.collect {}\n```\n\n#### QueuedAudioPlayer\n\nThe `QueuedAudioPlayer` is a subclass of `AudioPlayer` that maintains a queue of audio tracks.\n\n```swift\nlet player = QueuedAudioPlayer()\nlet audioItem = DefaultAudioItem(audioUrl: \"someUrl\", type: MediaType.DEFAULT)\nplayer.add(item: audioItem, playWhenReady: true) // Since this is the first item, we can supply playWhenReady: true to immedietaly start playing when the item is loaded.\n```\n\nWhen a track is done playing, the player will load the next track and update the queue.\n\n##### Navigating the queue\n\nAll `AudioItem`s are stored in either `previousItems` or `nextItems`, which refers to items that come prior to the `currentItem` and after, respectively. The queue is navigated with:\n\n```swift\nplayer.next() // Increments the queue, and loads the next item.\nplayer.previous() // Decrements the queue, and loads the previous item.\nplayer.jumpToItem(index:) // Jumps to a certain item and loads that item.\n```\n\n##### Manipulating the queue\n\n```swift\n player.remove(index:) // Remove a specific item from the queue.\n player.removeUpcomingItems() // Remove all items in nextItems.\n```\n\n## License\n\nKotinAudio is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoublesymmetry%2Fkotlinaudio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoublesymmetry%2Fkotlinaudio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoublesymmetry%2Fkotlinaudio/lists"}