10000 Android embedding v2 by ened · Pull Request #274 · flutter-webrtc/flutter-webrtc · GitHub
[go: up one dir, main page]

Skip to content

Android embedding v2 #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions android/build.gradle
10000
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.android.tools.build:gradle:3.6.3'
}
}

Expand Down Expand Up @@ -41,6 +41,6 @@ android {
}

dependencies {
api 'org.webrtc:google-webrtc:1.0.28262'
implementation "androidx.annotation:annotation:1.0.1"
api 'org.webrtc:google-webrtc:1.0.30039'
implementation "androidx.annotation:annotation:1.1.0"
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
package com.cloudwebrtc.webrtc;

import java.nio.charset.Charset;
import android.util.Base64;
import com.cloudwebrtc.webrtc.utils.AnyThreadSink;
import com.cloudwebrtc.webrtc.utils.ConstraintsMap;

import org.webrtc.DataChannel;

import java.nio.charset.Charset;

import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.EventChannel;
import com.cloudwebrtc.webrtc.utils.AnyThreadSink;
import com.cloudwebrtc.webrtc.utils.ConstraintsMap;

class DataChannelObserver implements DataChannel.Observer, EventChannel.StreamHandler {

private final int mId;
private final DataChannel mDataChannel;
private final String peerConnectionId;
private final FlutterWebRTCPlugin plugin;

private EventChannel eventChannel;
private EventChannel.EventSink eventSink;

DataChannelObserver(FlutterWebRTCPlugin plugin, String peerConnectionId, int id, DataChannel dataChannel) {
this.peerConnectionId = peerConnectionId;
DataChannelObserver(BinaryMessenger messenger, String peerConnectionId, int id,
DataChannel dataChannel) {
mId = id;
mDataChannel = dataChannel;
this.plugin = plugin;
this.eventChannel =
new EventChannel(
plugin.registrar().messenger(),
"FlutterWebRTC/dataChannelEvent" + peerConnectionId + String.valueOf(id));
eventChannel =
new EventChannel(messenger, "FlutterWebRTC/dataChannelEvent" + peerConnectionId + id);
eventChannel.setStreamHandler(this);
}

Expand Down Expand Up @@ -53,7 +52,8 @@ public void onCancel(Object o) {
}

@Override
public void onBufferedAmountChange(long amount) { }
public void onBufferedAmountChange(long amount) {
}

@Override
public void onStateChange() {
Expand Down Expand Up @@ -89,8 +89,9 @@ public void onMessage(DataChannel.Buffer buffer) {
sendEvent(params);
}

void sendEvent(ConstraintsMap params) {
if(eventSink != null)
private void sendEvent(ConstraintsMap params) {
if (eventSink != null) {
eventSink.success(params.toMap());
}
}
}
Loading
0