Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/downloads~/*
**/.DS_Store
/downloads~/*
.DS_Store
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,50 @@ void TrackSubscribed(IRemoteTrack track, RemoteTrackPublication publication, Rem
}
```

## Building Native Libraries (macOS)

Both native libraries ship as **universal (fat) binaries** containing x86_64 (Intel) and arm64 (Apple Silicon) slices in a single `.dylib`. This avoids needing separate per-architecture plugin folders in Unity.

### LiveKit FFI (`liblivekit_ffi.dylib`)

Download the prebuilt macOS binaries (`ffi-macos-x86_64.zip` and `ffi-macos-arm64.zip`) from the [livekit/rust-sdks releases](https://github.com/livekit/rust-sdks/releases) page. Look for the latest `livekit-ffi` release.

Extract both zips into `Runtime/Plugins/ffi-macos-x86_64/` and `Runtime/Plugins/ffi-macos-arm64/` respectively, then combine them into a single universal binary:

```bash
mkdir -p Runtime/Plugins/mac_cross

lipo -create \
-output Runtime/Plugins/mac_cross/liblivekit_ffi.dylib \
Runtime/Plugins/ffi-macos-x86_64/liblivekit_ffi.dylib \
Runtime/Plugins/ffi-macos-arm64/liblivekit_ffi.dylib
```

Verify the result:

```bash
lipo -info Runtime/Plugins/mac_cross/liblivekit_ffi.dylib
# Expected: Architectures in the fat file: x86_64 arm64
```

The Unity `.meta` for this plugin must target **Standalone: OSXUniversal** with **CPU: AnyCPU** so Unity loads it on both architectures.

### RustAudio (`librust_audio.dylib`)

A build script is provided at `RustAudio/rust-audio/build.sh`. From the repo root:

```bash
cd RustAudio/rust-audio
./build.sh
```

This builds for both `x86_64-apple-darwin` and `aarch64-apple-darwin`, merges them with `lipo`, and outputs the universal binary to `RustAudio/Wrap/Libraries/librust_audio.dylib`.

**Prerequisites:** Rust toolchain with both targets installed:

```bash
rustup target add x86_64-apple-darwin aarch64-apple-darwin
```

<!--BEGIN_REPO_NAV-->
<!--END_REPO_NAV-->
Binary file removed Runtime/.DS_Store
Binary file not shown.
1,758 changes: 1,347 additions & 411 deletions Runtime/Plugins/ffi-windows-x86_64/LICENSE.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Runtime/Plugins/ffi-windows-x86_64/livekit_ffi.dll
Git LFS file not shown
16 changes: 16 additions & 0 deletions Runtime/Plugins/livekit_ffi.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2025 LiveKit, Inc.
*
* 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.
*/

#ifndef livekit_ffi
#define livekit_ffi

Expand Down
4 changes: 2 additions & 2 deletions Runtime/Plugins/mac_cross/liblivekit_ffi.dylib
Git LFS file not shown
2 changes: 1 addition & 1 deletion client-sdk-rust~