8000 Merge pull request #2 from cloudwebrtc/master · hicodeboy/flutter-webrtc@b0228d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit b0228d3

Browse files
authored
Merge pull request #2 from cloudwebrtc/master
同步主项目
2 parents 6ec6f7f + 119be9f commit b0228d3

31 files changed

+2776
-2440
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
## Changelog
22

33
--------------------------------------------
4+
[0.2.8] - 2020.04.22
5+
6+
* [macOS/iOS] Fix typo in render size change check condition.
7+
* [macOS] Fix hot restart videoCapturer crash.
8+
* [Android] Fix Android crash when getUserVideo.
9+
410
[0.2.7] - 2020.03.15
511

612
* [macOS] Fix crash with H264 HW Encoder.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,13 @@ android {
5555
}
5656
```
5757

58+
If necessary, in the same `build.gradle` you will need to increase `minSdkVersion` of `defaultConfig` up to `18` (currently default Flutter generator set it to `16`).
59+
5860
## Contributing
5961
The project is inseparable from the contributors of the community.
6062
- [CloudWebRTC](https://github.com/cloudwebrtc) - Original Author
61-
- [RainwayApp](https://github.com/rainwayapp) - Sponsor from Paypal
63+
- [RainwayApp](https://github.com/rainwayapp) - Sponsor
64+
- [亢少军](https://github.com/kangshaojun) - Sponsor
6265

6366
### Example
6467
For more examples, please refer to [flutter-webrtc-demo](https://github.com/cloudwebrtc/flutter-webrtc-demo/).

android/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.3.1'
11+
classpath 'com.android.tools.build:gradle:3.6.3'
1212
}
1313
}
1414

@@ -27,6 +27,7 @@ android {
2727
defaultConfig {
2828
minSdkVersion 18
2929
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
30+
consumerProguardFiles 'proguard-rules.pro'
3031
}
3132

3233
lintOptions {
@@ -40,6 +41,6 @@ android {
4041
}
4142

4243
dependencies {
43-
api 'org.webrtc:google-webrtc:1.0.28262'
44-
implementation "androidx.annotation:annotation:1.0.1"
44+
api 'org.webrtc:google-webrtc:1.0.30039'
45+
implementation "androidx.annotation:annotation:1.1.0"
4546
}

android/proguard-rules.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Flutter WebRTC
2+
-keep class com.cloudwebrtc.webrtc.** { *; }
3+
-keep class org.webrtc.** { *; }

android/src/main/java/com/cloudwebrtc/webrtc/DataChannelObserver.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
package com.cloudwebrtc.webrtc;
22

3-
import java.nio.charset.Charset;
4-
import android.util.Base64;
3+
import com.cloudwebrtc.webrtc.utils.AnyThreadSink;
4+
import com.cloudwebrtc.webrtc.utils.ConstraintsMap;
55

66
import org.webrtc.DataChannel;
7+
8+
import java.nio.charset.Charset;
9+
10+
import io.flutter.plugin.common.BinaryMessenger;
711
import io.flutter.plugin.common.EventChannel;
8-
import com.cloudwebrtc.webrtc.utils.AnyThreadSink;
9-
import com.cloudwebrtc.webrtc.utils.ConstraintsMap;
1012

1113
class DataChannelObserver implements DataChannel.Observer, EventChannel.StreamHandler {
14+
1215
private final int mId;
1316
private final DataChannel mDataChannel;
14-
private final String peerConnectionId;
15-
private final FlutterWebRTCPlugin plugin;
17+
1618
private EventChannel eventChannel;
1719
private EventChannel.EventSink eventSink;
1820

19-
DataChannelObserver(FlutterWebRTCPlugin plugin, String peerConnectionId, int id, DataChannel dataChannel) {
20-
this.peerConnectionId = peerConnectionId;
21+
DataChannelObserver(BinaryMessenger messenger, String peerConnectionId, int id,
22+
DataChannel dataChannel) {
2123
mId = id;
2224
mDataChannel = dataChannel;
23-
this.plugin = plugin;
24-
this.eventChannel =
25-
new EventChannel(
26-
plugin.registrar().messenger(),
27-
"FlutterWebRTC/dataChannelEvent" + String.valueOf(id));
25+
eventChannel =
26+
new EventChannel(messenger, "FlutterWebRTC/dataChannelEvent" + peerConnectionId + id);
2827
eventChannel.setStreamHandler(this);
2928
}
3029

@@ -53,7 +52,8 @@ public void onCancel(Object o) {
5352
}
5453

5554
@Override
56-
public void onBufferedAmountChange(long amount) { }
55+
public void onBufferedAmountChange(long amount) {
56+
}
5757

5858
@Override
5959
public void onStateChange() {
@@ -89,8 +89,9 @@ public void onMessage(DataChannel.Buffer buffer) {
8989
sendEvent(params);
9090
}
9191

92-
void sendEvent(ConstraintsMap params) {
93-
if(eventSink != null)
92+
private void sendEvent(ConstraintsMap params) {
93+
if (eventSink != null) {
9494
eventSink.success(params.toMap());
95+
}
9596
}
9697
}

0 commit comments

Comments
 (0)
0