Skip to content
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

Attempt to invoke virtual method 'android.view.ViewParent android.widget.FrameLayout.getParent()' on a null object reference #5

Closed
rohitrvayuz opened this issue Nov 27, 2021 · 1 comment

Comments

@rohitrvayuz
Copy link

rohitrvayuz commented Nov 27, 2021

This error comes on Android only. Works fine on iOS.

When I initiate or join a video call from Android for the very first time, then everything works fine. I am able to see the remote video as well as local video. But if I disconnect and try to initiate/join the call the 2nd time then I am not able to view my local video and it throws this error in the log.

Android 9, 10

Flutter Version - 2.5.3

enx_flutter_plugin: ^1.9.4

I use EnxRtc.disconnect(); to disconnect from the call.

This works fine on iOS but throws this exception on Android only


onEventInfo

[onEventInfo] {msg: Invaid Frame Rate, result: 5088, desc: Failed to initiate stream with invalid Frame Rate. Max Frame Rate is 30}


_addEnxrtcEventHandlers

`
void _addEnxrtcEventHandlers() async {
EnxRtc.onRoomConnected = (Map<dynamic, dynamic> map) async {
log('${map.toString()}', name: 'onRoomConnected', error: map);

  setState(() {
    EnxRtc.publish();
  });
};

EnxRtc.onRemoteStreamAudioMute = (Map<dynamic, dynamic> map) {
  log('onRemoteStreamAudioMute',
      name: 'onRemoteStreamAudioMute', error: map.toString());
  setState(() {
    try {
      isRemoteAudioMuted = map['user']['audioMuted'];
    } catch (e) {}
  });
  showFlushBar(
    context,
    0,
    '$otherUserName muted their audio',
    durationInMilliseconds: flushbarDurationInMilliseconds,
    flushbarPosition: FlushbarPosition.TOP,
  );
};

EnxRtc.onRemoteStreamAudioUnMute = (Map<dynamic, dynamic> map) {
  log('onRemoteStreamAudioUnMute',
      name: 'onRemoteStreamAudioUnMute', error: map.toString());
  setState(() {
    try {
      isRemoteAudioMuted = map['user']['audioMuted'];
    } catch (e) {}
    showFlushBar(
      context,
      1,
      '$otherUserName unmuted their audio',
      durationInMilliseconds: flushbarDurationInMilliseconds,
      flushbarPosition: FlushbarPosition.TOP,
    );
  });
};
EnxRtc.onRemoteStreamVideoMute = (Map<dynamic, dynamic> map) {
  setState(() {
    try {
      isRemoteVideoMuted = map['user']['videoMuted'];
    } catch (e) {}

    log('onRemoteStreamVideoMute',
        name: 'onRemoteStreamVideoMute', error: map.toString());
  });
  showFlushBar(
    context,
    0,
    '$otherUserName stopped their video',
    durationInMilliseconds: flushbarDurationInMilliseconds,
    flushbarPosition: FlushbarPosition.TOP,
  );
};

EnxRtc.onRemoteStreamVideoUnMute = (Map<dynamic, dynamic> map) {
  setState(() {
    try {
      isRemoteVideoMuted = map['user']['videoMuted'];
    } catch (e) {}
    log('${map['user']['videoMuted']}',
        name: 'onRemoteStreamVideoUnMute', error: map.toString());
  });
};

EnxRtc.onRoomError = (Map<dynamic, dynamic> map) {
  setState(() {
    log('onRoomError', name: 'onRoomError', error: map.toString());
  });
};

EnxRtc.onRoomDisConnected = (Map<dynamic, dynamic> map) {
  log(map.toString(), name: 'onRoomDisConnected');
};

EnxRtc.onConnectionLost = (Map<dynamic, dynamic> map) {
  // In case connection lost due to internet lose
  setState(() {});
};

EnxRtc.onConnectionInterrupted = (Map<dynamic, dynamic> map) {
  // In case any interruption in connection
  setState(() {});
};

EnxRtc.onUserReconnectSuccess = (Map<dynamic, dynamic> map) {
  // When reconnect done successfully
  setState(() {});
};

EnxRtc.onPublishedStream = (Map<dynamic, dynamic> map) async {
  log(map.toString(), name: 'onPublishedStream');
  setState(() {
    EnxRtc.setupVideo(0, 0, true, 300, 200);
  });
};

EnxRtc.onStreamAdded = (Map<dynamic, dynamic> map) async {
  log(map.toString(), name: 'onStreamAdded');

  try {
    EnxRtc.switchMediaDevice('Speaker');
  } catch (e) {
    log('', name: 'onStreamAdded switch error', error: e);
  }

  String streamId = '';
  setState(() {
    streamId = map['streamId'];
  });
  EnxRtc.subscribe(streamId);
};

EnxRtc.onNotifyDeviceUpdate = (String deviceName) {
  log(deviceName, name: 'onNotifyDeviceUpdate');
  setState(() {});
};

EnxRtc.onActiveTalkerList = (Map<dynamic, dynamic> map) {
  log(map.toString(), name: 'onActiveTalkerList');
  final items = (map['activeList'] as List)
      .map((i) => new ActiveListModel.fromJson(i));
  if (items.length > 0) {
    setState(() {
      for (final item in items) {
        if (!_remoteUsers.contains(item.streamId)) {
          log(
            '_remoteUsers \n' + map.toString(),
            name: 'onActiveTalkerList',
          );
          _remoteUsers.add(item.streamId);
        }
      }
    });
  }
};

EnxRtc.onEventError = (Map<dynamic, dynamic> map) {
  setState(() {
    log(
      'onEventError',
      name: 'onEventError',
      error: map.toString(),
    );
  });
};

EnxRtc.onEventInfo = (Map<dynamic, dynamic> map) {
  log(map.toString(), name: 'onEventInfo');
  setState(() {});
};

EnxRtc.onUserConnected = (Map<dynamic, dynamic> map) {
  log(map.toString(), name: 'onUserConnected');
  otherUserName = map['name'];
  setState(() {
    didUserJoinCall = true;
    showFlushBar(
      context,
      1,
      '$otherUserName has joined the call',
      durationInMilliseconds: flushbarDurationInMilliseconds,
      flushbarPosition: FlushbarPosition.TOP,
    );
  });
};

EnxRtc.onUserDisConnected = (Map<dynamic, dynamic> map) async {
  log(map.toString(), name: 'onUserDisConnected');
  setState(() {
    _showAlert(
        context: context, message: '${map['name']} disconnected call');
  });
};

EnxRtc.onAudioEvent = (Map<dynamic, dynamic> map) {
  log(map.toString(), name: 'onAudioEvent');
  setState(() {
    if (map['msg'].toString().toLowerCase() == "audio off") {
      isAudioMuted = true;
    } else {
      isAudioMuted = false;
    }
  });
};

EnxRtc.onVideoEvent = (Map<dynamic, dynamic> map) {
  log(map.toString(), name: 'onVideoEvent');
  setState(() {
    if (map['msg'].toString().toLowerCase() == "video off") {
      isVideoMuted = true;
    } else {
      isVideoMuted = false;
    }
  });
};

}
`


disconnectRoom

EnxRtc.disconnect()


@jaykumarvcx @subratthayal @Vinodrajbhar @abhiramsk

@pankajpandeyvcx
Copy link
Contributor

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants