Developer Documentation

OdinMedia

export class OdinMedia

The OdinMedia class. Represents a local media stream added to the room - i.e. a microphone, another audio stream like files. Don’t create OdinMedia instances directly, use createAudioStream from OdinRoom instead.

Constructor

NameTypeDescription
constructorOdinMediaCreates a new instance of a media object. Don’t create OdinMedia directly, use createAudioStream from OdinRoom instead.

Properties

NameTypeDescription
idstringGets the ID of the media.

Public Methods

NameTypeDescription
closevoidCloses the local audio stream and removed the media from the room
pausevoidInstructs the server to pause the media object, ceasing the reception of data. This operation essentially communicates a server-side mute request from the client, thus indicating a desire to halt packet reception for this media stream.
resumevoidInstructs the server to resume the media object, resuming the reception of data. This operation essentially communicates a server-side unmute request from the client, thus indicating a desire to resume packet reception for this media stream.
sendAudioDatavoidSends audio data to the room. The data must be in the format specified when creating the media as a 32-bit float array. Samples need to be between -1 and 1. Audio data needs to be sent in regular intervals, otherwise the audio will be sound interrupted. See the example for more details.