Add support for blurring streams

This commit is contained in:
Max Goodman
2020-06-22 13:31:18 -07:00
committed by Max Goodhart
parent 3759b05915
commit e861071599
6 changed files with 108 additions and 34 deletions

View File

@@ -223,16 +223,23 @@ export default class StreamWindow extends EventEmitter {
)
}
reloadView(viewIdx) {
sendViewEvent(viewIdx, event) {
const view = this.findViewByIdx(viewIdx)
if (view) {
view.send('RELOAD')
view.send(event)
}
}
setViewBlurred(viewIdx, blurred) {
this.sendViewEvent(viewIdx, blurred ? 'BLUR' : 'UNBLUR')
}
reloadView(viewIdx) {
this.sendViewEvent(viewIdx, 'RELOAD')
}
openDevTools(viewIdx, inWebContents) {
const view = this.findViewByIdx(viewIdx)
view.send({ type: 'DEVTOOLS', inWebContents })
this.sendViewEvent(viewIdx, { type: 'DEVTOOLS', inWebContents })
}
send(...args) {

View File

@@ -83,6 +83,8 @@ async function main() {
streamWindow.setViews(new Map(msg.views))
} else if (msg.type === 'set-listening-view') {
streamWindow.setListeningView(msg.viewIdx)
} else if (msg.type === 'set-view-blurred') {
streamWindow.setViewBlurred(msg.viewIdx, msg.blurred)
} else if (msg.type === 'set-custom-streams') {
const customIDGen = new StreamIDGenerator(idGen)
clientState.customStreams = customIDGen.process(msg.streams)

View File

@@ -102,7 +102,7 @@ const viewStateMachine = Machine(
},
},
running: {
initial: 'muted',
type: 'parallel',
entry: 'positionView',
on: {
DISPLAY: {
@@ -114,15 +114,33 @@ const viewStateMachine = Machine(
],
cond: 'contentUnchanged',
},
MUTE: '.muted',
UNMUTE: '.listening',
},
states: {
muted: {
entry: 'muteAudio',
audio: {
initial: 'muted',
on: {
MUTE: '.muted',
UNMUTE: '.listening',
},
states: {
muted: {
entry: 'muteAudio',
},
listening: {
entry: 'unmuteAudio',
},
},
},
listening: {
entry: 'unmuteAudio',
video: {
initial: 'normal',
on: {
BLUR: '.blurred',
UNBLUR: '.normal',
},
states: {
normal: {},
blurred: {},
},
},
},
},