AgoraEduMediaContext

The AgoraEduMediaContext class.

The methods provided by the AgoraEduMediaContext class are used for:
  • Managing local audio and video devices.
  • Playing local audio.
  • Rendering and previewing local video.

startRenderVideo

Starts rendering the video stream.

AgoraEduContextError startRenderVideo(View view,
                                      AgoraEduContextRenderConfig config,
                                      String streamUuid)

Parameter

config
Video rendering configurations. See AgoraEduContextRenderConfig.
view
The view for rendering.
streamUuid
The ID of the stream to be rendered. If you want to preview the video stream captured by the camera before joining the room, set streamUuid as 0.

Returns

If the method call fails, the SDK returns AgoraEduContextError.

stopRenderVideo

Stops rendering the video stream.

AgoraEduContextError stopRenderLocalVideo(String streamUuid)

Parameter

streamUuid
The stream ID. If you want to stop previewing the video stream captured by the local camera before joining the room, set streamUuid as 0.

Returns

If the method call fails, the SDK returns AgoraEduContextError.

startAudioMixing

Starts audio mixing.

AgoraEduContextError startAudioMixing(String filePath,
                                      Boolean loopback,
                                      Boolean replace,
                                      Int cycle)

Call this method to mix the audio stream sampled by the microphone with the audio in the locally-played music file, so that the remote user can hear the music file more clearly.

Parameter

filePath
The path of the music file that needs to be mixed.
loopback
Whether to play the music file only on the local client.
replace
Whether to replace the audio sampled by the microphone with the music file.
cycle
The number of times the music file is played. Setting this parameter as -1 means loop playback.

Returns

If the method call fails, the SDK returns AgoraEduContextError.

setAudioMixingPosition

Sets the starting position of the music file for mixing.

AgoraEduContextError setAudioMixingPosition(Int position)

Parameter

position
The starting position (in milliseconds) of the music file.

Returns

If the method call fails, the SDK returns AgoraEduContextError.

addAudioRawDataObserver

Registers an FcrAudioRawDataObserver.

FcrError addAudioRawDataObserver(FcrAudioRawDataObserver observer,
                                 FcrAudioRawDataPosition position)
This method can only be called before the user joins the channel. To add more observers, call this API multiple times.

Parameter

observer
The audio raw data observer: FcrAudioRawDataObserver.
position
The output position of the audio pipeline: FcrAudioRawDataPosition
config
The output configuration of the audio pipeline: FcrAudioRawDataConfig