【问题标题】:How to implement 17 host with agora io in flutter?如何在flutter中用agora io实现17台主机?
【发布时间】:2020-04-04 03:02:11
【问题描述】:

我试过 agora Flutter 快速入门,真的很不错。

但是 agora 说一个频道可以有 17 位主持人。如何实现它的最佳实践?

这是示例中的布局:

Widget _viewRows() {
final views = _getRenderViews();
switch (views.length) {
  case 1:
    return Container(
        child: Column(
      children: <Widget>[_videoView(views[0])],
    ));
  case 2:
    return Container(
        child: Column(
      children: <Widget>[
        _expandedVideoRow([views[0]]),
        _expandedVideoRow([views[1]])
      ],
    ));
  case 3:
    return Container(
        child: Column(
      children: <Widget>[
        _expandedVideoRow(views.sublist(0, 2)),
        _expandedVideoRow(views.sublist(2, 3))
      ],
    ));
  case 4:
    return Container(
        child: Column(
      children: <Widget>[
        _expandedVideoRow(views.sublist(0, 2)),
        _expandedVideoRow(views.sublist(2, 4))
      ],
    ));
  default:
}
return Container();

}

我想再添加多达 13 个视图以优化来自 agora 的视频会议功能。提前致谢!

【问题讨论】:

    标签: flutter dart agora.io


    【解决方案1】:

    Agora video sdk 最多同时支持 7 人(最多支持 25 人的视频正在开发中)。

    如果你想在你的信息流中添加超过 4 个人,你可以简单地扩展 switch case,比如

    case 5:
    return Container(
        child: Column(
      children: <Widget>[
        _expandedVideoRow(views.sublist(0, 2)),
        _expandedVideoRow(views.sublist(2, 4)),
        _expandedVideoRow(views.sublist(4, 5))
      ],
    ));
    case 6:
    return Container(
        child: Column(
      children: <Widget>[
        _expandedVideoRow(views.sublist(0, 2)),
        _expandedVideoRow(views.sublist(2, 4)),
        _expandedVideoRow(views.sublist(4, 6))
      ],
    ));
    case 7:
    return Container(
        child: Column(
      children: <Widget>[
        _expandedVideoRow(views.sublist(0, 2)),
        _expandedVideoRow(views.sublist(2, 4)),
        _expandedVideoRow(views.sublist(4, 6)),
        _expandedVideoRow(views.sublist(6, 7)),
      ],
    ));
    

    您还可以创建自己的界面,其中“视图”不添加到行和列中,而是使用堆栈或您选择的任何其他小部件。

    【讨论】:

    • 为了获得更高的缩放比例,我建议您使用带有 _expandedVideoRow(views.sublist(i, i+2)) 和 _expandedVideoRow(views.sublist(i, i+1)) 的 for 循环,
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-01
    • 1970-01-01
    • 2022-11-02
    • 2021-11-20
    • 2020-10-24
    • 1970-01-01
    相关资源
    最近更新 更多