@4players/odin-nodejs 0.10.3 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -0
- package/LICENSE +21 -0
- package/README.md +603 -44
- package/binding.gyp +29 -13
- package/cppsrc/binding.cpp +3 -6
- package/cppsrc/odinbindings.cpp +9 -45
- package/cppsrc/odincipher.cpp +92 -0
- package/cppsrc/odincipher.h +32 -0
- package/cppsrc/odinclient.cpp +19 -158
- package/cppsrc/odinclient.h +2 -5
- package/cppsrc/odinmedia.cpp +144 -186
- package/cppsrc/odinmedia.h +51 -18
- package/cppsrc/odinroom.cpp +675 -635
- package/cppsrc/odinroom.h +76 -26
- package/cppsrc/utilities.cpp +11 -81
- package/cppsrc/utilities.h +25 -140
- package/index.cjs +829 -0
- package/index.d.ts +3 -4
- package/libs/bin/linux/arm64/libodin.so +0 -0
- package/libs/bin/linux/arm64/libodin_crypto.so +0 -0
- package/libs/bin/linux/ia32/libodin.so +0 -0
- package/libs/bin/linux/ia32/libodin_crypto.so +0 -0
- package/libs/bin/linux/x64/libodin.so +0 -0
- package/libs/bin/linux/x64/libodin_crypto.so +0 -0
- package/{prebuilds/darwin-x64/node.napi.node → libs/bin/macos/universal/libodin.dylib} +0 -0
- package/libs/bin/macos/universal/libodin_crypto.dylib +0 -0
- package/libs/bin/windows/arm64/odin.dll +0 -0
- package/libs/bin/windows/arm64/odin.lib +0 -0
- package/libs/bin/windows/arm64/odin_crypto.dll +0 -0
- package/libs/bin/windows/arm64/odin_crypto.lib +0 -0
- package/libs/bin/windows/ia32/odin.dll +0 -0
- package/libs/bin/windows/ia32/odin.lib +0 -0
- package/libs/bin/windows/ia32/odin_crypto.dll +0 -0
- package/libs/bin/windows/ia32/odin_crypto.lib +0 -0
- package/libs/bin/windows/x64/odin.dll +0 -0
- package/libs/bin/windows/x64/odin.lib +0 -0
- package/libs/bin/windows/x64/odin_crypto.dll +0 -0
- package/libs/bin/windows/x64/odin_crypto.lib +0 -0
- package/libs/include/odin.h +665 -567
- package/libs/include/odin_crypto.h +46 -0
- package/odin.cipher.d.ts +31 -0
- package/odin.media.d.ts +69 -19
- package/odin.room.d.ts +348 -7
- package/package.json +5 -4
- package/prebuilds/{darwin-arm64/node.napi.node → darwin-x64+arm64/libodin.dylib} +0 -0
- package/prebuilds/darwin-x64+arm64/libodin_crypto.dylib +0 -0
- package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
- package/prebuilds/linux-x64/libodin.so +0 -0
- package/prebuilds/linux-x64/libodin_crypto.so +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/prebuilds/win32-x64/odin.dll +0 -0
- package/prebuilds/win32-x64/odin_crypto.dll +0 -0
- package/scripts/postbuild.cjs +133 -0
- package/tests/audio-recording/README.md +97 -12
- package/tests/audio-recording/index.js +238 -130
- package/tests/connection-test/README.md +97 -0
- package/tests/connection-test/index.js +273 -0
- package/tests/lifecycle/test-room-cycle.js +169 -0
- package/tests/sending-audio/README.md +178 -9
- package/tests/sending-audio/canBounce.mp3 +0 -0
- package/tests/sending-audio/index.js +250 -87
- package/tests/sending-audio/test-kiss-api.js +149 -0
- package/tests/sending-audio/test-loop-audio.js +142 -0
- package/CMakeLists.txt +0 -25
- package/libs/bin/linux/arm64/libodin_static.a +0 -0
- package/libs/bin/linux/ia32/libodin_static.a +0 -0
- package/libs/bin/linux/x64/libodin_static.a +0 -0
- package/libs/bin/macos/arm64/libodin_static.a +0 -0
- package/libs/bin/macos/x64/libodin_static.a +0 -0
- package/libs/bin/windows/arm64/odin_static.lib +0 -0
- package/libs/bin/windows/ia32/odin_static.lib +0 -0
- package/libs/bin/windows/x64/odin_static.lib +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the ODIN Node.js SDK will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.11.0] - 2026-01-14
|
|
11
|
+
|
|
12
|
+
This major update brings the ODIN Node.js bindings to SDK version 1.8.2 and includes a significant internal rewrite to support the latest ODIN SDK features like End-to-End Encryption.
|
|
13
|
+
|
|
14
|
+
### Breaking Changes
|
|
15
|
+
|
|
16
|
+
- **Token Generation**: Access tokens are no longer generated in the native layer (as of SDK 1.8.2). Use the new `OdinClient.generateToken(accessKey, roomId, userId)` method which leverages `@4players/odin-tokens`.
|
|
17
|
+
- **Room Creation**: Direct instantiation with `new OdinRoom(token)` is discouraged. Use `OdinClient.createRoom(token)` or `OdinClient.createRoomWithToken(token)` factory methods to ensure proper JavaScript event wrapping.
|
|
18
|
+
- **Audio Stream Creation**: `createAudioStream()` now requires explicit `sampleRate` and `channels` parameters, with optional `apmSettings`.
|
|
19
|
+
- **Event Payload Changes**: Standardized on `Joined` event name (matching core SDK). Removed `RoomJoined` alias and duplicate `RoomLeft` event. The `Joined` event provides `roomId`, `ownPeerId`, `room` object, and `mediaIds` array.
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- **End-to-End Encryption (E2EE)**: Full support for `OdinCipher` to protect audio data and messages between peers.
|
|
24
|
+
- **OdinClient Factory Pattern**: New recommended way to create rooms via `client.createRoom(token)` or `client.createRoomWithToken(token)`.
|
|
25
|
+
- **High-Level Audio API**: Simplified audio streaming with automatic setup:
|
|
26
|
+
- `media.sendMP3(filePath)` - Stream MP3 files with automatic decoding
|
|
27
|
+
- `media.sendWAV(filePath)` - Stream WAV files with automatic decoding
|
|
28
|
+
- `media.sendBuffer(audioBuffer)` - Stream decoded AudioBuffer
|
|
29
|
+
- **Diagnostic & Monitoring Methods**:
|
|
30
|
+
- `room.getConnectionStats()` - RTT and packet loss metrics
|
|
31
|
+
- `room.getConnectionId()` - Retrieve connection identifier
|
|
32
|
+
- `room.getJitterStats(mediaId)` - Jitter buffer statistics for audio streams
|
|
33
|
+
- `cipher.getPeerStatus(peerId)` - E2EE verification status for peers
|
|
34
|
+
- **Convenience Event Handlers**: Typed methods for common events:
|
|
35
|
+
- `onJoined`, `onLeft`
|
|
36
|
+
- `onPeerJoined`, `onPeerLeft`
|
|
37
|
+
- `onMediaStarted`, `onMediaStopped`
|
|
38
|
+
- `onMediaActivity` (Voice Activity Detection)
|
|
39
|
+
- `onMessageReceived`
|
|
40
|
+
- `onAudioDataReceived`
|
|
41
|
+
- `onPeerUserDataChanged`, `onRoomUserDataChanged`
|
|
42
|
+
- `onPeerTagsChanged`
|
|
43
|
+
- **Removed RoomJoined Alias**: `RoomJoined` was previously supported as an alias for `Joined`. This has been removed to match core SDK naming. Use `Joined` event (or `onJoined()` convenience method) exclusively.
|
|
44
|
+
- **Synchronous Event Polling**: `room.pollEvents()` for processing server events on the main thread.
|
|
45
|
+
- **TypeScript Definitions**: Comprehensive type definitions for all event payloads in `odin.room.d.ts`.
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- **SDK Initialization**: Refactored internal initialization with `OdinClient` as the primary entry point.
|
|
50
|
+
- **Audio Output**: Fixed stereo recording capability with proper interleaved samples.
|
|
51
|
+
|
|
52
|
+
### Deprecated
|
|
53
|
+
|
|
54
|
+
- `generateAccessToken()` - Use `generateToken()` instead.
|
|
55
|
+
- `createRoomWithAccessToken()` - Use `createRoomWithToken()` instead.
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
|
|
59
|
+
- **Audio Transmission**: Resolved ErrorCode=-3 issues where transmitters weren't using server-allocated media IDs.
|
|
60
|
+
- **SDK Lifecycle**: Fixed premature `odin_shutdown()` during garbage collection with proper reference counting.
|
|
61
|
+
- **Spatial Audio**: `setPositionScale()` and `updatePosition()` now correctly apply coordinates set before `join()`.
|
|
62
|
+
- **Event Dispatching**: Corrected missing `mediaId` and `userData` in events.
|
|
63
|
+
- **macOS ARM64 Stability**: Resolved `SIGBUS` and `SIGSEGV` crashes during high-frequency audio transmission using main-thread poll pattern.
|
|
64
|
+
- **Null Safety**: Fixed potential crashes when handling peers without user data.
|
|
65
|
+
|
|
66
|
+
## [0.10.3] - Previous Release
|
|
67
|
+
|
|
68
|
+
See git history for earlier changes.
|
|
69
|
+
|
|
70
|
+
[Unreleased]: https://github.com/4Players/odin-nodejs/compare/v0.11.0...HEAD
|
|
71
|
+
[0.11.0]: https://github.com/4Players/odin-nodejs/compare/v0.10.3...v0.11.0
|
|
72
|
+
[0.10.3]: https://github.com/4Players/odin-nodejs/releases/tag/v0.10.3
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 4Players GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|