第一次提交

This commit is contained in:
wangxiaowei
2025-06-11 10:21:51 +08:00
commit 52932d54b1
2341 changed files with 185283 additions and 0 deletions

66
common/agoraRtm.js Normal file
View File

@ -0,0 +1,66 @@
const AgoraRtmClientModule = uni.requireNativePlugin('AgoraRtm');
var agoraRtm = {
createInstance(params, callback) {
this.callMethod('createInstance', {
appId: params.appid
}, callback);
},
login(params, callback){
this.callMethod('login', {
token: params.token,
uid: params.uid
}, callback);
},
join(callback){
this.callMethod('join', null, callback);
},
createChannel(params, callback) {
this.callMethod('createChannel', {
channelId: params.channelId
}, callback);
},
sendMessage(params, callback) {
this.callMethod('sendMessage', {
message: params.message
}, callback);
},
getChannelMemberCount(params, callback) {
this.callMethod('getChannelMemberCount', {
channelIds: params.channelIds
}, callback);
},
getMembers(callback){
this.callMethod('getMembers', null, callback);
},
setupRemoteVideo(callback){
this.callMethod('setupRemoteVideo', null, callback);
},
logout(){
this.callMethod('logout', null);
},
release(params){
this.callMethod('release', {
channelId: params.channelId
});
},
callMethod(method, args, callback){
return new Promise((resolve, reject) => {
AgoraRtmClientModule.callMethod({
method: method,
args: args
}, res => {
console.log(res);
if (res && res.code) {
console.log('-------rtm reject--------method='+method);
reject(res);
} else {
console.log('-------rtm resolve--------method='+method);
resolve(res);
let resJson = JSON.parse(res);
callback && callback(resJson);
}
});
});
}
};
export default agoraRtm;