agora_rtc_wrapper 0.0.4 copy "agora_rtc_wrapper: ^0.0.4" to clipboard
agora_rtc_wrapper: ^0.0.4 copied to clipboard

outdated

Simple wrapper utils for agora rtc implementation in flutter

example/example.dart

import 'package:agora_rtc_wrapper/agora_rtc_wrapper.dart';
import 'package:flutter/material.dart';

/// Created by taohid on 15,May, 2020
/// Email: taohid32@gmail.com

class VideoCallScreen extends StatefulWidget {
  final String channelId;

  VideoCallScreen({@required this.channelId});

  @override
  _VideoCallScreenState createState() => _VideoCallScreenState();
}

class _VideoCallScreenState extends State<VideoCallScreen> {
  int joinedUId = -1;

  @override
  void initState() {
    super.initState();
    AgoraRtcWrapper.instance.init('Your Agora App Id');
    AgoraRtcWrapper.instance.listen(onUserJoined: _onUserJoined);
    if (widget.channelId != null && widget.channelId.isNotEmpty) {
      AgoraRtcWrapper.instance.joinChannel(widget.channelId);
    }
  }

  void _onUserJoined(int uid, int elapsed) {
    setState(() {
      joinedUId = uid;
    });
  }

  @override
  void dispose() {
    AgoraRtcWrapper.instance.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black,
      appBar: AppBar(
        title: Text('Video Call Test'),
      ),
      body: Stack(
        children: <Widget>[
          joinedUId != -1
              ? AgoraRtcWrapper.instance.getVideoView(joinedUId)
              : Container(),
          Positioned(
            right: 0,
            child: SizedBox(
              height: 180,
              width: 150,
              child: AgoraRtcWrapper.instance.getSelfVideoView,
            ),
          ),
          AgoraRtcWrapper.instance.getDefaultController(
            onCallEnd: () {
              Navigator.pop(context);
            },
            onMute: (isMute) {
              setState(() {
                AgoraRtcWrapper.instance.muteAudio(!isMute);
              });
            },
          )
        ],
      ),
    );
  }
}
0
likes
0
pub points
0%
popularity

Publisher

verified publisherdeepqtech.com

Simple wrapper utils for agora rtc implementation in flutter

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

agora_rtc_engine, flutter

More

Packages that depend on agora_rtc_wrapper