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)- 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— togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as odin from "odin"
- 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,
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 joinuser_id:string— Id of the useraccess_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