Resume sound playback||doc135621

September 20, 2022

Format

 TdAudioEngine:resumeSound(nSoundId) 

Description

Resume playing the sound effect corresponding to the sound effect Id.


Precautions

To resume playback of a sound effect, you must first obtain the id number of the sound effect. So this function should be matched with the playback function of the sound effectplay3dSoundorplay2dSoundto use. At the same time, we also need to call the pause functionpauseSoundCome and pause the sound effect first, and in order to determine whether the sound effect has been resumed, callisPlayingCheck the return value.


Parameters

Variable name type Description
nSoundId int sound effect id


Code Samples

local TdAudioEngine = TdAudioEngine.Instance()
local soundID = TdAudioEngine:play2dSound("asset/Audio/Sound/click.mp3", true)
TdAudioEngine:pauseSound(soundID)
print(TdAudioEngine:isPlaying(soundID))
TdAudioEngine:resumeSound(soundID)
print(TdAudioEngine:isPlaying(soundID))
end