|
@@ -44,16 +44,17 @@ class NTPublishChannel extends NTBasePublishChannel {
|
|
|
|
|
|
class NTPlayChannel extends NTBasePlayChannel {
|
|
|
int _volume = 100;
|
|
|
+ String _userId = "";
|
|
|
|
|
|
NTPlayChannel({required super.member}) {
|
|
|
- _initMobile();
|
|
|
+ _init();
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
int get volume => _volume;
|
|
|
|
|
|
IPlayController? get playController =>
|
|
|
- NTNativeShare.playControllers.get(member.userId!);
|
|
|
+ NTNativeShare.playControllers.get(_userId);
|
|
|
|
|
|
@override
|
|
|
void setAudioMute(bool isMute) async {
|
|
@@ -90,33 +91,38 @@ class NTPlayChannel extends NTBasePlayChannel {
|
|
|
updateReadyState(viewId > 0);
|
|
|
}
|
|
|
|
|
|
- void _initMobile() {
|
|
|
- final userId = member.userId!;
|
|
|
+ void _init() {
|
|
|
+ _userId = member.userId!;
|
|
|
if (isDevice) {
|
|
|
- _loadMobileDevice(userId);
|
|
|
+ _loadMobileDevice();
|
|
|
} else {
|
|
|
- final controller = PlayController(liveInfo.rtmpUrl, userId: userId);
|
|
|
- NTNativeShare.playControllers.put(userId, controller);
|
|
|
+ final controller = PlayController(liveInfo.rtmpUrl, userId: _userId);
|
|
|
+ NTNativeShare.playControllers.put(_userId, controller);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void _loadMobileDevice(String userId) {
|
|
|
+ void _loadMobileDevice() {
|
|
|
DeviceRtmpLiveInfo info = liveInfo as DeviceRtmpLiveInfo;
|
|
|
if (info.isMerge) {
|
|
|
- final subCount = (member as RtmpMemberInfo).deviceInfoList!.length - 1;
|
|
|
+ _userId = MERGE_DEVICE_NATIVE_SIGN; // 合图使用虚拟用户ID
|
|
|
+
|
|
|
+ final subCount =
|
|
|
+ (member as NTRemoteMember).memberInfo.deviceInfoList!.length - 1;
|
|
|
if (isDeviceMain) {
|
|
|
final controller = MergePlayController(
|
|
|
liveInfo.rtmpUrl,
|
|
|
- userId: MERGE_DEVICE_NATIVE_SIGN,
|
|
|
+ userId: _userId,
|
|
|
mergeWidth: info.mergeWidth,
|
|
|
mergeHeight: info.mergeHeight,
|
|
|
subViewCount: subCount,
|
|
|
);
|
|
|
- NTNativeShare.playControllers.put(MERGE_DEVICE_NATIVE_SIGN, controller);
|
|
|
+ NTNativeShare.playControllers.put(_userId, controller);
|
|
|
+ } else {
|
|
|
+ _userId = "DeviceSub";
|
|
|
}
|
|
|
} else {
|
|
|
- final controller = PlayController(liveInfo.rtmpUrl, userId: userId);
|
|
|
- NTNativeShare.playControllers.put(userId, controller);
|
|
|
+ final controller = PlayController(liveInfo.rtmpUrl, userId: _userId);
|
|
|
+ NTNativeShare.playControllers.put(_userId, controller);
|
|
|
}
|
|
|
}
|
|
|
}
|