Fixed setting stream settings while changing window
This commit is contained in:
		
							parent
							
								
									83d4164eac
								
							
						
					
					
						commit
						006f4e96de
					
				
					 1 changed files with 13 additions and 8 deletions
				
			
		|  | @ -89,10 +89,12 @@ addPatch({ | |||
|             bitrateTarget: 600000 | ||||
|         }); | ||||
|         console.log("opts: ", opts); | ||||
| //         Object.assign(opts.encode, {
 | ||||
| //             framerate,
 | ||||
| //             pixelCount: height * width
 | ||||
| //         });
 | ||||
|         if(opts?.encode) { | ||||
|             Object.assign(opts.encode, { | ||||
|                 framerate, | ||||
|                 pixelCount: height * width | ||||
|             }); | ||||
|         } | ||||
|         Object.assign(opts.capture, { | ||||
|             framerate, | ||||
|             width, | ||||
|  | @ -449,12 +451,14 @@ function ModalComponent({ | |||
|                             console.log("No current stream."); | ||||
|                         } | ||||
|                         try { | ||||
|                             if(!conn) { | ||||
|                                 submit({ | ||||
|                             submit({ | ||||
|                                     id: selected!, | ||||
|                                     ...settings | ||||
|                                 }); | ||||
|                             } else { | ||||
| 
 | ||||
|                             //reapply contraints after some time to let discord resubmit stream
 | ||||
|                             //i believe there MUST be way to do it cleaner..
 | ||||
|                             setTimeout(() => { | ||||
|                                 console.log(conn); | ||||
|                                 const track = conn.input.stream.getVideoTracks()[0]; | ||||
|                                 console.log(track); | ||||
|  | @ -472,7 +476,8 @@ function ModalComponent({ | |||
|                                     console.log("Applied constraints from ScreenSharePicker successfully."); | ||||
|                                     console.log("New constraints:", track.getConstraints()); | ||||
|                                 }); | ||||
|                             } | ||||
|                             }, 100); | ||||
| 
 | ||||
|                         } catch { | ||||
|                             console.log("Unable to start stream."); | ||||
|                         } | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Oleh Polisan
						Oleh Polisan