Skip to Content
defold-typescript libraries
defold (official)

defold/extension-odin/odin

Functions and constants for interacting with ODIN Voice

  • GitHub: defold/extension-odin — pinned to 1.0.0 (released while Defold 1.11.0 was current)
    1. This repo publishes no stable release. Pick a tag from defold/extension-odin tags and add its Source code (zip) URL — for the pinned tag, https://github.com/defold/extension-odin/archive/refs/tags/1.0.0.zip — to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as odin from "odin"

Functions

odin.init(listener: function): boolean

Initialize ODIN Voice

Parameters

  • listener: function

Returns

  • success: boolean

odin.create_room(room_id: string, user_id: string, access_key?: string): boolean

Create or join a room.

Parameters

  • room_id: string — Id of the room to join
  • user_id: string — Id of the user
  • access_key?: string — The access key used when generating a token for room access. Will use odin.access_key if none is provided.

Returns

  • success: boolean

odin.close_room(): boolean

Close/leave a previously created/joined room.

Returns

  • success: boolean

odin.send(data: string, target_peer_ids?: table, msgid?: number): boolean

Send a message to the current room.

Parameters

  • data: string — Data to send.
  • target_peer_ids?: table — Optional table with peers to send message to. Nil to send to all.
  • msgid?: number — Optional message id to identify message by. The id will be used in the response.

Returns

  • success: boolean

On this page