製品アップデート情報
Tencent Cloudオーディオビデオ端末SDKの再生アップグレードおよび承認チェック追加に関するお知らせ
TRTCアプリケーションのサブスクリプションパッケージサービスのリリースに関する説明について
RTC Room Engine SDK to implement relevant features of background music.RTC Room Engine SDK, you need to log in to the SDK first.startPlayMusic and stopPlayMusic two APIs.startPlayMusic to start playing background music, you need to input a parameter in types of TXAudioMusicParam to set playback control information. TXAudioMusicParam contains following information, which you can set separately:Enumeration Types | Description |
id | Field Meaning: Music ID. Special Instructions: The SDK allows playback of multiple music streams. Therefore, IDs are required for tagging to control the start, stop, and volume of the music. |
endTimeMS | Field Meaning: Music end playback time point, in milliseconds, with 0 indicating playback to the end of the file. |
isShortFile | Field Meaning: Whether the playback is a short music file. Recommended Value: YES: Short music files that need to be repeated. NO: Normal music file. Default value: NO. |
loopCount | Field Meaning: Number of music loops. Recommended Value: The value range is from 0 to any positive integer. The default value is 0. 0 means play the music once; 1 means play the music twice; and so on. |
path | Field Meaning: Complete path or URL address of the sound effect file. Supported audio formats include MP3, AAC, M4A, WAV. |
publish | Field Meaning: Whether to transmit music to remote end. Recommended Value: YES: The music can be played locally while the remote user can also hear it. NO: The anchor can only hear the music locally, and the remote audience cannot hear it. Default value: NO. |
startTimeMS | Field Meaning: Music start playback time point, in milliseconds. |
startPlayMusic and stopPlayMusic two APIs.startPlayMusic to start playing background music, you need to input a parameter in types of AudioMusicParam to set playback control information. AudioMusicParam contains following information, which you can set separately:Enumeration Types | Description |
id | Field Meaning: Music ID. Special Instructions: The SDK allows playback of multiple music streams. Therefore, IDs are required for tagging to control the start, stop, and volume of the music. |
endTimeMS | Field Meaning: Music end playback time point, in milliseconds, with 0 indicating playback to the end of the file. |
isShortFile | Field Meaning: Whether the playback is a short music file. Recommended Value: YES: Short music files that need to be repeated. NO: Normal music file. Default value: NO. |
loopCount | Field Meaning: Number of music loops. Recommended Value: The value range is from 0 to any positive integer. The default value is 0. 0 means play the music once; 1 means play the music twice; and so on. |
path | Field Meaning: Complete path or URL address of the sound effect file. Supported audio formats include MP3, AAC, M4A, WAV. |
publish | Field Meaning: Whether to transmit music to remote end. Recommended Value: YES: The music can be played locally while the remote user can also hear it. NO: The anchor can only hear the music locally, and the remote audience cannot hear it. Default value: NO. |
startTimeMS | Field Meaning: Music start playback time point, in milliseconds. |
import RTCRoomEngineimport TXLiteAVSDK_Professionallet audioEffectManager = TUIRoomEngine.sharedInstance().getTRTCCloud().getAudioEffectManager()// Start background music playback.let musicParam = TXAudioMusicParam()musicParam.id = 0 // Replace with your own Music IDmusicParam.path = "path" // Replace with the full path or URL address of the music filemusicParam.publish = true // Transmit music to remote endmusicParam.loopCount = 0 // Replace with the number of times you need to loop playbackaudioEffectManager.startPlayMusic(musicParam) { code inif code == 0 {// Playback started successfully} else {// Playback start failed.}} onProgress: { progress, duration in// Playback progress callback.} onComplete: { _ in// Playback end callback.}// Stop background music playback.audioEffectManager.stopPlayMusic(musicId) // Replace with the Music ID you need to stop.
TXAudioEffectManager audioEffectManager = TUIRoomEngine.sharedInstance().getTRTCCloud().getAudioEffectManager();int id = 0; // Replace with your own Music IDString path = "path"; // Replace with the full path or URL address of the music file.// Start background music playback.TXAudioEffectManager.AudioMusicParam musicParam = new TXAudioEffectManager.AudioMusicParam(id, path);musicParam.publish = true; // Transmit music to remote end.musicParam.loopCount = 0; // Replace with the number of times you need to loop playback.audioEffectManager.startPlayMusic(musicParam);// Stop background music playback.audioEffectManager.stopPlayMusic(id); // Replace with the Music ID you need to stop.
setAllMusicVolume API and passing an Int value.setAllMusicVolume to set the background music volume:import RTCRoomEngineimport TXLiteAVSDK_Professionallet audioEffectManager = TUIRoomEngine.sharedInstance().getTRTCCloud().getAudioEffectManager()let volume = 60 // Replace with the volume you need to setaudioEffectManager.setAllMusicVolume(volume)
TXAudioEffectManager audioEffectManager = TUIRoomEngine.sharedInstance().getTRTCCloud().getAudioEffectManager();int volume = 60; // Replace with the volume you need to setaudioEffectManager.setAllMusicVolume(volume);
フィードバック