This topic describes the methods of the IAliEngineMediaEngine class provided by Real-Time Communication (RTC) SDK for Windows.
SDK reference
For more information about the IAliEngineMediaEngine class, see AliRTCSdk::IAliEngineMediaEngine.
List of methods
Methods for a media engine
| Method | Description | Supported earliest version |
| RegisterVideoSampleObserver | Subscribes to the data output of a video track. | V2.1 |
| UnRegisterVideoSampleObserver | Unsubscribes from the data output of a video track. | V2.1 |
| RegisterLocalVideoTextureObserver | Subscribes to the texture data of a local video track. | V2.1 |
| UnRegisterLocalVideoTextureObserver | Unsubscribes from the texture data of a local video track. | V2.1 |
| RegisterAudioFrameObserver | Subscribes to the data output of an audio track. | V2.1 |
| UnRegisterAudioFrameObserver | Unsubscribes from the data output of an audio track. | V2.1 |
| RegisterAudioEventObserver | Subscribes to audio-related events. By default, audio-related events are subscribed to. | V2.1 |
| UnRegisterAudioEventObserver | Unsubscribes from audio-related events. | V2.1 |
| SetSubscribeAudioNumChannel | Specifies the number of sound channels for the output data of an audio track. You cannot set the audioNumChannel parameter before audio mixing. | V2.1 |
| SetSubscribeAudioSampleRate | Specifies the sampling rate for the output data of an audio track. You cannot set the audioSampleRate parameter before audio mixing. | V2.1 |
| SubscribeAudioData | Subscribes to the data of an audio track. | V2.1 |
| UnsubscribeAudioData | Unsubscribes from the data of an audio track. | V2.1 |
| SetExternalVideoSource | Specifies whether to enable an external video source. | V2.1 |
| PushExternalVideoFrame | Imports video data from an external video source. | V2.1 |
| SetExternalAudioSource | Specifies whether to enable an external audio source. | V2.1 |
| PushExternalAudioFrameRawData | Imports audio data from an external audio source. | V2.1 |
| SetExternalAudioPublishVolume | Sets the volume of audio mixing. | V2.1 |
| GetExternalAudioPublishVolume | Queries the volume of audio mixing. | V2.1 |
| SetMixedWithMic | Specifies whether to mix the data of an audio track with microphone-collected audio. | V2.1 |
| SetExteranlAudioRender | Specifies whether to enable an external audio source for playback. | V2.1 |
| PushExternalAudioRenderRawData | Imports audio data from an external audio source for playback. | V2.1 |
| SetExternalAudioRenderVolume | Sets the volume of an external audio source. | V2.1 |
| GetExternalAudioRenderVolume | Queries the volume of an external audio source. | V2.1 |
Details of methods
- RegisterVideoSampleObserver: subscribes to the data output of a video track.
Parametersvoid RegisterVideoSampleObserver(IVideoFrameObserver* observer);Parameter Type Description observer IVideoFrameObserver* The recipient of the video data. Note The data is returned by the callbacks of the IVideoFrameObserver class. - UnRegisterVideoSampleObserver: unsubscribes from the data output of a video track.
Parametersvoid UnRegisterVideoSampleObserver(IVideoFrameObserver* observer);Parameter Type Description observer IVideoFrameObserver* The recipient of the video data. - RegisterLocalVideoTextureObserver: subscribes to the texture data of a local video track.
Parametersvoid RegisterLocalVideoTextureObserver(IVideoTextureObserver* observer);Parameter Type Description observer IVideoTextureObserver* The recipient of the video data. Note The data is returned by the callbacks of the IVideoTextureObserver class. - UnRegisterLocalVideoTextureObserver: unsubscribes from the texture data of a local video track.
Parametersvoid UnRegisterLocalVideoTextureObserver(IVideoTextureObserver* observer);Parameter Type Description observer IVideoTextureObserver* The recipient of the video data. - RegisterAudioFrameObserver: subscribes to the data output of an audio track.
Parametersint RegisterAudioFrameObserver(IAudioFrameObserver* observer);Parameter Type Description observer IAudioFrameObserver* The recipient of the audio data. - UnRegisterAudioFrameObserver: unsubscribes from the data output of an audio track.
Parametersvoid UnRegisterAudioFrameObserver(IAudioFrameObserver* observer);Parameter Type Description observer IAudioFrameObserver* The recipient of the audio data. - RegisterAudioEventObserver: subscribes to audio-related events such as howling noise. By default, audio-related events are subscribed to.
Return value descriptionint RegisterAudioEventObserver();If 0 is returned, the call is successful. Otherwise, the call fails.
- UnRegisterAudioEventObserver: unsubscribes from audio-related events.
void UnRegisterAudioEventObserver(); - SetSubscribeAudioNumChannel: specifies the number of sound channels for the output data of an audio track. You cannot set the audioNumChannel parameter before audio mixing.
Parametersvoid SetSubscribeAudioNumChannel(AliEngineAudioNumChannelType audioNumChannel);Parameter Type Description audioNumChannel AliEngineAudioNumChannelType The number of sound channels. By default, the output data of the audio track is in mono mode. - SetSubscribeAudioSampleRate: specifies the sampling rate for the output data of an audio track. You cannot set the audioSampleRate parameter before audio mixing.
Parametersvoid SetSubscribeAudioSampleRate(AliEngineAudioSampleRate audioSampleRate);Parameter Type Description audioSampleRate AliEngineAudioSampleRate The sampling rate. Unit: kHz. Default value: 44.1. - SubscribeAudioData: subscribes to the data of an audio track.
Parametersvoid SubscribeAudioData(AliEngineAudioSource audioSource);Parameter Type Description audioSource AliEngineAudioSource The audio track. Note Before you subscribe to the data output of an audio track, call the SetSubscribeAudioNumChannel and SetSubscribeAudioSampleRate methods to set parameters for the output data of the audio track. - UnsubscribeAudioData: unsubscribes from the data of an audio track.
Parametersvoid UnsubscribeAudioData(AliEngineAudioSource audioSource);Parameter Type Description audioSource AliEngineAudioSource The audio track. - SetExternalVideoSource: specifies whether to enable an external video source.
Parametersint SetExternalVideoSource(bool enable, bool useTexture, AliEngineVideoTrack type, AliEngineRenderMode renderMode);
Return value descriptionParameter Type Description enable Boolean Specifies whether to enable the external video source. Valid values: - true: enables the external video source.
- false: disables the external video source.
useTexture Boolean Specifies whether to use the texture mode. type AliEngineVideoTrack The type of the video track. renderMode AliEngineRenderMode The rendering mode. If 0 is returned, the call is successful. Otherwise, the call fails.
- PushExternalVideoFrame: imports video data from an external video source.
Parametersint PushExternalVideoFrame(const AliEngineVideoRawData &frame, AliEngineVideoTrack type);
Return value descriptionParameter Type Description frame const AliEngineVideoRawData & The information about the video data. type AliEngineVideoTrack The type of the video track. If 0 is returned, the call is successful. Otherwise, the call fails.
- SetExternalAudioSource: specifies whether to enable an external audio source.
Parametersint SetExternalAudioSource(bool enable, unsigned int sampleRate, unsigned int channelsPerFrame);
Return value descriptionParameter Type Description enable Boolean Specifies whether to enable the external audio source. Valid values: - true: enables the external audio source.
- false: disables the external audio source. This is the default value.
sampleRate unsigned int The sampling rate. Unit: kHz. Example: 16 kHz or 48 kHz. channelsPerFrame unsigned int The number of sound channels. Example: 1 or 2. If 0 is returned, the call is successful. Otherwise, the call fails.
- PushExternalAudioFrameRawData: imports audio data from an external audio source.
Parametersint PushExternalAudioFrameRawData(const void * data, unsigned int sampleLen, double timestamp);
Return value descriptionParameter Type Description data const void * The information about the audio data. We recommend that you import audio data of up to 40 ms in length. sampleLen unsigned int The sampling rate. timestamp double The timestamp. If 0 is returned, the call is successful. Otherwise, the call fails.
- SetExternalAudioPublishVolume: sets the volume of audio mixing.
Parametersint SetExternalAudioPublishVolume(int vol);
Return value descriptionParameter Type Description vol int The volume. Valid values: 0 to 100. Default value: 50. If 0 is returned, the call is successful. Otherwise, the call fails.
- GetExternalAudioPublishVolume: queries the volume of audio mixing.
Return value descriptionint GetExternalAudioPublishVolume();Returns the volume of audio mixing.
- SetMixedWithMic: specifies whether to mix the data of an audio track with microphone-collected audio.
Parametersint SetMixedWithMic(bool mixed);
Return value descriptionParameter Type Description mixed Boolean Specifies whether to mix the data of the audio track with microphone-collected audio. Valid values: - true: mixes the data of the audio track with microphone-collected audio. This is the default value.
- false: replaces microphone-collected audio with the data of the audio track.
If 0 is returned, the call is successful. Otherwise, the call fails.
- SetExteranlAudioRender: specifies whether to enable an external audio source for playback.
Parametersint SetExteranlAudioRender(bool enable, unsigned int sampleRate, unsigned int channelsPerFrame);
Return value descriptionParameter Type Description enable Boolean Specifies whether to enable the external audio source for playback. Valid values: - true: enables the external audio source for playback.
- false: disables the external audio source for playback. This is the default value.
sampleRate unsigned int The sampling rate. Unit: kHz. Example: 16 kHz or 48 kHz. channelsPerFrame unsigned int The number of sound channels. Example: 1 or 2. If 0 is returned, the call is successful. Otherwise, the call fails.
- PushExternalAudioRenderRawData: imports audio data from an external audio source for playback.
Parametersint PushExternalAudioRenderRawData(const void* audioSamples, unsigned int sampleLength, unsigned int sampleRate, unsigned int channelsPerFrame, long long timestamp);
Return value descriptionParameter Type Description audioSamples const void* The information about the audio data. sampleLength unsigned int The length of the audio data. sampleRate unsigned int The sampling rate. channelsPerFrame unsigned int The number of sound channels. timestamp long long The timestamp. If 0 is returned, the call is successful. Otherwise, the call fails.
- SetExternalAudioRenderVolume: sets the volume of an external audio source.
Parametersint SetExternalAudioRenderVolume(int volScal);
Return value descriptionParameter Type Description volScal int The volume. Valid values: 0 to 100. Default value: 50. If 0 is returned, the call is successful. Otherwise, the call fails.
- GetExternalAudioRenderVolume: queries the volume of an external audio source.
Return value descriptionint GetExternalAudioRenderVolume();If 0 is returned, the call is successful. Otherwise, the call fails.