Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit e344c82

Browse files
xiewenlong1202jianjunz
authored andcommitted
Merge to 4.2.x: improve publish method (#179)
1 parent 2943141 commit e344c82

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/sdk/conference/channel.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
7777

7878
publish(stream, options) {
7979
if (options === undefined) {
80-
options = {audio: !!stream.mediaStream.getAudioTracks(), video: !!stream
81-
.mediaStream.getVideoTracks()};
80+
options = {audio: !!stream.mediaStream.getAudioTracks().length, video: !!stream
81+
.mediaStream.getVideoTracks().length};
8282
}
8383
if (typeof options !== 'object') {
8484
return Promise.reject(new TypeError('Options should be an object.'));
8585
}
8686
if (options.audio === undefined) {
87-
options.audio = !!stream.mediaStream.getAudioTracks();
87+
options.audio = !!stream.mediaStream.getAudioTracks().length;
8888
}
8989
if (options.video === undefined) {
90-
options.video = !!stream.mediaStream.getVideoTracks();
90+
options.video = !!stream.mediaStream.getVideoTracks().length;
9191
}
92-
if (!!options.audio === !stream.mediaStream.getAudioTracks().length || !!
93-
options.video === !stream.mediaStream.getVideoTracks().length) {
92+
if ((!!options.audio && !stream.mediaStream.getAudioTracks().length) ||
93+
(!!options.video && !stream.mediaStream.getVideoTracks().length)) {
9494
return Promise.reject(new ConferenceError(
9595
'options.audio/video is inconsistent with tracks presented in the ' +
9696
'MediaStream.'

0 commit comments

Comments
 (0)