Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] WebRTC wasn't working due to design and browser's APIs changes #13675

Merged
merged 5 commits into from
Mar 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/lib/lib/roomTypes/direct.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class DirectMessageRoomType extends RoomTypeConfig {
}

userDetailShowAll(/* room */) {
return false;
return true;
}

getUiText(context) {
Expand Down
9 changes: 9 additions & 0 deletions app/theme/client/imports/forms/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@
margin: 0 5px;
}

&--wrap {
margin: 5px -5px;
flex-wrap: wrap;

& > .rc-button {
margin: 5px;
}
}

&--stretch {
justify-content: stretch;

Expand Down
2 changes: 1 addition & 1 deletion app/ui-flextab/client/tabs/membersList.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="rc-member-list__status rc-member-list__status--{{status}}"></div>
{{ignored}} {{displayName}} {{utcOffset}}
</div>
{{> icon user=. block="rc-member-list__menu js-action" icon="menu" }}
{{> icon user=. block="rc-member-list__menu js-more" icon="menu" }}
</li>
{{/each}}
</ul>
Expand Down
2 changes: 1 addition & 1 deletion app/ui-flextab/client/tabs/membersList.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Template.membersList.events({
}

},
'click .js-action'(e, instance) {
'click .js-more'(e, instance) {
e.currentTarget.parentElement.classList.add('active');
const room = Session.get(`roomData${ instance.data.rid }`);
const _actions = getActions({
Expand Down
3 changes: 2 additions & 1 deletion app/ui-flextab/client/tabs/userInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const more = function() {
return Template.instance().actions.get()
.map((action) => (typeof action === 'function' ? action.call(this) : action))
.filter((action) => action && (!action.condition || action.condition.call(this)))
.slice(2);
.slice(3);
};


Expand Down Expand Up @@ -203,6 +203,7 @@ Template.userInfo.events({

$(e.currentTarget).blur();
e.preventDefault();
e.stopPropagation();
const config = {
columns,
data: {
Expand Down
4 changes: 2 additions & 2 deletions app/ui-utils/client/lib/popout.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1 class="rc-popout__title">{{> icon icon="podcast"}}</h1>
</button>
</header>

<main class="rc-popout__content rc-popout--{{ state }} ">
<section class="rc-popout__content rc-popout--{{ state }} ">
{{#if content}}
{{> Template.dynamic template=content data=data}}
{{/if}}
Expand All @@ -58,7 +58,7 @@ <h1 class="rc-popout__title">{{> icon icon="podcast"}}</h1>
<span> {{ getStreamStatus }} </span>
</div>
{{/if}}
</main>
</section>

</div>
</div>
Expand Down
30 changes: 17 additions & 13 deletions app/ui/client/views/app/videoCall/videoCall.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<template name="rcVideo">
<video src="{{src}}" autoplay muted="{{muted}}" class="webrtc-video-element {{#if me}}{{#unless screen}}video-flip{{/unless}}{{/if}}"></video>
</template>

<template name="videoCall">
{{#if videoAvaliable}}
{{#if videoActive}}
<div class="webrtc-video {{#if overlay}}webrtc-video-overlay{{/if}}">
<div class="main-video">
<video src="{{mainVideoUrl}}" autoplay muted="true" class="webrtc-video-element {{#if $eq mainVideoUrl selfVideoUrl}}{{#unless screenShareEnabled}}video-flip{{/unless}}{{/if}}"></video>
{{> rcVideo src=mainVideoUrl muted="true" screen=screenShareEnabled me=($eq mainVideoUrl selfVideoUrl)}}
<div class="background-transparent-darker">{{mainVideoUsername}}</div>
</div>
<div class="videos">
{{#if selfVideoUrl}}
<div class="video-item background-transparent-darker" data-username="$self">
<video src="{{selfVideoUrl}}" autoplay muted="true" class="webrtc-video-element {{#unless screenShareEnabled}}video-flip{{/unless}}"></video>
{{> rcVideo src=selfVideoUrl me=true screen=screenShareEnabled }}
{{#unless audioAndVideoEnabled}}
<div class="video-muted-overlay background-transparent-darker">
{{#unless audioEnabled}}
Expand All @@ -25,35 +29,35 @@
{{/if}}
{{#each remoteVideoItems}}
<div class="video-item background-transparent-darker {{#unless connected}}state-overlay background-transparent-darker-before{{/unless}}" data-state-text="{{stateText}}" data-username="{{id}}">
<video src="{{url}}" autoplay class="webrtc-video-element"></video>
{{> rcVideo src=url screen=false }}
<div class="background-transparent-darker">{{usernameByUserId id}}</div>
</div>
{{/each}}
</div>
<div class="buttons-group">
<div class="rc-button__group rc-button__group--wrap rc-button__group--stretch">
{{#if videoActive}}
<button class="button stop-call"><i class="icon-stop"></i>{{_ "Stop"}}</button>
<button class="rc-button stop-call"><i class="icon-stop"></i>{{_ "Stop"}}</button>
{{#if audioEnabled}}
<button class="button disable-audio" title="{{_ 'Mute'}}" aria-label="{{_ 'Mute'}}"><i class="icon-mute"></i></button>
<button class="rc-button disable-audio" title="{{_ 'Mute'}}" aria-label="{{_ 'Mute'}}"><i class="icon-mute"></i></button>
{{else}}
<button class="button enable-audio" title="{{_ 'Unmute'}}" aria-label="{{_ 'Unmute'}}"><i class="icon-mic"></i></button>
<button class="rc-button enable-audio" title="{{_ 'Unmute'}}" aria-label="{{_ 'Unmute'}}"><i class="icon-mic"></i></button>
{{/if}}
{{#if videoEnabled}}
<button class="button disable-video"><i class="icon-eye-off"></i></button>
<button class="rc-button disable-video"><i class="icon-eye-off"></i></button>
{{else}}
<button class="button enable-video"><i class="icon-eye"></i></button>
<button class="rc-button enable-video"><i class="icon-eye"></i></button>
{{/if}}
{{#if screenShareAvailable}}
{{#if screenShareEnabled}}
<button class="button disable-screen-share"><i class="icon-desktop"></i></button>
<button class="rc-button disable-screen-share"><i class="icon-desktop"></i></button>
{{else}}
<button class="button enable-screen-share"><i class="icon-desktop"></i></button>
<button class="rc-button enable-screen-share"><i class="icon-desktop"></i></button>
{{/if}}
{{/if}}
{{#if overlayEnabled}}
<button class="button disable-overlay"><i class="icon-resize-small"></i></button>
<button class="rc-button disable-overlay"><i class="icon-resize-small"></i></button>
{{else}}
<button class="button enable-overlay"><i class="icon-resize-full-alt"></i></button>
<button class="rc-button enable-overlay"><i class="icon-resize-full-alt"></i></button>
{{/if}}
{{/if}}
</div>
Expand Down
6 changes: 6 additions & 0 deletions app/ui/client/views/app/videoCall/videoCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,9 @@ Template.videoCall.events({
return e.currentTarget.volume = 0;
},
});

Template.rcVideo.onRendered(function() {
this.autorun(() => {
this.firstNode.srcObject = this.data.src;
});
});
6 changes: 3 additions & 3 deletions app/webrtc/client/WebRTCClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class WebRTCClass {
peerConnection.getRemoteStreams().forEach((remoteStream) => {
const item = {
id,
url: URL.createObjectURL(remoteStream),
url: remoteStream,
state: peerConnection.iceConnectionState,
};
switch (peerConnection.iceConnectionState) {
Expand Down Expand Up @@ -404,7 +404,7 @@ class WebRTCClass {
}

_getUserMedia(media, onSuccess, onError) {
const onSuccessLocal = function(stream) {
const onSuccessLocal = (stream) => {
if (AudioContext && stream.getAudioTracks().length > 0) {
const audioContext = new AudioContext;
const source = audioContext.createMediaStreamSource(stream);
Expand Down Expand Up @@ -535,7 +535,7 @@ class WebRTCClass {
}
const onSuccess = (stream) => {
this.localStream = stream;
this.localUrl.set(URL.createObjectURL(stream));
this.localUrl.set(stream);
this.videoEnabled.set(this.media.video === true);
this.audioEnabled.set(this.media.audio === true);
const { peerConnections } = this;
Expand Down