Last updated:
0 purchases
mmoo live room
mmoo_live_room #
接入 #
flutter main.dart
init emclient
prociders add ProviderLiveConfig.prividers
localizationsDelegates add Lives.S.delegate
route add PageLiveRoot
安卓添加相册 相机 麦克风权限
安卓工程 #
andorid-> add video-capture
settings.gradle add
include ':app','video-capture'
copied to clipboard
ios podfile 工程添加 #
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# Here are some configurations automatically generated by flutter
# You can enable the permissions needed here. For example to enable camera
# permission, just remove the `#` character in front so it looks like this:
# ## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1'
# Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
# 'PERMISSION_EVENTS=1',
## dart: PermissionGroup.reminders
# 'PERMISSION_REMINDERS=1',
## dart: PermissionGroup.contacts
# 'PERMISSION_CONTACTS=1',
# dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
# dart: PermissionGroup.microphone
'PERMISSION_MICROPHONE=1',
## dart: PermissionGroup.speech
# 'PERMISSION_SPEECH_RECOGNIZER=1',
# dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
# 'PERMISSION_LOCATION=1',
# dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=1',
## dart: PermissionGroup.mediaLibrary
# 'PERMISSION_MEDIA_LIBRARY=1',
## dart: PermissionGroup.sensors
# 'PERMISSION_SENSORS=1',
## dart: PermissionGroup.bluetooth
# 'PERMISSION_BLUETOOTH=1',
## dart: PermissionGroup.appTrackingTransparency
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
## dart: PermissionGroup.criticalAlerts
# 'PERMISSION_CRITICAL_ALERTS=1'
]
end
end
end
copied to clipboard
关于启动后台配置 #
wiki 管理后台 配置说明 需要配置 LiveOpenType
关于接听通话,未读消息更新及更新 money #
1.接听通话
需要先退出直播间 之后再进入接听电话逻辑
await ConfigLiveGlobalkey.liveRtcKey.currentState
?.userExitRoom();
copied to clipboard
2.未读消息
在进入 live 模块 给一个 GlobalKey
void onUnReadCount() async {
try {
int? unread =
await EMClient.getInstance.chatManager.getUnreadMessageCount();
liveRootKey.currentState?.updataUnReadMessags(unread ?? 0);
} catch (e) {}
}
copied to clipboard
3.更新 money
在进入 live 模块 接收RechargeEvent
subscription = eventBusBig.on<RechargeEvent>().listen((event) {
liveRootKey.currentState
?.updataUserInfo(money: int.parse(event.money ?? '0'));
});
copied to clipboard
4.关于 LiveMethonDelegate
(1). showLiveReportPage 打开举报页面
(2). openIMMessageListPage 打开消息列表
(3). showRechargeblePage 打开充值页面
(4). showLiveIMChatPage(String userId) 打开充值页面
(5). showLiveCallVideoPage(String userId) 开始播放视频通话
(6). blackUserMoney(String money) 向外更新 money 余额
(7). setImSocketMessageHandler(LiveSocketEventHandler handler) 设置环信 imhandler 设置了之后 直播间才有 im 链接能力
在环信onMessagesReceived回调中
@override
void onMessagesReceived(List<EMMessage> messages) {
if (_liveSocketEventHandler != null) {
messages
.where((element) => element.chatType == EMMessageChatType.ChatRoom)
.toList()
.forEach((element) {
_liveSocketEventHandler?.onMessageReceived(element);
});
}
List<EMMessage> chatMessages = messages
.where((element) => element.chatType != EMMessageChatType.ChatRoom)
.toList();
if (chatMessages.isNotEmpty) {
imPluginDelegateList.forEach((element) {
element.onMessageReceived(messages);
});
// _onImLivePluginDelegate?.onMessageReceived(messages);
}
}
copied to clipboard
在环信onCmdMessagesReceived回调中
if (_liveSocketEventHandler != null) {
messages
.where((element) {
if (element.body is EMCmdMessageBody) {
EMCmdMessageBody cmdMessageBody =
element.body as EMCmdMessageBody;
if (cmdMessageBody.action == 'live') {
return true;
}
}
return false;
})
.toList()
.forEach((element) {
_liveSocketEventHandler?.onMessageReceived(element);
});
}
copied to clipboard
(8). setOnConnection(OnImLivePluginDelegate delegate) 设置 im 在线状态回调
pubspec.yaml 添加
mmoo_live_room:
git:
url: https://gitee.com/mimo_1/mmoo-live-room.git
ref: <最新版>
copied to clipboard
修改 mmoo_base_video 里面的 美颜版本
LoneMainPageLy 添加直播列表 tabbar
MainDao.initConfig 添加 LiveOpenType BEKEY
LoneVideoUtilLy 添加直播代码 详见代码
@override
void onMessagesReceived(List<EMMessage> messages) {
if (_liveSocketEventHandler != null) {
messages
.where((element) => element.chatType == EMMessageChatType.ChatRoom)
.toList()
.forEach((element) {
_liveSocketEventHandler?.onMessageReceived(element);
});
}
List<EMMessage> chatMessages = messages
.where((element) => element.chatType != EMMessageChatType.ChatRoom)
.toList();
if (chatMessages.isNotEmpty) {
imPluginDelegateList.forEach((element) {
element.onLoneMessageReceivedLy(messages);
});
}
}
@override
void onCmdMessagesReceived(List<EMMessage> messages) {
AppConfig.printLog('onCmdMessagesReceived');
if (_liveSocketEventHandler != null) {
messages
.where((element) {
if (element.body is EMCmdMessageBody) {
EMCmdMessageBody cmdMessageBody =
element.body as EMCmdMessageBody;
if (cmdMessageBody.action == 'live') {
return true;
}
}
return false;
})
.toList()
.forEach((element) {
_liveSocketEventHandler?.onMessageReceived(element);
});
}
return super.onCmdMessagesReceived(messages);
}
copied to clipboard
requestLoneVideoPermissionLy 函数 添加
await ConfigLiveGlobalkey.liveRtcKey.currentState?.userExitRoom();
CommonUtils.dismiss();
copied to clipboard
在欢迎页添加
Future initialization() async {
CommonUtils.toast = ((msg) {
LoneCommonUtilLy.showErrorToastLy(LoneRouterLy.context, res: msg);
});
CommonUtils.toastDismiss = (() {
if (RechargeUtils.instance.showLoading == true) {
Navigator.pop(context);
}
});
CommonUtils.toastLoad = ((status) {
if (RechargeUtils.instance.showLoading == false) {
LoneCommonUtilLy.showLoneLoadingDialogLy(context, text: status);
}
});
}
copied to clipboard
添加充值成功回调 然后更新
liveRootKey.currentState?.updataUserInfo(money: int.parse((event.money ?? '0'))); ventBusLone.on<LoneRechargeEventLy>().listen((event)
copied to clipboard
main.dart 添加 prividers.addAll(ProviderLiveConfig.prividers); 及 LiveS.S.delegate,
添加在直播间内接收到通话邀请的提示 onLoneReceivedByPeerLy 添加样式判断
goUserPage 添加 goLivePage
会话列表 处理一下只展示单聊会话 updateConversationList
list.removeWhere((element) => element.type != EMConversationType.Chat);
copied to clipboard
直播间接收到通话邀请
void onReceivedByPeer(context) {
rtmClient?.onRemoteInvitationReceivedByPeer =
(AgoraRtmRemoteInvitation invite) async {
try {
if ((!VideoChatPage.sOpen || VideoChatPage.sOpenPop) &&
!RechargeUtils.instance.showLoading) {
var message = CallEntity.fromJson(jsonDecode(invite.content!));
AnchorEntity anchorEntity =
AnchorEntity.call(message.userName, message.userImage);
if (PageLiveRoot.inLivePage) {
if (_invite != null) {
_timer?.cancel();
_supportEntry?.dismiss();
_supportEntry = null;
_invite = null;
await rtmClient
?.refuseRemoteInvitation({'callerId': _invite?.callerId});
}
_invite = invite;
_supportEntry?.dismiss();
_supportEntry = showOverlayNotification((entryContext1) {
return BigLiveVideoInvitationWidget().showOverlayNotificationMessage(
anchorEntity, onPick: () async {
_supportEntry?.dismiss();
_supportEntry = null;
Future.delayed(Duration(milliseconds: 200), () {
requestVideoPermission(context,
userId: invite.callerId,
call: false,
callId: message.callId,
channelId: invite.channelId,
dial: false,
anchorEntity: anchorEntity,
invite: invite);
});
}, onhangup: () {
_timer?.cancel();
_supportEntry?.dismiss();
_supportEntry = null;
_invite = null;
rtmClient
?.refuseRemoteInvitation({'callerId': invite.callerId});
});
}, duration: Duration(seconds: 50));
_timer = Timer.periodic(Duration(seconds: AppConfig), (timer) {
_timer?.cancel();
if (_supportEntry != null) {
_invite = null;
rtmClient
?.refuseRemoteInvitation({'callerId': invite.callerId});
}
});
} else {
requestVideoPermission(context,
userId: invite.callerId,
call: false,
callId: message.callId,
channelId: invite.channelId,
dial: false,
anchorEntity: anchorEntity,
invite: invite);
}
} else {
rtmClient?.refuseRemoteInvitation({'callerId': invite.callerId});
}
} catch (e) {
AppConfig.printLog(e);
}
};
rtmClient?.onRemoteInvitationCanceled =
(AgoraRtmRemoteInvitation invite) async {
_timer?.cancel();
if (_supportEntry != null) {
_invite = null;
rtmClient?.refuseRemoteInvitation({'callerId': invite.callerId});
}
};
}
copied to clipboard
未读消息更新
从聊天列表或者聊天页返回添加 eventBusLone.fire(LoneHomeUnReadEventLy());
subscriptionUn =
eventBusLone.on<LoneHomeUnReadEventLy>().listen((event) async {
onUnReadCount();
});
void onUnReadCount() async {
try {
int? unread =
await EMClient.getInstance.chatManager.getUnreadMessageCount();
liveRootKey.currentState?.updataUnReadMessags(unread ?? 0);
} catch (e) {}
}
copied to clipboard
flutter packages pub publish --server=https://pub.dartlang.org
export http_proxy=http://127.0.0.1:58591; export https_proxy=http://127.0.0.1:58591;
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.