@spatialwalk/avatarkit-rtc 1.0.0-beta.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.
Files changed (85) hide show
  1. package/README.md +417 -0
  2. package/dist/assets/animation-worker-CUXZycUw.js.map +1 -0
  3. package/dist/core/AnimationHandler.d.ts +17 -0
  4. package/dist/core/AnimationHandler.d.ts.map +1 -0
  5. package/dist/core/AvatarPlayer.d.ts +119 -0
  6. package/dist/core/AvatarPlayer.d.ts.map +1 -0
  7. package/dist/core/RTCProvider.d.ts +84 -0
  8. package/dist/core/RTCProvider.d.ts.map +1 -0
  9. package/dist/core/index.d.ts +7 -0
  10. package/dist/core/index.d.ts.map +1 -0
  11. package/dist/core/types.d.ts +7 -0
  12. package/dist/core/types.d.ts.map +1 -0
  13. package/dist/index.d.ts +16 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +13 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/index10.js +67 -0
  18. package/dist/index10.js.map +1 -0
  19. package/dist/index11.js +390 -0
  20. package/dist/index11.js.map +1 -0
  21. package/dist/index12.js +108 -0
  22. package/dist/index12.js.map +1 -0
  23. package/dist/index13.js +18 -0
  24. package/dist/index13.js.map +1 -0
  25. package/dist/index14.js +48 -0
  26. package/dist/index14.js.map +1 -0
  27. package/dist/index15.js +29 -0
  28. package/dist/index15.js.map +1 -0
  29. package/dist/index16.js +144 -0
  30. package/dist/index16.js.map +1 -0
  31. package/dist/index17.js +106 -0
  32. package/dist/index17.js.map +1 -0
  33. package/dist/index18.js +28 -0
  34. package/dist/index18.js.map +1 -0
  35. package/dist/index2.js +220 -0
  36. package/dist/index2.js.map +1 -0
  37. package/dist/index3.js +586 -0
  38. package/dist/index3.js.map +1 -0
  39. package/dist/index4.js +410 -0
  40. package/dist/index4.js.map +1 -0
  41. package/dist/index5.js +20 -0
  42. package/dist/index5.js.map +1 -0
  43. package/dist/index6.js +282 -0
  44. package/dist/index6.js.map +1 -0
  45. package/dist/index7.js +53 -0
  46. package/dist/index7.js.map +1 -0
  47. package/dist/index8.js +189 -0
  48. package/dist/index8.js.map +1 -0
  49. package/dist/index9.js +178 -0
  50. package/dist/index9.js.map +1 -0
  51. package/dist/proto/animation.d.ts +12 -0
  52. package/dist/proto/animation.d.ts.map +1 -0
  53. package/dist/providers/agora/AgoraProvider.d.ts +71 -0
  54. package/dist/providers/agora/AgoraProvider.d.ts.map +1 -0
  55. package/dist/providers/agora/SEIExtractor.d.ts +29 -0
  56. package/dist/providers/agora/SEIExtractor.d.ts.map +1 -0
  57. package/dist/providers/agora/index.d.ts +11 -0
  58. package/dist/providers/agora/index.d.ts.map +1 -0
  59. package/dist/providers/agora/types.d.ts +14 -0
  60. package/dist/providers/agora/types.d.ts.map +1 -0
  61. package/dist/providers/base/BaseProvider.d.ts +11 -0
  62. package/dist/providers/base/BaseProvider.d.ts.map +1 -0
  63. package/dist/providers/index.d.ts +10 -0
  64. package/dist/providers/index.d.ts.map +1 -0
  65. package/dist/providers/livekit/LiveKitProvider.d.ts +64 -0
  66. package/dist/providers/livekit/LiveKitProvider.d.ts.map +1 -0
  67. package/dist/providers/livekit/VP8Extractor.d.ts +10 -0
  68. package/dist/providers/livekit/VP8Extractor.d.ts.map +1 -0
  69. package/dist/providers/livekit/animation-transform.d.ts +11 -0
  70. package/dist/providers/livekit/animation-transform.d.ts.map +1 -0
  71. package/dist/providers/livekit/animation-worker.d.ts +14 -0
  72. package/dist/providers/livekit/animation-worker.d.ts.map +1 -0
  73. package/dist/providers/livekit/index.d.ts +11 -0
  74. package/dist/providers/livekit/index.d.ts.map +1 -0
  75. package/dist/providers/livekit/types.d.ts +11 -0
  76. package/dist/providers/livekit/types.d.ts.map +1 -0
  77. package/dist/providers/livekit/utils.d.ts +11 -0
  78. package/dist/providers/livekit/utils.d.ts.map +1 -0
  79. package/dist/types/index.d.ts +77 -0
  80. package/dist/types/index.d.ts.map +1 -0
  81. package/dist/utils/index.d.ts +7 -0
  82. package/dist/utils/index.d.ts.map +1 -0
  83. package/dist/utils/logger.d.ts +13 -0
  84. package/dist/utils/logger.d.ts.map +1 -0
  85. package/package.json +61 -0
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Core type definitions for RTC adapter
3
+ * @packageDocumentation
4
+ */
5
+ /**
6
+ * Connection state for RTC providers.
7
+ * Represents the current state of the RTC connection.
8
+ */
9
+ export declare enum ConnectionState {
10
+ /** Not connected to any RTC server */
11
+ Disconnected = "disconnected",
12
+ /** Currently connecting to RTC server */
13
+ Connecting = "connecting",
14
+ /** Successfully connected to RTC server */
15
+ Connected = "connected",
16
+ /** Reconnecting after connection loss */
17
+ Reconnecting = "reconnecting",
18
+ /** Connection failed permanently */
19
+ Failed = "failed"
20
+ }
21
+ /**
22
+ * LiveKit connection configuration.
23
+ * Used when connecting via LiveKitProvider.
24
+ */
25
+ export interface LiveKitConnectionConfig {
26
+ /** LiveKit server URL (e.g., wss://your-server.livekit.cloud) */
27
+ url: string;
28
+ /** Authentication token */
29
+ token: string;
30
+ /** Room name to join */
31
+ roomName: string;
32
+ }
33
+ /**
34
+ * Agora connection configuration.
35
+ * Used when connecting via AgoraProvider.
36
+ */
37
+ export interface AgoraConnectionConfig {
38
+ /** Agora Application ID (from Agora Console) */
39
+ appId: string;
40
+ /** Channel name to join */
41
+ channel: string;
42
+ /** Authentication token (optional for testing, required for production) */
43
+ token?: string;
44
+ /** User ID (optional, 0 or undefined = auto-assign) */
45
+ uid?: number;
46
+ }
47
+ /**
48
+ * RTC connection configuration.
49
+ * Union type supporting both LiveKit and Agora providers.
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * // LiveKit
54
+ * await player.connect({
55
+ * url: 'wss://your-server.livekit.cloud',
56
+ * token: 'your-token',
57
+ * roomName: 'my-room',
58
+ * });
59
+ *
60
+ * // Agora
61
+ * await player.connect({
62
+ * appId: 'your-agora-app-id',
63
+ * channel: 'my-channel',
64
+ * token: 'your-agora-token', // optional
65
+ * });
66
+ * ```
67
+ */
68
+ export type RTCConnectionConfig = LiveKitConnectionConfig | AgoraConnectionConfig;
69
+ /**
70
+ * Type guard to check if config is for LiveKit.
71
+ */
72
+ export declare function isLiveKitConfig(config: RTCConnectionConfig): config is LiveKitConnectionConfig;
73
+ /**
74
+ * Type guard to check if config is for Agora.
75
+ */
76
+ export declare function isAgoraConfig(config: RTCConnectionConfig): config is AgoraConnectionConfig;
77
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,oBAAY,eAAe;IACzB,sCAAsC;IACtC,YAAY,iBAAiB;IAC7B,yCAAyC;IACzC,UAAU,eAAe;IACzB,2CAA2C;IAC3C,SAAS,cAAc;IACvB,yCAAyC;IACzC,YAAY,iBAAiB;IAC7B,oCAAoC;IACpC,MAAM,WAAW;CAClB;AA8CD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAC;IAEZ,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IAEd,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IAEd,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAEhB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,GAAG,qBAAqB,CAAC;AAElF;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,IAAI,uBAAuB,CAE9F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,IAAI,qBAAqB,CAE1F"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Utility exports.
3
+ * @packageDocumentation
4
+ */
5
+ export { logger, configureLogger, getLogLevel } from './logger';
6
+ export type { LogLevel, LoggerConfig } from './logger';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAChE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Logger utility for @spatialwalk/avatarkit-rtc SDK.
3
+ *
4
+ * Supports three log levels: info, warning, error.
5
+ * External consumers can configure the log level at initialization.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /**
10
+ * Log levels supported by the SDK.
11
+ */
12
+ export type LogLevel = 'info' | 'warning' | 'error' | 'none';
13
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@spatialwalk/avatarkit-rtc",
3
+ "type": "module",
4
+ "version": "1.0.0-beta.1",
5
+ "description": "Unified RTC adapter for avatarkit - supports LiveKit, Agora and other RTC providers",
6
+ "author": "SPAvatar Team",
7
+ "license": "MIT",
8
+ "keywords": [
9
+ "rtc",
10
+ "webrtc",
11
+ "avatar",
12
+ "livekit",
13
+ "agora",
14
+ "realtime"
15
+ ],
16
+ "main": "./dist/index.js",
17
+ "module": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "scripts": {
24
+ "build": "vite build",
25
+ "dev": "vite build --watch",
26
+ "clean": "rm -rf dist",
27
+ "typecheck": "tsc --noEmit",
28
+ "test": "vitest",
29
+ "test:watch": "vitest --watch",
30
+ "test:coverage": "vitest --coverage"
31
+ },
32
+ "dependencies": {
33
+ "@bufbuild/protobuf": "^2.10.2"
34
+ },
35
+ "peerDependencies": {
36
+ "@spatialwalk/avatarkit": "1.0.0-beta.74",
37
+ "livekit-client": "^2.0.0",
38
+ "agora-rtc-sdk-ng": "^4.x"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "livekit-client": {
42
+ "optional": true
43
+ },
44
+ "agora-rtc-sdk-ng": {
45
+ "optional": true
46
+ }
47
+ },
48
+ "devDependencies": {
49
+ "@spatialwalk/avatarkit": "1.0.0-beta.74",
50
+ "@types/node": "^22.10.2",
51
+ "livekit-client": "2.16.1",
52
+ "agora-rtc-sdk-ng": "^4.21.0",
53
+ "typescript": "^5.7.2",
54
+ "vite": "^6.0.5",
55
+ "vite-plugin-dts": "^4.5.4",
56
+ "vitest": "^2.1.6",
57
+ "@vitest/coverage-v8": "^2.1.6",
58
+ "jsdom": "^26.0.0",
59
+ "happy-dom": "^20.3.7"
60
+ }
61
+ }