@4players/odin-common 3.0.0-beta.1 → 3.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.
@@ -3,14 +3,14 @@ export declare namespace Backend {
3
3
  type UID = string;
4
4
  type OnStatusChanged = (status: 'started' | 'stopped') => void;
5
5
  type OnEvent = (method: string, properties: unknown) => void;
6
- type Version = '4';
6
+ type Version = '5';
7
7
  enum Transport {
8
8
  H3 = "h3",
9
9
  WebRTC = "webrtc"
10
10
  }
11
11
  interface Plugin {
12
12
  readonly version: Version;
13
- readonly playbackVolume: Volume;
13
+ readonly playbackVolume: PlaybackVolume;
14
14
  readonly supportedTransports: (Transport.WebRTC | Transport.H3)[];
15
15
  joinRoom(parameters: JoinRoomParameters): Room;
16
16
  createAudioPlayback(parameters: CreateAudioPlaybackParameters): Promise<AudioPlayback>;
@@ -18,13 +18,14 @@ export declare namespace Backend {
18
18
  createVideoCapture(ms: MediaStream, options?: VideoInputOptions): Promise<VideoCapture>;
19
19
  createVideoPlayback(parameters: CreateVideoPlaybackParameters): Promise<VideoPlayback>;
20
20
  enumerateDevices(): Promise<Array<Device>>;
21
- setOutputVolume(volume: Volume): void;
21
+ setOutputVolume(volume: PlaybackVolume): void;
22
22
  setOutputDevice(device: DeviceParameters): Promise<void>;
23
23
  close(): void;
24
24
  }
25
25
  interface Device {
26
26
  readonly type: 'AudioPlayback' | 'AudioCapture';
27
27
  readonly name: string;
28
+ readonly id: string;
28
29
  readonly isDefault: boolean;
29
30
  }
30
31
  interface DeviceParameters {
@@ -76,13 +77,13 @@ export declare namespace Backend {
76
77
  close(): void;
77
78
  }
78
79
  interface AudioMedia extends Media {
79
- readonly volume: Volume;
80
+ readonly volume: PlaybackVolume | CaptureVolume;
80
81
  readonly activity: Activity;
81
- setVolume(value: Volume): Promise<void>;
82
+ setVolume(value: PlaybackVolume | CaptureVolume): Promise<void>;
82
83
  }
83
84
  interface CreateAudioPlaybackParameters {
84
85
  readonly uid: UID;
85
- readonly volume?: Volume;
86
+ readonly volume?: PlaybackVolume;
86
87
  readonly customType?: string;
87
88
  }
88
89
  interface CreateVideoPlaybackParameters {
@@ -94,7 +95,7 @@ export declare namespace Backend {
94
95
  jitterStats: JitterStats;
95
96
  }
96
97
  interface CreateAudioCaptureParameters extends Partial<DeviceParameters> {
97
- readonly volume?: Volume;
98
+ readonly volume?: CaptureVolume;
98
99
  readonly vad?: VadConfig;
99
100
  readonly apm?: ApmConfig;
100
101
  }
@@ -113,7 +114,8 @@ export declare namespace Backend {
113
114
  readonly mediaStream?: MediaStream;
114
115
  readonly uid: UID;
115
116
  }
116
- type Volume = number | 'muted';
117
+ type PlaybackVolume = [number, number];
118
+ type CaptureVolume = 'muted' | number;
117
119
  interface VadConfig {
118
120
  voiceActivity?: SensitivityRange;
119
121
  volumeGate?: SensitivityRange;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4players/odin-common",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.1.0",
4
4
  "description": "A collection of commonly used type definitions and utility functions across ODIN web projects",
5
5
  "author": "Josho Bleicker <josho.bleicker@4players.io> (https://www.4players.io)",
6
6
  "homepage": "https://www.4players.io",
@@ -44,4 +44,4 @@
44
44
  "typescript": "~5.6.0",
45
45
  "typescript-eslint": "~8.24.0"
46
46
  }
47
- }
47
+ }