Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
移除自动新建数据流通道的支持,以便使用者按需自主创建
  • Loading branch information
Riant committed Feb 27, 2018
commit ea9b02e923cc60e77093aebb64258d6f36dfd0bb
4 changes: 1 addition & 3 deletions android/src/main/java/com/syan/agora/AgoraModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static com.facebook.react.bridge.UiThreadUtil.runOnUiThread;

public class AgoraModule extends ReactContextBaseJavaModule {
private int defaultStreamId = -1;

public AgoraModule(ReactApplicationContext context) {

Expand Down Expand Up @@ -206,7 +205,6 @@ public void run() {
@ReactMethod
public void init(ReadableMap options) {
AgoraManager.getInstance().init(getReactApplicationContext(), mRtcEventHandler, options);
this.defaultStreamId = AgoraManager.getInstance().mRtcEngine.createDataStream(false, false);
}

//进入房间
Expand Down Expand Up @@ -375,7 +373,7 @@ public void createDataStream(boolean reliable, boolean ordered, Callback callbac
// 发送数据
@ReactMethod
public void sendStreamMessage(int streamId, String message, Callback onError) {
onError.invoke(AgoraManager.getInstance().mRtcEngine.sendStreamMessage(streamId > 0 ? streamId : this.defaultStreamId, message.getBytes()));
onError.invoke(AgoraManager.getInstance().mRtcEngine.sendStreamMessage(streamId, message.getBytes()));
}

//销毁引擎实例
Expand Down
7 changes: 1 addition & 6 deletions ios/RCTAgora/RCTAgora.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ - (NSDictionary *)constantsToExport {
return @{};
}

NSInteger defaultDataStreamId = -1;

/**
* 初始化AgoraKit
*
Expand Down Expand Up @@ -64,9 +62,6 @@ - (NSDictionary *)constantsToExport {
[self.rtcEngine setVideoProfile:[options[@"videoProfile"] integerValue]swapWidthAndHeight:[options[@"swapWidthAndHeight"]boolValue]];
[self.rtcEngine setClientRole:[options[@"clientRole"] integerValue] withKey:nil];

// 创建默认数据通道
[self.rtcEngine createDataStream:&dataChannelId reliable:0 ordered:0];

//Agora Native SDK 与 Agora Web SDK 间的互通
[self.rtcEngine enableWebSdkInteroperability:YES];

Expand Down Expand Up @@ -255,7 +250,7 @@ - (NSDictionary *)constantsToExport {
发送数据流
*/
RCT_EXPORT_METHOD(sendStreamMessage:(NSInteger)streamId data:(NSData*)data callback:(RCTResponseSenderBlock)callback){
  int err = [self.rtcEngine sendStreamMessage:(streamId > 0 ? streamId : defaultDataStreamId) data:data];
  int err = [self.rtcEngine sendStreamMessage:(streamId) data:data];
  callback(@[[NSNumber numberWithInteger:err]]);
}

Expand Down