Skip to content

Commit

Permalink
Merge pull request #19 from a1528zhang/master
Browse files Browse the repository at this point in the history
 增加onVideoMute 和 onAudioMute回调
  • Loading branch information
syanbo authored Sep 29, 2018
2 parents 63b18bb + 90c46b2 commit ed3ebe0
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
34 changes: 34 additions & 0 deletions android/src/main/java/com/syan/agora/AgoraModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,40 @@ public void run() {
}
});
}

/**
* 用户mute音频回调
*/
@Override
public void onUserMuteAudio(final int uid, boolean muted) {
runOnUiThread(new Runnable() {
@Override
public void run() {
WritableMap map = Arguments.createMap();
map.putString("type", "onUserMuteAudio");
map.putInt("uid", uid);
map.putBoolean("muted", muted);
commonEvent(map);
}
});
}

/**
* 用户mute视频回调
*/
@Override
public void onUserMuteVideo(final int uid, boolean muted) {
runOnUiThread(new Runnable() {
@Override
public void run() {
WritableMap map = Arguments.createMap();
map.putString("type", "onUserMuteVideo");
map.putInt("uid", uid);
map.putBoolean("muted", muted);
commonEvent(map);
}
});
}
};

@ReactMethod
Expand Down
24 changes: 24 additions & 0 deletions ios/RCTAgora/RCTAgora.m
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,30 @@ - (void)rtcEngine:(AgoraRtcEngineKit *)engine didOfflineOfUid:(NSUInteger)uid re
[self sendEvent:params];
}

/*
用户mute音频回调
*/
- (void)rtcEngine:(AgoraRtcEngineKit *)engine didAudioMuted:(BOOL)muted byUid:(NSUInteger)uid {
NSMutableDictionary *params = @{}.mutableCopy;
params[@"type"] = @"onUserMuteAudio";
params[@"uid"] = [NSNumber numberWithInteger:uid];;
params[@"muted"] = @(muted);

[self sendEvent:params];
}

/*
用户mute视频回调
*/
- (void)rtcEngine:(AgoraRtcEngineKit *)engine didVideoMuted:(BOOL)muted byUid:(NSUInteger)uid {
NSMutableDictionary *params = @{}.mutableCopy;
params[@"type"] = @"onUserMuteVideo";
params[@"uid"] = [NSNumber numberWithInteger:uid];;
params[@"muted"] = @(muted);

[self sendEvent:params];
}

/*
音量提示回调
需要开启enableAudioVolumeIndication
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-agora",
"version": "1.1.1",
"version": "1.1.2",
"description": "声网Agora",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


0 comments on commit ed3ebe0

Please sign in to comment.