AgoraEduMediaContext
The AgoraEduMediaContext class.
- Managing local audio and video devices.
- Playing local audio.
- Rendering and previewing local video.
getLocalDevices
Gets the local devices.
Array<AgoraEduContextDeviceInfo> getLocalDevices(deviceType AgoraEduContextDeviceType)
Parameter
- deviceType
- The device type. See AgoraEduContextDeviceType.
Returns
An array of AgoraEduContextDeviceInfo.
openLocalDevice
Turns on the specified local device.
AgoraEduContextError openLocalDevice(AgoraEduContextDeviceInfo device)
Parameter
- device
- The device information. See AgoraEduContextDeviceInfo.
Returns
If the deviceId that you pass in does not exist, the SDK returns AgoraEduContextError.
closeLocalDevice
Turns off the local device.
AgoraEduContextError closeLocalDevice(AgoraEduContextDeviceInfo device)
Parameter
- device
- The device information. See AgoraEduContextDeviceInfo.
Returns
If the deviceId that you pass in does not exist, the SDK returns AgoraEduContextError.
getLocalDeviceState
Gets the state of the local device.
void getLocalDeviceState(AgoraEduContextDeviceInfo device, Callback<AgoraEduContextDeviceState> success, Callback<AgoraEduContextError> fail)
Parameter
- device
- The device information. See AgoraEduContextDeviceInfo.
- success
- If the method call succeeds, the SDK returns the device state AgoraEduContextDeviceState.
- fail
- If the method call fails, the SDK returns AgoraEduContextError.
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.
stopAudioMixing
Stops audio mixing.
AgoraEduContextError stopAudioMixing()
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)
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。
removeAudioRawDataObserver
Unregisters the FcrAudioRawDataObserver.
FcrError removeAudioRawDataObserver(FcrAudioRawDataObserver observer, FcrAudioRawDataPosition position)
参数
- observer
- The FcrAudioRawDataObserver.
- position
- The position of the output audio data: FcrAudioRawDataPosition.