TRTCMusicEvent

TRTCMusicEvent

Music event

Type Definitions

onStart(idopt, errCodeopt)

Parameters:
Name Type Description
id number

Background music ID

errCode number

0: Start playing successfully; -4001: Failed to open the file, such as the audio file format is not supported, the local audio file does not exist, the network audio file cannot be accessed, etc.

onPlayProgress(idopt, curPtsMSopt, durationMSopt)

Parameters:
Name Type Description
id number

Background music ID

curPtsMS Number

current playing timestamp in ms

durationMS Number

music duration time in ms

onComplete(idopt, errCodeopt)

Parameters:
Name Type Description
id number

Background music ID

errCode number

0: End of play; -4002: Decoding failure, such as audio file corruption, inaccessible network audio file server, etc.