lower lag and more snappy?

This commit is contained in:
talksik
2022-05-20 08:24:44 -05:00
parent 704ae7364d
commit 1fec89d533
2 changed files with 22 additions and 11 deletions
@@ -16,6 +16,12 @@ import useTerminalProvider from './TerminalProvider';
import MasterLineData from '@nirvana/core/models/masterLineData.model'; import MasterLineData from '@nirvana/core/models/masterLineData.model';
import { useEffectOnce } from 'react-use'; import { useEffectOnce } from 'react-use';
const videoConstraints = {
frameRate: 30,
width: { max: 100 },
height: { max: 200 },
};
const iceServers = [ const iceServers = [
// { urls: 'stun:stun.l.google.com:19302' }, // { urls: 'stun:stun.l.google.com:19302' },
// { urls: 'stun:stun.l.google.com:19302' }, // { urls: 'stun:stun.l.google.com:19302' },
@@ -159,7 +165,10 @@ export function StreamProvider({ children }: { children: React.ReactChild }) {
}); });
navigator.mediaDevices navigator.mediaDevices
.getUserMedia({ video: true, audio: true }) .getUserMedia({
video: videoConstraints,
audio: true,
})
.then((localMediaStream: MediaStream) => { .then((localMediaStream: MediaStream) => {
setUserLocalStream(localMediaStream); setUserLocalStream(localMediaStream);
}); });
@@ -309,7 +318,7 @@ function LineConnector({
// todo get the user media selections // todo get the user media selections
navigator.mediaDevices navigator.mediaDevices
.getUserMedia({ video: true, audio: true }) .getUserMedia({ video: videoConstraints, audio: true })
.then((localMediaStream: MediaStream) => { .then((localMediaStream: MediaStream) => {
// todo check if already in peer map? keeping it simple for now // todo check if already in peer map? keeping it simple for now
// a peer relationship between me and someone for this particular channel so that I can just enable or disable this particular stream // a peer relationship between me and someone for this particular channel so that I can just enable or disable this particular stream
@@ -5,7 +5,7 @@ import useStreams from '../../../../providers/StreamProvider';
import { LineMemberState } from '@nirvana/core/models/line.model'; import { LineMemberState } from '@nirvana/core/models/line.model';
import LineIcon from '../../../../components/lineIcon'; import LineIcon from '../../../../components/lineIcon';
import { FiActivity, FiSettings, FiSun } from 'react-icons/fi'; import { FiActivity, FiSettings, FiSun } from 'react-icons/fi';
import { Avatar, Tooltip } from 'antd'; import { Avatar, Spin, Tooltip } from 'antd';
import useTerminalProvider from '../../../../providers/TerminalProvider'; import useTerminalProvider from '../../../../providers/TerminalProvider';
export default function LineDetails() { export default function LineDetails() {
@@ -182,14 +182,16 @@ function StreamPlayer({ peerStream }: { peerStream: MediaStream }) {
}, [peerStream]); }, [peerStream]);
return ( return (
<video <>
ref={streamRef} <video
height={350} ref={streamRef}
width={400} height={300}
className={'shadow-xl rounded'} width={400}
autoPlay className={'shadow-xl rounded'}
muted autoPlay
/> muted
/>
</>
); );
} }