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';
let musicFilePath = '';
uni.saveFile({
tempFilePath: tempFilePath,
success: (res) => {
console.warn(JSON.stringify(res));
musicFilePath = res.savedFilePath;
musicFilePath = plus.io.convertLocalFileSystemURL(musicFilePath);
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);
Was this page helpful?