|
@@ -32,7 +32,7 @@ class TestDataStruct {
|
|
room.entered.addListener(onEntered);
|
|
room.entered.addListener(onEntered);
|
|
room.exited.addListener(onExited);
|
|
room.exited.addListener(onExited);
|
|
|
|
|
|
- room.initLocalMember(LocalMemberParams(
|
|
|
|
|
|
+ room.loadLocalMember(LocalMemberParams(
|
|
userId: userId,
|
|
userId: userId,
|
|
userSig: userSig,
|
|
userSig: userSig,
|
|
extParams: {},
|
|
extParams: {},
|
|
@@ -52,13 +52,13 @@ class TestDataStruct {
|
|
resolution: Resolutions.sd_480p,
|
|
resolution: Resolutions.sd_480p,
|
|
frameRate: 15,
|
|
frameRate: 15,
|
|
));
|
|
));
|
|
- await publisher!.startLocal();
|
|
|
|
localStarted = true;
|
|
localStarted = true;
|
|
update();
|
|
update();
|
|
|
|
+ await publisher!.startLocal();
|
|
}
|
|
}
|
|
|
|
|
|
Future<void> stopLocal() async {
|
|
Future<void> stopLocal() async {
|
|
- await publisher?.stopLocal();
|
|
|
|
|
|
+ await publisher!.stopLocal();
|
|
localStarted = false;
|
|
localStarted = false;
|
|
update();
|
|
update();
|
|
}
|
|
}
|
|
@@ -78,28 +78,23 @@ class TestDataStruct {
|
|
|
|
|
|
void initPublisher() {
|
|
void initPublisher() {
|
|
publisher = room.createPublisher();
|
|
publisher = room.createPublisher();
|
|
|
|
+ localChannel = publisher!.channels.first;
|
|
}
|
|
}
|
|
|
|
|
|
- void onChannelAdded(Object s, IChannel channel) async {
|
|
|
|
- if (channel is IPublishChannel) {
|
|
|
|
- localChannel = channel;
|
|
|
|
- } else {
|
|
|
|
- remoteChannel = channel as IPlayChannel;
|
|
|
|
- await remoteChannel!.play();
|
|
|
|
- }
|
|
|
|
|
|
+ void onChannelAdded(Object s, IPlayChannel channel) async {
|
|
|
|
+ remoteChannel = channel;
|
|
|
|
+ await remoteChannel!.play();
|
|
update();
|
|
update();
|
|
}
|
|
}
|
|
|
|
|
|
- void onChannelRemoved(Object s, IChannel channel) {
|
|
|
|
- if (channel is IPublishChannel) {
|
|
|
|
- localChannel = null;
|
|
|
|
- } else {
|
|
|
|
- remoteChannel = null;
|
|
|
|
- }
|
|
|
|
|
|
+ void onChannelRemoved(Object s, IPlayChannel channel) {
|
|
|
|
+ remoteChannel?.stop();
|
|
|
|
+ remoteChannel = null;
|
|
update();
|
|
update();
|
|
}
|
|
}
|
|
|
|
|
|
void onEntered(Object s, void e) {
|
|
void onEntered(Object s, void e) {
|
|
|
|
+ // 创建播放器和推流器
|
|
initPublisher();
|
|
initPublisher();
|
|
initPlayer();
|
|
initPlayer();
|
|
entered = true;
|
|
entered = true;
|