function connect(
ticket,
data,
domParentId,
position,
rotation,
attrs = {},
url = "https://panaudia.com/entrance") {...}
interface Vec3 {
x: number
y: number
z: number
}
function connect(
ticket: string,
data: boolean,
domParentId: string,
position: Vec3,
rotation: Vec3,
attrs: { [key: string]: string }={},
url: string="https://panaudia.com/gateway",
): void {...}
Connects to the Space via WebRTC, setting up two way audio and data channels.
This is a ticket for the space in the form of a signed JWT token. You can fetch these with the Shapes API or generate and sign them yourself. You can read more about tickets here.
If true the Space server will send this client attribute and state messages in WebRTC data channels giving updates about other users in the same Space. Set this to true to use setStateCallback, setAmbisonicStateCallback or setAttributesCallback.
This must be the id of an existing dom element to which the audio player for the incoming WebRTC audio will be added.
This sets the initial position of this user in the virtual audio space.
This sets the initial rotation of the user in the virtual audio space.
You can, optionally, set some string attributes here that will be passed to all other users via the AttributesCallback in the connection field. See setAttributesCallback below. This can be useful to customise the appearance of the user.
This is where the SDK will connect to look up the actual connection url for the Space. You can usually omit this and use the default.
function connectAmbisonic(
ticket,
domParentId,
coordinates,
attrs = {},
url = "https://panaudia.com/entrance") {...}
interface AmbisonicCoordinates {
x: number
y: number
z: number
yaw: number
pitch: number
roll: number
}
function connectAmbisonic(
ticket: string,
domParentId: string,
coordinates: AmbisonicCoordinates,
attrs: { [key: string]: string }={},
url: string="https://panaudia.com/entrance",
): void {...}
This is an alternative version of the connect function above that uses native ambisonic coordinates rather than WebGL ones.
This is a ticket for the space in the form of a signed JWT token. You can fetch these with the Shapes API or generate and sign them yourself. You can read more about tickets here.
This must be the id of an existing dom element to which the audio player for the incoming WebRTC audio will be added.
This sets the initial position and rotation of this user in the virtual audio space.
You can, optionally, set some string attributes here that will be passed to all other users via the AttributesCallback in the connection field. See setAttributesCallback below. This can be useful to customise the appearance of the user.
This is where the SDK will connect to look up the actual connection url for the Space. You can usually omit this and use the default.
function move(position, rotation) {...}
interface Vec3 {
x: number
y: number
z: number
}
function move(position: Vec3, rotation: Vec3): void {...}
When the position and/or rotation of the user changes update the mixer.
This new position of the user in the virtual audio space.
The new rotation of the user in the virtual audio space.
function moveAmbisonic(coordinates) {...}
interface AmbisonicCoordinates {
x: number
y: number
z: number
yaw: number
pitch: number
roll: number
}
function moveAmbisonic(coordinates: AmbisonicCoordinates): void {...}
An alternative version of the move function above that uses native ambisonic coordinates rather than position and rotation.
The new position and rotation of this user in the virtual audio space.
function disconnect() {...}
function disconnect(): void {...}
Disconnects from the server and stops using the users microphone.
It is possible to call connect again after calling disconnect.
function setConnectionStatusCallback(statusCallback) {...}
type ConnectionStatus =
| "connecting"
| "connected"
| "data_connected"
| "disconnected"
| "error";
interface ConnectionStatusCallback {
(status: ConnectionStatus, message: string): void
}
function setConnectionStatusCallback(statusCallback: ConnectionStatusCallback) {...}
The SDK will call the callback with connection status updates
A function with two parameters:
function setStateCallback(stateCallback) {...}
interface Vec3 {
x: number
y: number
z: number
}
interface NodeState {
uuid: string
position: Vec3
rotation: Vec3
volume: number
gone: boolean
}
interface StateCallback {
(state: NodeState): void
}
function setStateCallback(stateCallback: StateCallback): void {...}
The SDK will call the callback with state updates for all the other users in the Space giving their uuid, position, rotation, volume and if then have left the Space. This callback is called with quite high frequency (~20Hz per user).
A function with one parameter that is an object with these values:
function setAmbisonicStateCallback(ambisonicStateCallback) {...}
interface AmbisonicNodeState {
uuid: string
x: number
y: number
z: number
yaw: number
pitch: number
roll: number
volume: number
gone: boolean
}
interface AmbisonicStateCallback {
(state: AmbisonicNodeState): void
}
function setAmbisonicStateCallback(ambisonicStateCallback: AmbisonicStateCallback): void {...}
An alternative version of the move function above that uses native ambisonic coordinates rather than position and rotation.
A function with one parameter that is an object with these values:
function setAttributesCallback(attributesCallback) {...}
interface NodeAttributes {
uuid: string
name: string
ticket: { string: any }
connection: { string: any }
}
interface AttributesCallback {
(attrs: NodeAttributes): void
}
function setAttributesCallback(attributesCallback: AttributesCallback): void {...}
The SDK will call the attributesCallback with and object giving descriptive information about other users in the Space.
This callback is called with a lower frequency than the state callback.
A function with one parameter that is an object with these values: