{"id":1558,"url":"https://github.com/qasim/Airstream","last_synced_at":"2025-07-31T12:33:18.575Z","repository":{"id":77182721,"uuid":"66682602","full_name":"qasim/Airstream","owner":"qasim","description":"A framework for streaming audio between Apple devices using AirPlay.","archived":false,"fork":false,"pushed_at":"2016-11-02T15:48:05.000Z","size":86,"stargazers_count":378,"open_issues_count":5,"forks_count":33,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-08-15T00:19:50.803Z","etag":null,"topics":["airplay-server","ios","macos"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/qasim.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}},"created_at":"2016-08-26T22:17:22.000Z","updated_at":"2024-08-15T00:19:50.804Z","dependencies_parsed_at":"2023-02-26T10:30:23.537Z","dependency_job_id":null,"html_url":"https://github.com/qasim/Airstream","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qasim%2FAirstream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qasim%2FAirstream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qasim%2FAirstream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qasim%2FAirstream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qasim","download_url":"https://codeload.github.com/qasim/Airstream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228248383,"owners_count":17891447,"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":["airplay-server","ios","macos"],"created_at":"2024-01-05T20:15:49.784Z","updated_at":"2024-12-05T06:31:16.053Z","avatar_url":"https://github.com/qasim.png","language":"Objective-C","funding_links":[],"categories":["Media"],"sub_categories":["Streaming","Other free courses"],"readme":"# Airstream\n\n\u003e An iOS / macOS framework for streaming audio between Apple devices using AirPlay.\n\n![An example gif](https://s15.postimg.org/sdw8gr0bf/screen_recording.gif)\n\nYou can use Airstream to start an AirPlay server in your iOS or macOS applications. Then, any Apple device can stream audio to your application via AirPlay, with no extra software required.\n\n## Table of contents\n\n* [Installation](#installation)\n  * [Carthage](#carthage)\n* [Basic usage](#basic-usage)\n* [API reference](#api-reference)\n  * [Airstream](#airstream-1)\n  * [AirstreamDelegate](#airstreamdelegate)\n  * [AirstreamRemote](#airstreamremote)\n* [Shairplay](#shairplay)\n* [Disclaimer](#disclaimer)\n* [License](#license)\n\n## Installation\n\nAirstream can be installed by using either Carthage or just simply cloning this repository and its submodules in your project.\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager for Cocoa.\n\nYou can install it using [Homebrew](http://brew.sh/) with the following commands:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nThen, to include Airstream in your project, specify it in your `Cartfile` (make sure it's in the same directory as your `.xcodeproj`):\n\n```ruby\ngithub \"qasim/Airstream\" ~\u003e 0.1\n```\n\nNow you can install Airstream:\n\n```bash\n$ carthage update\n```\n\nYou should now see a `Carthage/Builds` directory. From there, you can drag the built `Airstream.framework` for your platform of choice into your Xcode project, and then add it as an embedded binary in your project's settings.\n\n## Basic usage\n\nFirst, initialize and start Airstream somewhere (make sure that it's retained). You'll also want to set its delegate.\n\n```swift\nlet airstream = Airstream(name: \"My Airstream\")\n\nairstream.delegate = self\nairstream.startServer()\n```\n\nThat's it! Your own AirPlay server is now up and running. You can gracefully shut it down as well:\n\n```swift\nairstream.stopServer()\n```\n\nImplement any of the delegate methods to actually make use of Airstream's features, like retrieving a song's album artwork:\n\n```swift\nfunc airstream(airstream: Airstream, didSetCoverart coverart: NSData) {\n  // Coverart for the item that's currently streaming\n  let image = NSImage(data: coverart)\n}\n```\n\nFor a more detailed example on how to use Airstream, you can refer to the example projects which implement Airstream with the streamed audio output going directly to speakers via CoreAudio:\n\n* [iOS Example](https://github.com/qasim/Airstream/tree/master/Examples/Airstream%20iOS%20Example)\n* [macOS Example](https://github.com/qasim/Airstream/tree/master/Examples/Airstream%20macOS%20Example)\n\n## API reference\n\n### Airstream\n\nThis is the main class, from which you can start and stop the AirPlay server.\n\n-\n\n```swift\nfunc init()\nfunc init(name: String?)\nfunc init(name: String?, password: String?)\nfunc init(name: String?, password: String?, port: UInt)\n```\n\nBasic initializers for the Airstream.\n\n-\n\n```swift\nfunc startServer()\n```\n\nStarts the AirPlay server and begins broadcasting.\n\n-\n\n```swift\nfunc stopServer()\n```\n\nGracefully shuts down the AirPlay server.\n\n-\n\n```swift\nvar name: String\n```\n\nThe AirPlay server's receiver name. This is what is shown to devices when they go to connect to your AirPlay server. `\"My Airstream\"` by default.\n\n-\n\n```swift\nvar password: String?\n```\n\nThe AirPlay server's receiver password. You can set this to prompt any Apple devices that wish to connect to your AirPlay server with a password challenge.\n\n-\n\n```swift\nvar port: UInt\n```\n\nThe port where the AirPlay server should broadcast to. `5000` by default.\n\n-\n\n```swift\nvar running: Bool\n```\n\nDetermines whether the server is currently running or not.\n\n-\n\n```swift\nvar remote: AirstreamRemote?\n```\n\nThe reference to this Airstream's remote control object, which can be used to send commands to the connected device. This variable may not be set until the delegate has called `airstream:didGainAccessToRemote:`.\n\n-\n\n```swift\nvar volume: Float?\n```\n\nThe connected Apple device's volume, between `0.0` (no volume) and `1.0` (maximum volume).\n\n-\n\n```swift\nvar metadata: [String: String]?\n```\n\nThe metadata for the current item being streamed.\n\n-\n\n```swift\nvar coverart: Data?\n```\n\nThe JPEG artwork (in binary) for the current item being streamed.\n\n-\n\n```swift\nvar position: UInt\n```\n\nThe position (in seconds) of the current item being streamed.\n\n-\n\n```swift\nvar duration: UInt\n```\n\nThe total duration (in seconds) of the current item being streamed.\n\n-\n\n### AirstreamDelegate\n\nThis is the delegate class for [Airstream](#airstream-1). By conforming to this protocol, you can listen for changes in AirPlay server status and be notified when data changes.\n\n-\n\n```swift\noptional func airstream(_ airstream: Airstream, willStartStreamingWithStreamFormat streamFormat: AudioStreamBasicDescription)\n```\n\nCalled right after a device has connected and is about to stream audio. [AudioStreamBasicDescription](https://developer.apple.com/reference/coreaudio/audiostreambasicdescription) is a struct outlining the details of the audio output.\n\n-\n\n```swift\noptional func airstreamDidStopStreaming(_ airstream: Airstream)\n```\n\nCalled right after a device has disconnected.\n\n-\n\n```swift\noptional func airstream(_ airstream: Airstream, didGainAccessToRemote remote: AirstreamRemote)\n```\n\nCalled right after the remote control connection has been setup.\n\n-\n\n```swift\noptional func airstream(_ airstream: Airstream, processAudio buffer: UnsafeMutablePointer\u003cInt8\u003e, length: Int32)\n```\n\nProcess linear PCM audio streamed from a device. `buffer` is a pointer to the audio data, and `length` is the number of bytes stored there.\n\n-\n\n```swift\noptional func airstreamFlushAudio(_ airstream: Airstream)\n```\n\nReset any audio output buffers you may be using, as the source has either changed or been disrupted.\n\n-\n\n```swift\noptional func airstream(_ airstream: Airstream, didSetVolume volume: Float)\n```\n\nCalled when a device's volume was changed.\n\n-\n\n```swift\noptional func airstream(_ airstream: Airstream, didSetMetadata metadata: [String: String])\n```\n\nCalled when a device's metadata for the current item being streamed was changed.\n\n-\n\n```swift\noptional func airstream(_ airstream: Airstream, didSetCoverart coverart: Data)\n```\n\nCalled when a device's artwork for the current item being streamed was changed.\n\n-\n\n```swift\noptional func airstream(_ airstream: Airstream, didSetPosition position: UInt, duration: UInt)\n```\n\nCalled when a device's current position or duration for the current item being streamed was changed.\n\n-\n\n### AirstreamRemote\n\nThis is the remote control object. If this is present on the [Airstream](#airstream-1) object, then you will be able to send commands to the device connected to your AirPlay server.\n\n-\n\n```swift\nfunc play()\n```\n\nStart playback.\n\n-\n\n```swift\nfunc pause()\n```\n\nPause playback.\n\n-\n\n```swift\nfunc stop()\n```\n\nStop playback.\n\n-\n\n```swift\nfunc playPause()\n```\n\nToggle between starting and pausing playback.\n\n-\n\n```swift\nfunc playResume()\n```\n\nPlay after fast forwarding or rewinding.\n\n-\n\n```swift\nfunc forward()\n```\n\nBegin fast forward.\n\n-\n\n```swift\nfunc rewind()\n```\n\nBegin rewind.\n\n-\n\n```swift\nfunc nextItem()\n```\n\nPlay next item in playlist.\n\n-\n\n```swift\nfunc previousItem()\n```\n\nPlay previous item in playlist.\n\n-\n\n```swift\nfunc shuffle()\n```\n\nShuffle items in playlist.\n\n-\n\n```swift\nfunc increaseVolume()\n```\n\nTurn audio volume up.\n\n-\n\n```swift\nfunc decreaseVolume()\n```\n\nTurn audio volume down.\n\n-\n\n```swift\nfunc toggleMute()\n```\n\nToggle mute status.\n\n## Shairplay\n\nAirstream works by depending on a C library called [shairplay](https://github.com/juhovh/shairplay), which is a free portable AirPlay server implementation. You can also visit [qasim/shairplay](https://github.com/qasim/shairplay) for the fork of shairplay that is used by Airstream, which compiles on both iOS and macOS.\n\n## Disclaimer\n\nThis framework is really meant for educational purposes only. I hold no guarantee that integrating this framework into your application will allow you to pass Apple's app review process.\n\n## License\n\nAirstream is released under the MIT license. See [LICENSE](./LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqasim%2FAirstream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqasim%2FAirstream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqasim%2FAirstream/lists"}