admin管理员组

文章数量:1125443

I'm trying to build a video calling feature in my Flutter app using Agora.

i am trying to use agora_rtc for video call , the black part above is camera where use can see him self, this feature works will on anroid but in ios appear black screen and no camera opened i setup all permissions for both ios and android anyone can help me with thatenter image description here My code is as follows:

import 'package:flutter/foundation.dart';
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
import 'package:permission_handler/permission_handler.dart';
import 'dart:async';
import 'package:flutter_svg/flutter_svg.dart';
class VideoChatWidget extends StatefulWidget {
  const VideoChatWidget({
    super.key,
    this.width,
    this.height,
    required this.channelName,
    required this.appId,
    required this.token,
    required this.userData,
  });

  final double? width;
  final double? height;
  final String channelName;
  final String appId;
  final String token;
  final ChatsStruct userData;

  @override
  State<VideoChatWidget> createState() => _VideoChatWidgetState();
}

class _VideoChatWidgetState extends State<VideoChatWidget> {
  bool isCameraOff = false;
  bool isMuted = false;
  late RtcEngine _engine;
  bool _localUserJoined = true;
  int? _remoteUid;
  Timer? _callTimer;
  Duration _callDuration = Duration(seconds: 0);

  @override
  void initState() {
    super.initState();
    initializeAgora();
    _startCallTimer();
  }

  Future<void> initializeAgora() async {
    if (!kIsWeb) {
      final permissions =
          await [Permission.microphone, Permission.camera].request();
      if (permissions.values
          .any((status) => status != PermissionStatus.granted)) {
        print("Permissions not granted");
        return;
      }
    }

    print('

本文标签: flutterAgorartc camera isnot work on ios deviceStack Overflow