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.
Constructors
new OdinMedia()
new OdinMedia(
room
,sampleRate
,channelCount
,options
?):OdinMedia
Creates a new instance of a media object. Don't create OdinMedia directly, use createAudioStream
from OdinRoom instead.
Parameters
• room: OdinRoom
The room to add the media to.
• sampleRate: number
The sample rate of the audio stream (between 8000 and 48000)
• channelCount: number
The number of channels of the audio stream (1 or 2)
• options?: OdinAPMSettings
Optional configuration options for Odin Audio Processing Module (APM).
Returns
Defined in
odin.media.d.ts:15
Accessors
id
get
id():string
Gets the ID of the media.
Returns
string
The ID of the media.
Defined in
odin.media.d.ts:48
Methods
close()
close():
void
Closes the local audio stream and removed the media from the room
Returns
void
Defined in
odin.media.d.ts:20
pause()
pause():
void
Instructs 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.
Returns
void
Defined in
odin.media.d.ts:27
resume()
resume():
void
Instructs 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.
Returns
void
Defined in
odin.media.d.ts:34
sendAudioData()
sendAudioData(
data
):void
Sends 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.
Parameters
• data: Float32Array
A 32-bit float array containing the audio data.
Returns
void
Defined in
odin.media.d.ts:42