vivox-sdk-node 1.0.0 → 1.1.0

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.
Files changed (2) hide show
  1. package/README.md +68 -43
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,62 +1,87 @@
1
- # Vivox SDK Node.js Addon
1
+ # Vivox SDK Node.js Wrapper
2
2
 
3
- Bu proje, Vivox SDK'sını Node.js projelerinde kullanabilmek için hazırlanmış bir C++ Addon'dur. Tüm Windows mimarilerini (x64, Win32, arm64) destekleyecek şekilde yapılandırılmıştır.
3
+ A high-performance, fully type-safe Node.js C++ addon for the Vivox SDK. This wrapper provides an asynchronous, EventEmitter-based API to integrate Vivox voice and text chat into your Node.js applications.
4
4
 
5
- ## Özellikler
6
- - **Çoklu Mimari Desteği:** `binding.gyp` dosyası x64, Win32 ve arm64 mimarileri için doğru kütüphane ve DLL eşleştirmelerini otomatik yapar.
7
- - **Asenkron Olay Döngüsü:** C++ tarafında çalışan bir arka plan iş parçacığı (background thread), Vivox SDK'sından gelen mesajları toplar ve Node.js tarafına `ThreadSafeFunction` kullanarak iletir.
8
- - **Yüksek Performans:** N-API (Node-Addon-API) kullanılarak geliştirilmiştir.
5
+ ## Features
9
6
 
10
- ## Kurulum ve Derleme
7
+ - **Asynchronous Event Loop:** Native C++ thread handles Vivox messages and dispatches them to Node.js via `ThreadSafeFunction`.
8
+ - **Full TypeScript Support:** Includes comprehensive interfaces for all events, status codes, and SDK enums.
9
+ - **Strict Error Handling:** Automatically resolves numerical status codes into official Vivox SDK error names (e.g., `VX_E_ACCESSTOKEN_ALREADY_USED`).
10
+ - **Memory Safe:** Implements proper lifecycle management for requests and internal SDK messages to prevent leaks.
11
+ - **Local Moderation:** Built-in methods for local muting, user volume control, and microphone muting.
12
+ - **Audio Injection:** Support for streaming mono 16-bit PCM WAV files into channels.
13
+ - **Positional Audio:** Simple 3D spatial audio positioning support.
11
14
 
12
- ### Ön Gereksinimler
13
- - Node.js (v14 veya üzeri önerilir)
14
- - Python 3.x
15
- - Visual Studio 2017 veya üzeri (C++ Masaüstü Geliştirme iş yükü yüklü olmalıdır)
15
+ ## Project Structure
16
16
 
17
- ### Adımlar
18
- 1. `node-addon` dizinine gidin:
19
- ```bash
20
- cd node-addon
21
- ```
22
- 2. Bağımlılıkları yükleyin:
23
- ```bash
24
- npm install
25
- ```
26
- 3. Addon'u derleyin:
27
- ```bash
28
- npm run build
29
- ```
17
+ The project has been optimized to be lightweight. The core SDK binaries and headers are stored locally within the package, making it portable and easy to install.
30
18
 
31
- ## Kullanım
19
+ ## Installation
32
20
 
33
- Yeni sürüm `EventEmitter` yapısını destekler:
21
+ ```bash
22
+ npm install vivox-sdk-node
23
+ ```
24
+
25
+ *Note: The native addon will automatically compile during installation if build tools (Python, Visual Studio/C++) are available.*
26
+
27
+ ## Quick Start
34
28
 
35
29
  ```javascript
36
- const vivox = require('./index');
30
+ const vivox = require('vivox-sdk-node');
31
+ const { VivoxUtils, VivoxError, VivoxLoginState } = require('vivox-sdk-node');
32
+
33
+ // 1. Initialize the SDK
34
+ vivox.initialize();
37
35
 
38
- // Olayları dinle
39
- vivox.on('loginSuccess', (event) => {
40
- console.log('Başarıyla giriş yapıldı');
36
+ // 2. Setup Event Listeners
37
+ vivox.on('loginStateChange', (data) => {
38
+ console.log(`Login State: ${VivoxUtils.getLoginStateName(data.state)}`);
41
39
  });
42
40
 
43
- vivox.on('participantAdded', (event) => {
44
- console.log('Yeni katılımcı:', event.participant_uri);
41
+ vivox.on('joinSuccess', (event) => {
42
+ console.log('Successfully joined the channel!');
43
+
44
+ // Set local mic volume to 100%
45
+ vivox.setLocalMicVolume(100);
45
46
  });
46
47
 
47
- vivox.on('message', (event) => {
48
- console.log(`${event.participant_uri} dedi ki: ${event.message}`);
48
+ vivox.on('message', (m) => {
49
+ console.log(`[CHAT] ${m.participant_uri}: ${m.message}`);
49
50
  });
50
51
 
51
- // SDK'yı başlat
52
- vivox.initialize();
52
+ // 3. Create Connector and Start Flow
53
+ vivox.connectorCreate("https://your-vivox-server.com/app", "main_connector");
54
+ // After connectorCreated event, call vivox.loginAnonymous() or vivox.login()
55
+ ```
56
+
57
+ ## Local Moderation Examples
58
+
59
+ ```javascript
60
+ // Mute yourself (other players won't hear you)
61
+ vivox.muteLocalMic("main_connector", true);
53
62
 
54
- // Test verileriyle bağlan (Otomatik Connector -> Login -> Join süreci)
55
- vivox.connectWithTestData(require('./test_data.json'));
63
+ // Mute a specific participant locally (for you only)
64
+ vivox.setParticipantMute(sessionHandle, "sip:target-user@domain", true);
65
+
66
+ // Adjust volume of a specific participant
67
+ vivox.setParticipantVolume(sessionHandle, "sip:target-user@domain", 50);
56
68
  ```
57
69
 
58
- ## Gelişmiş Özellikler
59
- - **Cihaz Listeleme:** `vivox.getCaptureDevices()` ve `vivox.getRenderDevices()` çağrıları sonrası `captureDevices` ve `renderDevices` olayları tetiklenir.
60
- - **Mesaj Gönderme:** `vivox.sendMessage(sessHandle, "Mesaj içeriği")`
61
- - **Katılımcı Kontrolü:** `vivox.setParticipantMute(sessHandle, uri, true)` ve `vivox.setParticipantVolume(sessHandle, uri, 50)`
62
- - **3D Ses:** `vivox.set3DPosition(acctHandle, x, y, z, channelUri)`
70
+ ## Audio Injection
71
+
72
+ Inject a `.wav` file (must be 16-bit PCM, Mono, matching channel sample rate):
73
+
74
+ ```javascript
75
+ vivox.injectAudio(accountHandle, "path/to/audio.wav");
76
+ ```
77
+
78
+ ## Scripts
79
+
80
+ - `npm run build`: Rebuild the native C++ addon.
81
+ - `npm run compile`: Recompile the TypeScript wrapper.
82
+ - `npm test`: Run the standard connection example.
83
+
84
+ ## License
85
+
86
+ This project is licensed under the MIT License.
87
+ Vivox SDK is a trademark of Unity Technologies.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "vivox-sdk-node",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "High-performance, type-safe Node.js wrapper for the Vivox SDK.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
8
8
  "install": "node-gyp rebuild",
9
9
  "build": "node-gyp rebuild",
10
- "test": "node example_test.js",
10
+ "test": "node example.js",
11
11
  "compile": "npx tsc"
12
12
  },
13
13
  "keywords": [