이 페이지는 현재 영어로만 제공되며 한국어 버전은 곧 제공될 예정입니다. 기다려 주셔서 감사드립니다.

uni-app (Anroid&iOS)

This article introduces how to use the custom ringtone and silent incoming call ringtone feature from the definition.

Customize Incoming Call Ringtone

Setting Custom incoming call ringtone, here only local file addresses can be passed in, it is required to ensure the file directory is accessible by the application.
const TUICallKit = uni.requireNativePlugin('TencentCloud-TUICallKit');

const tempFilePath = './static/rain.mp3'; // Locally stored audio files
let musicFilePath = '';
uni.saveFile({
tempFilePath: tempFilePath,
success: (res) => {
console.warn(JSON.stringify(res));
musicFilePath = res.savedFilePath;
musicFilePath = plus.io.convertLocalFileSystemURL(musicFilePath);
// Set ringtone
TUICallKit.setCallingBell(musicFilePath, (res) => {
if (res.code === 0) {
console.log('setCallingBell success');
} else {
console.log(`setCallingBell failed, error message = ${res.msg}`);
}
});
},
fail: (err) => {
console.error(err);
},
});

Silent incoming call ringtone

Enable/Disable incoming call ringtone.
After enabling, the incoming call ringtone will not be played when a call request is received.
const TUICallKit = uni.requireNativePlugin('TencentCloud-TUICallKit');
const enable = true;
TUICallKit.enableMuteMode(enable);