flutter_nimsdk 1.5.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 68

flutter_nimsdk #

pub package

用于Flutter的网易云信SDK 暂时只有iOS版本

已完成功能 #

音视频 #

  • 初始化
  • 登录
  • 自动登录
  • 登陆状态回调
  • 登出
  • 主动发起通话请求
  • 接收到通话请求
  • 被叫响应通话请求
  • 主叫收到被叫响应回调
  • 通话建立结果回调
  • 挂断
  • 收到对方结束通话回调
  • 通话断开
  • 获取话单
  • 清空本地话单
  • 动态设置摄像头开关
  • 动态切换前后摄像头
  • 设置静音

IM #

  • 最近会话列表
  • 所有最近会话
  • 文本消息
  • 提示消息
  • 图片消息
  • 视频消息
  • 音频消息
  • 文件消息
  • 位置消息
  • 开始录音
  • 结束录音
  • 取消录音

部分示例 #

初始化 #

使用前,先进行初始化:


SDKOptions sdkOptions = SDKOptions(appKey: appkey);
await FlutterNimsdk().initSDK(sdkOptions);

登录 #

LoginInfo loginInfo = LoginInfo(account: "",token: "");
FlutterNimsdk().login(loginInfo).then((result) {
   print(result);
});

退出登录 #

await FlutterNimsdk().logout();

发起通话 #


String time = currentTimeMillis();
String extendMessage = '{"currentTimeStamp":"${time}"}';
NIMNetCallOption callOption = NIMNetCallOption(extendMessage: extendMessage,apnsContent: "apnsContent",apnsSound: "apnsSound");

FlutterNimsdk().start(beijiaoID.toString(), NIMNetCallMediaType.Video, callOption,time).then((result) {
        
      print(result);
        
  });
}
  

注意: 扩展消息extendMessage这里加上了一个当前时间的时间戳, 是为了避免挂断视频通话后再次发起通话出现的闪退问题.

回调 #


//数据接收
  void _onEvent(Object value) {
    print(value);

    /**
     * delegateType 的值对应的回调
     * 
     * 
     * NIMDelegateTypeOnLogin = 0,
     * NIMDelegateTypeOnReceive = 1,
     * NIMDelegateTypeOnResponse = 2,
     * NIMDelegateTypeOnCallEstablished = 3,
     * NIMDelegateTypeOnHangup = 4,
     * NIMDelegateTypeOnCallDisconnected = 5,
     * NIMDelegateTypeDidAddRecentSession = 6,
     * NIMDelegateTypeDidUpdateRecentSession = 7,
     * NIMDelegateTypeDidRemoveRecentSession = 8,
     * NIMDelegateTypeRecordAudioComplete = 9,
     */

  }
  

以上是插件中用到的回调,具体请参照网易云信文档回调接口名称一一对应。例如:

NIMDelegateTypeOnLogin表示的是登陆状态回调:

- (void)onLogin:(NIMLoginStep)step{

}

根据delegateType来区分各种回调。

视频窗口 #

通过UIKitView组件,根据viewType区分原生view.

例如:


// LocalDisplayView是当前用户视频窗口. 即对主叫来说,代表的是主叫视频窗口; 对被叫来说,代表的是被叫视频窗口
// RemoteDisplayView表示的就是对方视频窗口. 对主叫来说,被叫是对方;对被叫来说,主叫是对方.
Stack(
        children: <Widget>[
          Container(
            width: window.physicalSize.width,
            height: window.physicalSize.height,
            child: UiKitView(
              viewType: "LocalDisplayView-${widget.timeStamp}",
            ),
          ),
          Container(
            width: 100,
            height: 150,
            child: UiKitView(
              viewType: "RemoteDisplayView-${widget.timeStamp}",
            ),
          ),
        ],
      ),

注意: 只有当接受视频请求后并且本次通话成功建立后, 才可以进行向视频页面跳转的操作

1.5.0 #

add faceUnity

1.4.30 #

add snapChat

1.4.15 #

  • fix bug

1.4.13 #

  • add video complete callback

1.4.7 #

  • add api

1.4.1 #

  • add netCallControlType && callback

1.4.0 #

  • 新增会话历史记录接口

1.3.2 #

  • 修复开启/关闭摄像头闪退的问题

1.3.1 #

  • UIKitView viewType
  • 扩展信息添加时间戳
  • 优化视频通话

1.2.4 #

  • 新增扬声器开关

1.2.3 #

  • 新增接口

1.2.0 #

  • 添加美颜功能

1.1.7 #

  • 修复挂断不成功问题

1.1.6 #

  • 修复接听不成功的问题

1.1.5 #

  • 修复扩展消息接收不到的问题

1.1.4 #

  • 修复回调问题

1.1.3 #

  • 修复来电信息响应监听的问题

1.1.2 #

  • 修复登陆状态返回值的问题

1.1.1 #

  • Fix bugs

1.1.0 #

  • 添加会话列表头像信息
  • 优化返回信息格式

1.0.0 #

  • change description
  • Fix bugs

0.0.5 #

  • Fix bugs.
  • 优化返回值
  • 回调信息优化

0.0.1 #

  • Initial release.

example/README.md

flutter_nimsdk_example #

Demonstrates how to use the flutter_nimsdk plugin.

接口 #


视频页面 #

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_nimsdk: ^1.5.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_nimsdk/flutter_nimsdk.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
35
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Jan 21, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Format lib/src/config.g.dart.

Run flutter format to format lib/src/config.g.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
json_annotation ^3.0.0 3.0.1
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test