Przeglądaj źródła

add screen stream listener

x1ongzhu 6 lat temu
rodzic
commit
65218265d3

+ 60 - 0
android/app/src/main/java/com/izouma/mobilecybergames/ScreenStreamPlugin.java

@@ -12,7 +12,10 @@ import android.widget.Toast;
 import com.alivc.live.pusher.AlivcAudioAACProfileEnum;
 import com.alivc.live.pusher.AlivcFpsEnum;
 import com.alivc.live.pusher.AlivcLivePushConfig;
+import com.alivc.live.pusher.AlivcLivePushError;
+import com.alivc.live.pusher.AlivcLivePushErrorListener;
 import com.alivc.live.pusher.AlivcLivePushInfoListener;
+import com.alivc.live.pusher.AlivcLivePushNetworkListener;
 import com.alivc.live.pusher.AlivcLivePusher;
 import com.alivc.live.pusher.AlivcPreviewOrientationEnum;
 import com.alivc.live.pusher.AlivcResolutionEnum;
@@ -182,6 +185,63 @@ public class ScreenStreamPlugin implements MethodChannel.MethodCallHandler, Plug
                 Log.d(TAG, "onAdjustFps");
             }
         });
+        mAlivcLivePusher.setLivePushErrorListener(new AlivcLivePushErrorListener() {
+            @Override
+            public void onSystemError(AlivcLivePusher alivcLivePusher, AlivcLivePushError alivcLivePushError) {
+                Log.d(TAG, "onSystemError\n" + alivcLivePushError.getMsg());
+            }
+
+            @Override
+            public void onSDKError(AlivcLivePusher alivcLivePusher, AlivcLivePushError alivcLivePushError) {
+                Log.d(TAG, "onSDKError\n" + alivcLivePushError.getMsg());
+            }
+        });
+        mAlivcLivePusher.setLivePushNetworkListener(new AlivcLivePushNetworkListener() {
+            @Override
+            public void onNetworkPoor(AlivcLivePusher alivcLivePusher) {
+
+            }
+
+            @Override
+            public void onNetworkRecovery(AlivcLivePusher alivcLivePusher) {
+
+            }
+
+            @Override
+            public void onReconnectStart(AlivcLivePusher alivcLivePusher) {
+
+            }
+
+            @Override
+            public void onReconnectFail(AlivcLivePusher alivcLivePusher) {
+                Log.e(TAG, "onReconnectFail");
+            }
+
+            @Override
+            public void onReconnectSucceed(AlivcLivePusher alivcLivePusher) {
+
+            }
+
+            @Override
+            public void onSendDataTimeout(AlivcLivePusher alivcLivePusher) {
+
+            }
+
+            @Override
+            public void onConnectFail(AlivcLivePusher alivcLivePusher) {
+                Log.e(TAG, "onConnectFail");
+            }
+
+            @Override
+            public String onPushURLAuthenticationOverdue(AlivcLivePusher alivcLivePusher) {
+                return null;
+            }
+
+            @Override
+            public void onSendMessage(AlivcLivePusher alivcLivePusher) {
+
+            }
+        });
 
         mAlivcLivePusher.startPreview(null);
         mAlivcLivePusher.startPush(url);

+ 1 - 0
lib/pages/setting.dart

@@ -90,6 +90,7 @@ class SettingState extends State<Setting> {
                                       context, new CupertinoPageRoute(builder: (context) => new ChangeUserInfo(title: '昵称', val: userInfo.nickname)));
                                   if (success) {
                                     Toast.show(context, '修改成功', 1500, 'success');
+                                    getUserInfo();
                                   }
                                 }),
                                 _cell('性别', userInfo.sex, placeholder: '请添加性别信息', onTap: () {