Allow background color to be specified

This commit is contained in:
Max Goodhart
2020-06-22 17:14:07 -07:00
parent 6119f52c23
commit 465254b869
3 changed files with 13 additions and 6 deletions

View File

@@ -16,8 +16,9 @@ import {
} from '../constants' } from '../constants'
export default class StreamWindow extends EventEmitter { export default class StreamWindow extends EventEmitter {
constructor() { constructor({ backgroundColor = '#000' }) {
super() super()
this.backgroundColor = backgroundColor
this.win = null this.win = null
this.offscreenWin = null this.offscreenWin = null
this.overlayView = null this.overlayView = null
@@ -30,7 +31,7 @@ export default class StreamWindow extends EventEmitter {
title: 'Streamwall', title: 'Streamwall',
width: WIDTH, width: WIDTH,
height: HEIGHT, height: HEIGHT,
backgroundColor: '#000', backgroundColor: this.backgroundColor,
useContentSize: true, useContentSize: true,
show: false, show: false,
}) })
@@ -103,7 +104,7 @@ export default class StreamWindow extends EventEmitter {
sandbox: true, sandbox: true,
}, },
}) })
view.setBackgroundColor('#000') view.setBackgroundColor(this.backgroundColor)
const machine = viewStateMachine const machine = viewStateMachine
.withContext({ .withContext({

View File

@@ -59,6 +59,10 @@ async function main() {
boolean: true, boolean: true,
default: true, default: true,
}) })
.option('background-color', {
describe: 'Background color of wall (useful for chroma-keying)',
default: '#000',
})
.help().argv .help().argv
// Reject all permission requests from web content. // Reject all permission requests from web content.
@@ -70,7 +74,9 @@ async function main() {
const idGen = new StreamIDGenerator() const idGen = new StreamIDGenerator()
const streamWindow = new StreamWindow() const streamWindow = new StreamWindow({
backgroundColor: argv.backgroundColor,
})
streamWindow.init() streamWindow.init()
let browseWindow = null let browseWindow = null

View File

@@ -12,11 +12,11 @@ const VIDEO_OVERRIDE_STYLE = `
} }
html, body, video { html, body, video {
display: block !important; display: block !important;
background: black !important; background: transparent !important;
} }
html, body { html, body {
overflow: hidden !important; overflow: hidden !important;
background: black !important; background: transparent !important;
} }
video, iframe.__video__ { video, iframe.__video__ {
display: block !important; display: block !important;