File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
android/src/main/java/com/cloudwebrtc/webrtc/utils Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .cloudwebrtc .webrtc .utils ;
2
+
3
+ import android .os .Handler ;
4
+ import android .os .Looper ;
5
+
6
+ import io .flutter .plugin .common .EventChannel ;
7
+
8
+ public final class AnyThreadSink implements EventChannel .EventSink {
9
+ private final EventChannel .EventSink eventSink ;
10
+
11
+ public AnyThreadSink (EventChannel .EventSink eventSink ) {
12
+ this .eventSink = eventSink ;
13
+ }
14
+
15
+ @ Override
16
+ public void success (Object o ) {
17
+ final Handler handler = new Handler (Looper .getMainLooper ());
18
+ handler .post (()->eventSink .success (o ));
19
+ }
20
+
21
+ @ Override
22
+ public void error (String s , String s1 , Object o ) {
23
+ final Handler handler = new Handler (Looper .getMainLooper ());
24
+ handler .post (()->eventSink .error (s , s1 , o ));
25
+
5A1F
span> }
26
+
27
+ @ Override
28
+ public void endOfStream () {
29
+ final Handler handler = new Handler (Looper .getMainLooper ());
30
+ handler .post (eventSink ::endOfStream );
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments