Commit 8f65dac 1 parent b303aab commit 8f65dac Copy full SHA for 8f65dac
File tree 2 files changed +34
-2
lines changed
2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -142,10 +142,10 @@ export const GameSource = {
142
142
source : Sources . GameSource
143
143
} ) => {
144
144
const ref = useRef < HTMLVideoElement > ( )
145
- const { volume = 1 , isHidden = false } = props || { }
145
+ const { volume = 1 , isMuted = false } = props || { }
146
146
const [ labelSize , setLabelSize ] = useState < 0 | 1 | 2 | 3 > ( 0 )
147
147
148
- const muteAudio = props ?. isMuted
148
+ const muteAudio = isMuted
149
149
150
150
const hasVideo = ! props ?. isHidden && source ?. props ?. videoEnabled
151
151
Original file line number Diff line number Diff line change @@ -346,6 +346,16 @@ export interface Commands {
346
346
cb : ( nodes : Compositor . SceneNode [ ] ) => void ,
347
347
type : ExternalSourceType ,
348
348
) : Disposable
349
+ /**
350
+ * Change a source node's volume.
351
+ * This does not affect the underlying MediaStreamTrack.
352
+ */
353
+ setSourceNodeVolume ( id : string , volume : number ) : void
354
+ /**
355
+ * Mute a source node without changing its volume.
356
+ * This does not affect the underlying MediaStreamTrack.
357
+ */
358
+ setSourceNodeMuted ( id : string , isMuted : boolean ) : void
349
359
/**
350
360
* Add a participant camera track to the stream canvas.
351
361
* Available participants can be gleaned from the WebRTC {@link Room} using
@@ -1838,6 +1848,28 @@ export const commands = (_project: ScenelessProject) => {
1838
1848
}
1839
1849
} ,
1840
1850
1851
+ setSourceNodeVolume ( id , volume ) {
1852
+ const node = commands . getSourceNode ( id )
1853
+ if ( ! node ) return
1854
+ CoreContext . Command . updateNode ( {
1855
+ nodeId : node . id ,
1856
+ props : {
1857
+ volume,
1858
+ } ,
1859
+ } )
1860
+ } ,
1861
+
1862
+ setSourceNodeMuted ( id , isMuted ) {
1863
+ const node = commands . getSourceNode ( id )
1864
+ if ( ! node ) return
1865
+ CoreContext . Command . updateNode ( {
1866
+ nodeId : node . id ,
1867
+ props : {
1868
+ isMuted,
1869
+ } ,
1870
+ } )
1871
+ } ,
1872
+
1841
1873
async addParticipantTrack (
1842
1874
trackId : string ,
1843
1875
props : Partial < ParticipantProps > = {
You can’t perform that action at this time.
0 commit comments