New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@4players/odin

Package Overview
Dependencies
Maintainers
2
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@4players/odin

A cross-platform SDK enabling developers to integrate real-time VoIP chat technology into their projects

latest
Source
npmnpm
Version
1.6.1
Version published
Maintainers
2
Created
Source

@4players/odin

npm npm npm

ODIN is a versatile cross-platform Software Development Kit (SDK) engineered to seamlessly integrate real-time voice chat into multiplayer games, applications, and websites. Regardless of whether you're employing a native application or your preferred web browser, ODIN simplifies the process of maintaining connections with your significant contacts. Through its intuitive interface and robust functionality, ODIN enhances interactive experiences, fostering real-time engagement and collaboration across various digital platforms.

You can choose between a managed cloud and a self-hosted solution. Let 4Players GmbH deal with the setup, administration and bandwidth costs or run our server software on your own infrastructure allowing you complete control and customization of your deployment environment.

Online Documentation · API Reference

Installation

npm install @4players/odin

Type definitions are included. The audio plugin (@4players/odin-plugin-web) is a dependency and is loaded automatically when needed (e.g. when calling ensurePlugin() or setOutputDevice()).

CDN (Browser)

For browser-only use you can load the SDK via CDN. Prefer pinning a specific version to avoid breaking changes:

  • IIFE: https://cdn.odin.4players.io/client/js/sdk/<version>/odin-sdk.js (global ODIN)
  • ESM: https://cdn.odin.4players.io/client/js/sdk/<version>/odin-sdk.esm.js

See the documentation for current version and usage.

Features

Advanced Audio Processing

ODIN enhances your audio experience during VoIP chats by offering a comprehensive set of filters beyond the basic audio processing features found in web browsers. These enhancements are activated by default, ensuring clear and interruption-free communication.

  • Voice Activity Detection
    When enabled, ODIN analyzes the audio input signal using a smart voice detection algorithm to determine the presence of speech. You can define both the probability required to start and stop transmitting.
  • Input Volume Gate
    When enabled, the volume gate measures the volume of the input audio signal, thus deciding when a user is speaking loud enough to transmit voice data. You can define both the root mean square power (dBFS) for when the gate should engage and disengage.

WebTransport (HTTP/3) support

We use the latest WebTransport API to transmit voice data in real time, with a seamless fallback to WebRTC for compatibility with older browsers.

End-to-End Encryption (Cipher)

ODIN supports end-to-end encryption (E2EE) through the use of a pluggable OdinCipher module. This enables you to secure all datagrams, messages and peer user data with a shared room password — without relying on the server as a trust anchor.

Quick Start

  • Install the package and ensure audio is started after a user interaction (e.g. button click).
  • Register event handlers before calling room.join() so you receive events that occur while joining (e.g. remote peers already in the room).
  • Transmit audio only after room.addAudioInput(audioInput).
  • Call setOutputDevice({}) to hear other peers (can be called anytime to set or switch the output device).

JavaScript / TypeScript Example

import {
  setOutputDevice,
  Room,
  DeviceManager,
} from '@4players/odin';

let room;
let audioInput;

async function joinRoom(token) {
  await setOutputDevice({});

  room = new Room();
  room.onJoined = (payload) => console.log('Joined', payload.room.id);
  room.onLeft = (payload) => console.log('Left', payload?.reason);
  room.onPeerJoined = (payload) => console.log('Peer joined', payload.peer.userId);
  room.onPeerLeft = (payload) => console.log('Peer left', payload.peer.userId);

  await room.join(token, { gateway: 'https://gateway.odin.4players.io' });

  audioInput = await DeviceManager.createAudioInput();
  await room.addAudioInput(audioInput);
}

async function leaveRoom() {
  if (audioInput && room) {
    room.removeAudioInput(audioInput);
    audioInput.close();
  }
  if (room) room.leave();
  room = undefined;
  audioInput = undefined;
}

// Call from a user gesture (e.g. button click).
joinRoom('__YOUR_TOKEN__');

Tokens must be generated server-side. See the documentation for authentication and gateway options.

Troubleshooting

  • No audio from peers: Ensure setOutputDevice({}) has been called to configure the output device.
  • Microphone not transmitting: Ensure room.addAudioInput(audioInput) is called after joining.
  • AudioContext not allowed: Start the flow from a user interaction (click/tap).
  • Events not firing: Register all event handlers before calling room.join() so you receive events that occur while joining (e.g. remote peers already in the room).

Discord

Join our official Discord server to chat with us and become part of the 4Players ODIN community.

Join us on Discord

X (formerly Twitter)

Tweet us at @ODIN4Players.

Email

odin@4players.io

Keywords

audio

FAQs

Package last updated on 23 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts