Skip to content

Commit

Permalink
Support video rotation for Firefox p2p calls
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-nadymov committed Apr 13, 2021
1 parent d994186 commit afd90f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Calls/P2P/P2PSdpBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export function p2pParseSdp(sdp) {
return info;
}

function isFirefox() {
export function isFirefox() {
return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
}

Expand Down
12 changes: 11 additions & 1 deletion src/Components/Calls/CallPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import MenuIcon from '../../Assets/Icons/More';
import MicIcon from '../../Assets/Icons/Mic';
import MicOffIcon from '../../Assets/Icons/MicOff';
import { closeCallPanel } from '../../Actions/Call';
import { isFirefox } from '../../Calls/P2P/P2PSdpBuilder';
import { p2pGetCallStatus, p2pIsCallReady } from '../../Calls/Utils';
import { getUserFullName } from '../../Utils/User';
import { stopPropagation } from '../../Utils/Message';
Expand All @@ -31,6 +32,8 @@ import LStore from '../../Stores/LocalizationStore';
import UserStore from '../../Stores/UserStore';
import './CallPanel.css';

const SUPPORTS_ROTATION = true;

class CallPanel extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -255,6 +258,13 @@ class CallPanel extends React.Component {

let screenSharing = currentCall && Boolean(currentCall.screenStream);

let outputVideoStyle = null;
if (SUPPORTS_ROTATION && outputMediaState && isFirefox()) {
outputVideoStyle = {
transform: `rotate(${outputMediaState.videoRotation}deg)`
};
}

return (
<div className={classNames('group-call-panel', { 'full-screen': fullScreen })} ref={this.callPanelRef}>
<div className='group-call-panel-header'>
Expand Down Expand Up @@ -330,7 +340,7 @@ class CallPanel extends React.Component {
</Popover>
</div>
<div className='call-panel-content scrollbars-hidden' onDoubleClick={this.handleFullScreen}>
<video id='call-output-video' className={outputMediaState && outputMediaState.videoState === 'active' ? 'call-video-active' : 'call-video-inactive'} autoPlay={true} muted={false}/>
<video id='call-output-video' style={outputVideoStyle} className={outputMediaState && outputMediaState.videoState === 'active' ? 'call-video-active' : 'call-video-inactive'} autoPlay={true} muted={false}/>
<video id='call-input-video' className={inputMediaState && inputMediaState.videoState === 'active' ? 'call-video-active' : 'call-video-inactive'} autoPlay={true} muted={true}/>
</div>
{ outputMediaState && outputMediaState.muted && (
Expand Down

0 comments on commit afd90f1

Please sign in to comment.