{"id":25707775,"url":"https://github.com/diokaratzas/swift-audio-kit","last_synced_at":"2025-09-09T22:47:51.450Z","repository":{"id":251952391,"uuid":"838945438","full_name":"dioKaratzas/swift-audio-kit","owner":"dioKaratzas","description":"SwiftAudioKit - A lightweight yet powerful audio player wrapper for AVPlayer, providing seamless playback, queue management, retry handling, and Control Center integration across iOS, macOS, tvOS, and watchOS. 🚀🎵","archived":false,"fork":false,"pushed_at":"2025-03-22T16:29:58.000Z","size":433,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-01T11:47:48.867Z","etag":null,"topics":["audio-framework","audio-player","avplayer","media-playback","stream","swift","swift-package"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dioKaratzas.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-06T16:45:56.000Z","updated_at":"2025-07-23T20:15:32.000Z","dependencies_parsed_at":"2025-04-30T15:43:08.529Z","dependency_job_id":"47a95b3f-3848-4f84-87d9-75784aa5c8ba","html_url":"https://github.com/dioKaratzas/swift-audio-kit","commit_stats":null,"previous_names":["dnkaratzas/swiftaudiokit","dnkaratzas/swift-audio-kit"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/dioKaratzas/swift-audio-kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioKaratzas%2Fswift-audio-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioKaratzas%2Fswift-audio-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioKaratzas%2Fswift-audio-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioKaratzas%2Fswift-audio-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dioKaratzas","download_url":"https://codeload.github.com/dioKaratzas/swift-audio-kit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioKaratzas%2Fswift-audio-kit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274375281,"owners_count":25273829,"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","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["audio-framework","audio-player","avplayer","media-playback","stream","swift","swift-package"],"created_at":"2025-02-25T08:54:26.763Z","updated_at":"2025-09-09T22:47:51.406Z","avatar_url":"https://github.com/dioKaratzas.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# SwiftAudioKit\n\n[![Swift Package Manager](https://img.shields.io/badge/SPM-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager/)\n![Platform iOS | tvOS | macOS | watchOS](https://img.shields.io/badge/platform-iOS%20|%20tvOS%20|%20macOS%20|%20watchOS-lightgrey.svg)\n![Latest Version](https://img.shields.io/github/v/release/diokaratzas/swift-audio-kit)\n\n**SwiftAudioKit** is a robust, feature-rich wrapper around `AVPlayer`, designed to simplify audio playback on iOS, tvOS, macOS and watchOS.\n\n## Features\n\n- **Quality Control:** Automatically adapts to interruptions (buffering) and adjusts playback based on delay.\n- **Retry Mechanism:** Automatically retries playback if the player encounters an error.\n- **Connection Handling:** Smart handling of connection interruptions and seamless recovery.\n- **Audio Item Enqueuing:** Easily enqueue audio items for uninterrupted playback.\n- **Playback Modes:** Supports repeat, repeat all, and shuffle modes.\n- **MPNowPlayingInfoCenter Integration:** Full support for Control Center and lock screen media controls.\n- **High Customizability:** Flexible and customizable to fit your specific needs.\n\n## Installation\n#### Xcode\nSwiftAudioKit is vailable exclusively through Swift Package Manager (SPM). To integrate it into your project, follow these steps:\n\n1. Open your project in Xcode.\n2. Go to **File \u003e Add Packages...**\n3. Enter the following URL in the search field: `https://github.com/diokaratzas/swift-audio-kit`\n4. Choose the version you want to install and click **Add Package**.\n\n#### Or Swift Package\n\nTo use the SwiftAudioKit with your package, first add it as a dependency:\n\n```swift\nlet package = Package(\n    // name, platforms, products, etc.\n    dependencies: [\n        // other dependencies\n        .package(url: \"https://github.com/diokaratzas/swift-audio-kit\", from: \"1.0.0\"),\n    ],\n    targets: [\n        // targets\n    ]\n)\n```\n\n## Usage\n\n\nPlease see the package [documentation](https://diokaratzas.github.io/swift-audio-kit/documentation/swiftaudiokit/) for more detailed usage instructions.\n\n### Basic Usage\n\nHere’s a quick example of how to get started with SwiftAudioKit:\n\n```swift\nlet delegate: AudioPlayerDelegate = ...\n\nlet player = AudioPlayer()\nplayer.delegate = delegate\nlet item = AudioItem(mediumQualitySoundURL: track.streamURL)\nplayer.playItem(item)\n```\n\n### Delegate Methods\n\nSwiftAudioKit uses delegation to notify about status changes and other events.\n\n#### State Changes\n\nThis method is called when the player’s state changes:\n\n```swift\nfunc audioPlayer(_ audioPlayer: AudioPlayer, didChangeStateFrom from: AudioPlayerState, toState to: AudioPlayerState)\n```\n\n#### Duration \u0026 Progression\n\nWhen the duration of the current item is found:\n\n```swift\nfunc audioPlayer(_ audioPlayer: AudioPlayer, didFindDuration duration: TimeInterval, forItem item: AudioItem)\n```\n\nThis method is regularly called to update playback progression:\n\n```swift\nfunc audioPlayer(_ audioPlayer: AudioPlayer, didUpdateProgressionToTime time: TimeInterval, percentageRead: Float)\n```\n\n`percentageRead` is a `Float` value between 0 and 100, perfect for updating a `UISlider`.\n\n#### Queue Management\n\nThis method is called when a new audio item starts playing:\n\n```swift\nfunc audioPlayer(_ audioPlayer: AudioPlayer, willStartPlayingItem item: AudioItem)\n```\n\n### Control Center \u0026 Lock Screen Integration\n\nTo handle media controls via the Control Center or lock screen:\n\n```swift\nfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n    application.beginReceivingRemoteControlEvents()\n    return true\n}\n\n// In your UIResponder (or AppDelegate):\noverride func remoteControlReceived(with event: UIEvent?) {\n    if let event = event {\n        yourPlayer.remoteControlReceived(with: event)\n    }\n}\n```\n\n## Contributing\n\nContributions are welcome! To contribute:\n\n1. Fork the repository.\n2. Create a new feature branch: `git checkout -b my-new-feature`.\n3. Commit your changes: `git commit -am 'Add some feature'`.\n4. Push to the branch: `git push origin my-new-feature`.\n5. Submit a pull request.\n\n## Todo\n\n- Increase unit test coverage.\n- Refactor the current state handling system.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.\n\n---\n\n### Acknowledgments\n\nThis project is based on the original [AudioPlayer](https://github.com/delannoyk/AudioPlayer) by [Kevin Delannoy](https://github.com/delannoyk). Special thanks to Kevin for his foundational work, which has been instrumental in the development of SwiftAudioKit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiokaratzas%2Fswift-audio-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiokaratzas%2Fswift-audio-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiokaratzas%2Fswift-audio-kit/lists"}