Note: If you’re looking only after simple streaming of common internet sources, please have a look at AudioStreamIce which has also e.g. superior iOS integration and better playlists support.
This package also contains simple peer to peer (server/client) audio components - for more robust and scalable solution based on NetCode for GameObjects (formerly MLAPI / UNET), please have a look at AudioStreamNetCode
- so both of the above released later replace some functionality originally in this asset, while being more focused and having more features and less dependencies.
Originally the main motivation behind this asset was Unity suboptimal streaming capabilities of Unity on mobiles, especially on iOS. - the audio stream there was stored in memory in its entirety during streaming, which led to out of memory crashes after very short period of time.
UnityWebRequest also needs to download media in full before it can be processed -
these lead to poor user experience among other things so I decided to look for a proper solution. Since I couldn’t find any, this asset was made.
Apart form original streamed playback, main focus of this grew over time into more advanced streaming/downloading, accessing system audio inputs and outputs, and 3D.
Some of the capabilities:
- AudioStream plays network streams, as well as local and remote single audio files (such as podcasts)
- Supported are all audio formats FMOD can handle including, e.g. FLAC or modules and MIDI files
- handles direct stream links to audio as well as M3U/8 and PLS playlists - which are common distribution format of virtually all webstreaming radio stations.
- Uses FMOD Studio low level API for streaming, decoding and - optionally - playback and recording.
- any available system audio output device (not just a system default one) can be used for output - this component can be used independently for any Unity AudioSource, and can target even just a specific channel of the output
- includes ‘AudioStreamOutputDevice’ Unity AudioMixer native effect which enables redirection right from the mixer/group to user selected output device - (Windows x64 and macOS only currently)
- supports recording/streaming from any connected input of the machine, including virtual inputs and loopback interfaces
- support for proper 3D and ambisonic audio playback using Google Resonance libraries provided via FMOD integration
- including any system input (but it’s possible to use any other external spatialization library)
- supports multichannel input devices
- on Windows ASIO support was added
- can act as a source for Icecast server in PCM and OGGVORBIS formats.
- streaming over LAN between two instances (1- and 2- channel OPUS encoding, using NetMQ for transport)
Tested so far on Windows, OS X ( still OS X ), iOS and Android.
AssetStore link: https://assetstore.unity.com/packages/tools/audio/audiostream-65411
(semi)current docs should be here: GitHub - r618/AudioStreamDocs: Public documentation for Unity engine asset AudioStream
There is single package with all source code included and demo scenes showing the components usage and handling of events.
NOTICE: supports FMOD Studio Unity Integrations 2.02.08 and up.
NOTICE: -* AAC format *-
there’s no special setup or any special considerations regarding this format. The ONLY actual difference compared to other formats is that the media must be played on an actual physical device (e.g. iOS/Android phone) which has hardware decoding capability for this format. That means that you will not be able to test it in e.g. Editor or standalone builds.
NOTICE: although FMOD Studio does support WebGL/WASM, this uses parts which rely on threading support, so this platform is not supported currently.
NOTE Asset Store sales: this asset is very rarely on sale