im_plugin_tencent_web 0.0.3
im_plugin_tencent_web: ^0.0.3 copied to clipboard
The Flutter plugin integrated with Tencent IM is only for the web end and can be used for chat chat and call audio and video calls. Chat chat only connects to Tencent IM's UI free access method, provi [...]
im_plugin_tencent_web #
A Flutter plugin that inherits from Tencent IM
聊天互动使用:@tencentcloud/lite-chat (无UI)进行集成
音视频通话使用:Web&H5 (Vue2/Vue3) (含UI)进行集成
使用前准备 #
第一步 #
下载并复制一下文件到项目的 web 目录下
im_plugin.bundle.js
第二步 #
// 在 web/index.html 的 head之间添加
<script src="im_plugin.bundle.js" defer></script>
开始使用 #
初始化IM #
import 'package:im_plugin_tencent_web/im_plugin_tencent_web.dart';
import 'package:im_plugin_tencent_web/im/event_listener_config.dart';
ImPluginTencentWeb.initSdk(
sdkAppID: 0,
eventListener: EventListenerConfig(),
);
登录IM #
import 'package:im_plugin_tencent_web/im_plugin_tencent_web.dart';
try {
final imLoginRes = await ImPluginTencentWeb.login(
userID: '',
userSig: '',
);
print(imLoginRes);
} catch(err) {
print('登录出错:$err');
}
登出IM #
import 'package:im_plugin_tencent_web/im_plugin_tencent_web.dart';
try {
final imLogoutRes = await ImPluginTencentWeb.logout();
print(imLogoutRes);
} catch(err) {
print('登出出错:$err');
}
销毁IM #
import 'package:im_plugin_tencent_web/im_plugin_tencent_web.dart';
try {
await ImPluginTencentWeb.destroy();
} catch(err) {
print('销毁出错:$err');
}