Skip to content

Commit 554a240

Browse files
author
Jessica Palmer
authored
Merge pull request #98 from red5pro/revert-96-develop
Revert "Develop"
2 parents dc02c76 + fb455f5 commit 554a240

File tree

1 file changed

+4
-43
lines changed

1 file changed

+4
-43
lines changed

app/src/main/java/red5pro/org/testandroidproject/tests/SubscribeReconnectTest/SubscribeReconnectTest.java

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.red5pro.streaming.event.R5ConnectionEvent;
2020
import com.red5pro.streaming.event.R5ConnectionListener;
2121
import com.red5pro.streaming.source.R5Camera;
22-
import com.red5pro.streaming.view.R5VideoView;
2322

2423
import java.util.concurrent.ExecutionException;
2524

@@ -33,7 +32,6 @@ public class SubscribeReconnectTest extends SubscribeTest {
3332

3433

3534
public boolean stopped = false;
36-
public int reconnectDelay = 5;
3735

3836
@Override
3937
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -55,30 +53,10 @@ public boolean onTouch(View v, MotionEvent event) {
5553
return view;
5654
}
5755

58-
protected void reconnect () {
59-
Subscribe();
60-
SetupListener();
61-
}
62-
63-
protected void delayReconnect (int delay) {
64-
65-
final SubscribeReconnectTest subscribeTest = this;
66-
Handler h = new Handler(Looper.getMainLooper());
67-
h.postDelayed(new Runnable() {
68-
@Override
69-
public void run() {
70-
subscribeTest.reconnect();
71-
}
72-
}, delay);
73-
74-
}
7556

7657
public void SetupListener(){
7758

78-
final SubscribeReconnectTest subscribeTest = this;
7959
final R5ConnectionListener additionalListener = this;
80-
final R5Stream subscriber = this.subscribe;
81-
final R5VideoView view = this.display;
8260

8361
subscribe.setListener(new R5ConnectionListener() {
8462
@Override
@@ -89,36 +67,19 @@ public void onConnectionEvent(R5ConnectionEvent r5ConnectionEvent) {
8967

9068
if (r5ConnectionEvent == R5ConnectionEvent.CLOSE && !SubscribeReconnectTest.this.stopped) {
9169

70+
9271
Handler h = new Handler(Looper.getMainLooper());
9372
h.postDelayed(new Runnable() {
9473
@Override
9574
public void run() {
9675

9776
if(!stopped) {
98-
reconnectDelay = 5;
99-
subscribeTest.reconnect();
77+
Subscribe();
78+
SetupListener();
10079
}
10180

10281
}
103-
}, reconnectDelay);
104-
105-
}
106-
else if (r5ConnectionEvent == R5ConnectionEvent.NET_STATUS && r5ConnectionEvent.message.equals("NetStream.Play.UnpublishNotify")) {
107-
108-
reconnectDelay = 1000;
109-
Handler h = new Handler(Looper.getMainLooper());
110-
111-
h.postDelayed(new Runnable() {
112-
@Override
113-
public void run() {
114-
115-
subscriber.setListener(null);
116-
subscriber.stop();
117-
view.attachStream(null);
118-
subscribeTest.delayReconnect(reconnectDelay);
119-
120-
}
121-
}, reconnectDelay);
82+
}, 5);
12283

12384
}
12485
}

0 commit comments

Comments
 (0)