NIMMediaManager Protocol Reference

Conforms to NSObject
Declared in NIMMediaManagerProtocol.h

Overview

Media protocol

  recordProgressUpdateTimeInterval required method

Recording progress update interval

@property (nonatomic, assign) NSTimeInterval recordProgressUpdateTimeInterval

Discussion

Recording progress update interval

If the value is greater than 0, the recordAudioProgress: callback will be called at the required interval. The default value is 0.3

Declared In

NIMMediaManagerProtocol.h

– switchAudioOutputDevice: required method

Switch Audio output devices

- (BOOL)switchAudioOutputDevice:(NIMAudioOutputDevice)outputDevice

Parameters

outputDevice

output device

Return Value

result

Discussion

Switch Audio output devices

Declared In

NIMMediaManagerProtocol.h

– setNeedProximityMonitor: required method

If the phone is close to the ear, do you need to automatically switch to the earpieces to play

- (void)setNeedProximityMonitor:(BOOL)needProximityMonitor

Parameters

needProximityMonitor

Specify whether you need on-ear sensor monitoring

Discussion

If the phone is close to the ear, do you need to automatically switch to the earpieces to play

Declared In

NIMMediaManagerProtocol.h

– isPlaying required method

Check if the audio is playing

- (BOOL)isPlaying

Discussion

Check if the audio is playing

Declared In

NIMMediaManagerProtocol.h

– play: required method

Play the audio file

- (void)play:(NSString *)filepath

Parameters

filePath

audio file path

Discussion

Play the audio file

starts playing, the playAudio:didBeganWithError: callback in NIMMediaManagerDelegate will be triggered. After playback is complete, the playAudio:didCompletedWithError: callback in NIMMediaManagerDelegate will be triggered.

Declared In

NIMMediaManagerProtocol.h

– stopPlay required method

Stop playing the audio

- (void)stopPlay

Discussion

Stop playing the audio

playAudio:didCompletedWithError: callback in NIMMediaManagerDelegate will be triggered after audio playback is completed

Declared In

NIMMediaManagerProtocol.h

– seek: required method

Set the start time of audio playback .

- (BOOL)seek:(NSTimeInterval)timestamp

Parameters

timestamp

start time

Discussion

Set the start time of audio playback .

The start time cannot be greater than the audio duration. Otherwise the playback will be invalid. After calling this method, the play method is not required: Automatic playback

Declared In

NIMMediaManagerProtocol.h

– isRecording required method

Check if recording is ongoing

- (BOOL)isRecording

Discussion

Check if recording is ongoing

Declared In

NIMMediaManagerProtocol.h

– recordForDuration: required method

Start recording audios

- (void)recordForDuration:(NSTimeInterval)duration

Parameters

duration

the duration of the recording

Discussion

Start recording audios

Starts recording, the recordAudio:didBeganWithError: callback in NIMMediaManagerDelegate will be triggered. After recording complete, the recordAudio:didCompletedWithError: callback in NIMMediaManagerDelegate will be triggered. By default, AAC encoding format is used

Declared In

NIMMediaManagerProtocol.h

– record:duration: required method

Start recording

- (void)record:(NIMAudioType)type duration:(NSTimeInterval)duration

Parameters

type

audio type

duration

The duration of an audio file.

Discussion

Start recording

Starts recording, the recordAudio:didBeganWithError: callback in NIMMediaManagerDelegate will be triggered. After recording complete, the recordAudio:didCompletedWithError: callback in NIMMediaManagerDelegate will be triggered.

Declared In

NIMMediaManagerProtocol.h

– stopRecord required method

Stop recording audios

- (void)stopRecord

Discussion

Stop recording audios

The recordAudio:didCompletedWithError: callback in NIMMediaManagerDelegate will be triggered after audio playback is completed

Declared In

NIMMediaManagerProtocol.h

– cancelRecord required method

Cancel recording audios

- (void)cancelRecord

Discussion

Cancel recording audios

The recordAudioDidCancelled callback in NIMMediaManagerDelegate will be triggered after audio recording is cancelled

Declared In

NIMMediaManagerProtocol.h

– recordPeakPower required method

Get the peak audio recording decibel level

- (float)recordPeakPower

Discussion

Get the peak audio recording decibel level

Declared In

NIMMediaManagerProtocol.h

– recordAveragePower required method

Get the peak audio recording decibel level

- (float)recordAveragePower

Discussion

Get the peak audio recording decibel level

Declared In

NIMMediaManagerProtocol.h

– transAudioToText:result: required method

Audio to text

- (void)transAudioToText:(NIMAudioToTextOption *)option result:(NIMAudioToTextBlock)result

Parameters

option

Audio to text option

result

Completion callback

Discussion

Audio to text

Declared In

NIMMediaManagerProtocol.h

– disableResetAudioSession: required method

You are not allowed to set AVAudioSession when IM is recording or playing an audio file to prevent other audio and video effects from being affected.

- (void)disableResetAudioSession:(BOOL)disabled

Parameters

disabled

YES: resetting is not allowed

Discussion

You are not allowed to set AVAudioSession when IM is recording or playing an audio file to prevent other audio and video effects from being affected.

Declared In

NIMMediaManagerProtocol.h

– setDeactivateAudioSessionAfterComplete: required method

Specify whether to automatically deactivate AVAudioSession after recording or playback is completed.

- (void)setDeactivateAudioSessionAfterComplete:(BOOL)deactivate

Parameters

deactivate

Specify whether to deactivate. The default value is YES

Discussion

Specify whether to automatically deactivate AVAudioSession after recording or playback is completed.

Declared In

NIMMediaManagerProtocol.h

– addDelegate: required method

Add a multimedia delegate

- (void)addDelegate:(id<NIMMediaManagerDelegate>)delegate

Parameters

delegate

multimedia delegate

Discussion

Add a multimedia delegate

Declared In

NIMMediaManagerProtocol.h

– removeDelegate: required method

Remove a multimedia delegate

- (void)removeDelegate:(id<NIMMediaManagerDelegate>)delegate

Parameters

delegate

multimedia delegate

Discussion

Remove a multimedia delegate

Declared In

NIMMediaManagerProtocol.h