File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -70,14 +70,20 @@ const useWebcamPublisher = () => {
7070 let processor : TwilioBackgroundProcessor | undefined ;
7171 if ( virtualBackground && virtualBackground . type !== 'none' ) {
7272 processor = createVirtualBackgroundProcessor ( virtualBackground ) ;
73+ resolution . height = 480 ;
74+ resolution . width = 640 ;
75+ resolution . frameRate = 24 ;
76+ resolution . aspectRatio = undefined ;
7377 }
7478
7579 const track = await createLocalVideoTrack ( {
7680 deviceId : { exact : deviceId , ideal : deviceId } ,
7781 resolution,
7882 processor,
7983 } ) ;
80- await room . localParticipant . publishTrack ( track ) ;
84+ await room . localParticipant . publishTrack ( track , {
85+ source : Track . Source . Camera ,
86+ } ) ;
8187 } else if ( mediaStreamTrack ) {
8288 // assuming we are not using virtual background
8389 await room . localParticipant . publishTrack ( mediaStreamTrack , {
Original file line number Diff line number Diff line change 11import React , { useEffect , useRef } from 'react' ;
2- import {
3- createLocalVideoTrack ,
4- LocalVideoTrack ,
5- VideoPresets ,
6- } from 'livekit-client' ;
2+ import { createLocalVideoTrack , LocalVideoTrack } from 'livekit-client' ;
73
84import { useAppSelector } from '../../../../store' ;
95import {
106 createVirtualBackgroundProcessor ,
117 TwilioBackgroundProcessor ,
128} from '../../../../helpers/libs/TrackProcessor' ;
9+ import { getWebcamResolution } from '../../../../helpers/utils' ;
1310
1411interface WebcamPreviewProps {
1512 deviceId : string ;
@@ -32,13 +29,18 @@ const WebcamPreview = ({ deviceId }: WebcamPreviewProps) => {
3229 }
3330
3431 let processor : TwilioBackgroundProcessor | undefined ;
32+ const resolution = getWebcamResolution ( ) ;
3533 if ( virtualBackground . type !== 'none' ) {
3634 processor = createVirtualBackgroundProcessor ( virtualBackground ) ;
35+ resolution . height = 480 ;
36+ resolution . width = 640 ;
37+ resolution . frameRate = 24 ;
38+ resolution . aspectRatio = undefined ;
3739 }
3840
3941 createLocalVideoTrack ( {
4042 deviceId,
41- resolution : VideoPresets . h720 . resolution ,
43+ resolution,
4244 processor,
4345 } ) . then ( ( track ) => {
4446 localVideoTrack . current = track ;
You can’t perform that action at this time.
0 commit comments