|
@@ -343,38 +343,51 @@ function handleStreamAdded(event) {
|
|
|
async function handleStreamSubscribed(event) {
|
|
|
const remoteStream = event.stream;
|
|
|
const rtcStore = useRtcStore();
|
|
|
- const { t } = useI18n();
|
|
|
+ // const { t } = useI18n();
|
|
|
+ debugger;
|
|
|
const remoteUserId = remoteStream.getUserId();
|
|
|
const remoteId = remoteStream.getId();
|
|
|
if (remoteUserId == rtcStore.userId) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (!rtcStore.isUserInRemoteStream(remoteUserId)) {
|
|
|
+ if (!rtcStore.isIdInRemoteStream(remoteId)) {
|
|
|
+ consola.info({
|
|
|
+ message: remoteId,
|
|
|
+ tag: 'rtc:audio',
|
|
|
+ });
|
|
|
rtcStore.pushRemoteStreams(remoteStream);
|
|
|
// debugger
|
|
|
}
|
|
|
await nextTick();
|
|
|
setTimeout(async () => {
|
|
|
try {
|
|
|
- await remoteStream.play(remoteId);
|
|
|
consola.info({
|
|
|
- message: '客音源',
|
|
|
+ message: '客音源-->' + remoteId,
|
|
|
+ tag: 'rtc:audio',
|
|
|
+ });
|
|
|
+ consola.info({
|
|
|
+ message: rtcStore.remoteStreams,
|
|
|
tag: 'rtc:audio',
|
|
|
});
|
|
|
+ await remoteStream.play(remoteId);
|
|
|
} catch (error) {
|
|
|
// remoteStream.resume();
|
|
|
- rtcStore.showBaseDialog(
|
|
|
- {
|
|
|
- title: t('base.tips'),
|
|
|
- desc: t('base.audioPermission'),
|
|
|
- okTxt: t('base.confirm'),
|
|
|
- closeTxt: t('base.cancel'),
|
|
|
- },
|
|
|
- () => {
|
|
|
- remoteStream.resume();
|
|
|
- },
|
|
|
- );
|
|
|
+ // rtcStore.showBaseDialog(
|
|
|
+ // {
|
|
|
+ // title: t('base.tips'),
|
|
|
+ // desc: t('base.audioPermission'),
|
|
|
+ // okTxt: t('base.confirm'),
|
|
|
+ // closeTxt: t('base.cancel'),
|
|
|
+ // },
|
|
|
+ // () => {
|
|
|
+ // consola.info({
|
|
|
+ // message: 'resume',
|
|
|
+ // tag: 'rtc:audio',
|
|
|
+ // });
|
|
|
+ // remoteStream.resume();
|
|
|
+ // },
|
|
|
+ // );
|
|
|
// Dialog.confirm({
|
|
|
// showCloseIcon: false,
|
|
|
// okText: '确定',
|
|
@@ -428,7 +441,13 @@ async function handleStreamSubscribed(event) {
|
|
|
function handleStreamRemoved(event) {
|
|
|
const remoteStream = event.stream;
|
|
|
const userId = remoteStream.getUserId();
|
|
|
- console.log(`RemoteStream removed: [${userId}]`);
|
|
|
+ const remoteStreamId = remoteStream.getId();
|
|
|
+ consola.info({
|
|
|
+ message: `RemoteStream removed: [${userId},${remoteStreamId}]`,
|
|
|
+ tag: 'rtc:audio',
|
|
|
+ });
|
|
|
+ const rtcStore = useRtcStore();
|
|
|
+ rtcStore.removeRemoteStreams(remoteStreamId);
|
|
|
}
|
|
|
|
|
|
function handleStreamUpdated(event) {
|