From 2e7e20f7e12edb9206127c90dad0aa0a9b3885fe Mon Sep 17 00:00:00 2001 From: thegobot Date: Mon, 23 Nov 2020 10:54:34 +0800 Subject: [PATCH] publishChannels Using publishChannels. --- src/sdk/conference/client.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sdk/conference/client.js b/src/sdk/conference/client.js index cb20cef4..4a72eb4b 100644 --- a/src/sdk/conference/client.js +++ b/src/sdk/conference/client.js @@ -401,13 +401,23 @@ export const ConferenceClient = function(config, signalingImpl) { if (!(stream instanceof StreamModule.LocalStream)) { return Promise.reject(new ConferenceError('Invalid stream.')); } - if (publishChannels.has(stream.mediaStream.id)) { + + + let ch = publishChannels.get(stream.mediaStream.id); + if (ch && !ch._stopped) { return Promise.reject(new ConferenceError( 'Cannot publish a published stream.')); } const channel = createPeerConnectionChannel(); + + publishChannels.set(stream.mediaStream.id, channel); + return channel.publish(stream, options, videoCodecs); }; + + this.getChannel = function(streamId){ + return publishChannels.get(streamId); + }; /** * @function subscribe