Skip to content
This repository was archived by the owner on Nov 5, 2023. It is now read-only.

Commit 7056ef4

Browse files
committed
Partial vMix implementation
1 parent 6ce8508 commit 7056ef4

File tree

8 files changed

+214
-76
lines changed

8 files changed

+214
-76
lines changed

app/src/app.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import dateFormat from 'date-fns/format'
1010
import Raven from 'raven-js';
1111
import RavenVue from 'raven-js/plugins/vue';
1212

13-
Raven
14-
.config('REMOVED')
15-
.addPlugin(RavenVue, Vue)
16-
.install();
13+
// Raven
14+
// .config('REMOVED')
15+
// .addPlugin(RavenVue, Vue)
16+
// .install();
1717

1818
const dateFormatPlugin = {
1919
install () {

app/src/router/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function createRouter () {
9595
path: 'vmix',
9696
component: SettingsVmixView,
9797
meta: {
98-
navbarTitle: 'vMix',
98+
navbarTitle: 'Connect to vMix',
9999
},
100100
},
101101
]

app/src/store/actions.js

+20
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import supportedLocales from '../data/locales'
99
import RemoteEventBus from '../components/RemoteEventBus'
1010
import ChromelessWindowManager from '../components/ChromelessWindowManager'
1111
import get from 'lodash.get'
12+
import vmixSetup from '../util/vmixSetup'
1213

1314
export default {
1415
SET_LOCALE_FROM_USER_DEFAULT: ({ commit, dispatch, state }) => {
@@ -72,6 +73,25 @@ export default {
7273
}
7374
},
7475

76+
REFRESH_VMIX_SETUP_STATUS: ({commit, dispatch, state}) => {
77+
let {
78+
checkIfExtensionInstalled,
79+
testWebControllerConnectivity,
80+
} = vmixSetup;
81+
82+
checkIfExtensionInstalled()
83+
.then(function(installed) {
84+
commit('SET_VMIX_CHROME_EXTENSION_INSTALLED', {installed});
85+
});
86+
testWebControllerConnectivity(
87+
(state.integrations.vmix.webControllerAddress || '').trim().replace(/\/$/, "") + '/API'
88+
)
89+
.then(function(connected) {
90+
console.log("HElLO");
91+
console.log(connected);
92+
commit('SET_VMIX_WEB_CONTROLLER_CONNECTED', {connected});
93+
})
94+
},
7595

7696

7797
// ensure data for rendering given list type

app/src/store/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ export function createStore () {
9696
socket: {
9797
isConnected: false,
9898
},
99+
integrations: {
100+
vmix: {
101+
chromeExtensionInstalled: null,
102+
webControllerAddress: '',
103+
webControllerConnected: null,
104+
},
105+
},
99106
},
100107
actions,
101108
mutations,

app/src/store/mutations.js

+12
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,18 @@ export default {
162162
},
163163

164164

165+
SET_VMIX_CHROME_EXTENSION_INSTALLED: (state, { installed }) => {
166+
state.integrations.vmix.chromeExtensionInstalled = Boolean(installed);
167+
},
168+
SET_VMIX_WEB_CONTROLLER_ADDRESS: (state, { webControllerAddress }) => {
169+
state.integrations.vmix.webControllerAddress = webControllerAddress;
170+
},
171+
SET_VMIX_WEB_CONTROLLER_CONNECTED: (state, { connected }) => {
172+
state.integrations.vmix.webControllerConnected = Boolean(connected);
173+
},
174+
RESET_WEB_CONTROLLER_CONNECTED_STATUS: (state) => {
175+
state.integrations.vmix.webControllerConnected = null;
176+
},
165177

166178

167179
SET_ACTIVE_TYPE: (state, { type }) => {

app/src/util/vmixSetup.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const chromeExtensionId = 'fckappdcgnijafmmjkcmicdidflhelfe';
2+
3+
const checkIfExtensionInstalled = function () {
4+
return new Promise(function(resolve, reject) {
5+
chrome.runtime.sendMessage(
6+
chromeExtensionId,
7+
{
8+
getExtensionVersion: true,
9+
},
10+
function(version) {
11+
resolve(Boolean(version));
12+
}
13+
);
14+
});
15+
}
16+
17+
const testWebControllerConnectivity = function (path) {
18+
return new Promise(function(resolve, reject) {
19+
chrome.runtime.sendMessage(
20+
chromeExtensionId,
21+
{path},
22+
function(response) {
23+
resolve(response && response.success && response.code && response.code == 200);
24+
// reject('Cannot connect to vMix. Make sure Web Controller is enabled in vMix and that you\'ve copied over the website address correctly.');
25+
}
26+
);
27+
})
28+
};
29+
30+
export default {checkIfExtensionInstalled, testWebControllerConnectivity}

app/src/views/SettingsView.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,17 @@ export default {
132132
}
133133
</script>
134134

135-
<style>
135+
136+
137+
138+
<style scoped>
136139
h3 {
137140
text-transform:uppercase;
138141
font-size:1.3rem;
139142
margin:1rem 0;
140143
}
141144
142-
.settings-view .nav-pills {
145+
.nav-pills {
143146
font-size:0.92rem;
144147
}
145148
</style>
+135-69
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,146 @@
11
<template>
22
<div class="settings-vmix-view">
3-
<p><a href="https://vmix.com" target="_blank">vMix</a> is a popular software video mixer and switcher. You can send text directly to vMix and display it in a title input. You can then use vMix's font and color controls to style captioned text. <a href="/help/integrations/vmix/">Visit the Help Center</a> for more information.</p>
4-
<!--
5-
<button id="sendToVmixSettingToggle" type="button" class="btn btn-secondary btn-block" disabled autocomplete="off">
6-
<i class="fa fa-times mr-2" aira-hidden="true"></i>Send to vMix is <span id="send-to-vmix-status-text">off</span>
7-
</button>
8-
-->
9-
<hr/>
10-
<div class="vmixStep" data-vmix-step="1" data-error-state="false">
11-
<h3>
12-
<span class="badge badge-danger pt-2 mr-2" data-toggle="tooltip" data-placement="top" title="Not complete"><i class="fa fa-exclamation-triangle"></i></span>
13-
<span class="badge badge-success pt-2 mr-2" hidden><i class="fa fa-check"></i> Done</span>
14-
<a href="#vmixStep1" data-toggle="collapse" aria-expanded="false" aria-controls="vmixStep1">Step 1: Install the Chrome Extension</a>
15-
</h3>
16-
<div id="vmixStep1" class="collapse show ml-4">
17-
<p class="mb-2">
18-
The Web Captioner Connector extension enables your browser to send commands to vMix running on your computer or somewhere else on the network.
19-
</p>
20-
<button id="addExtensionToChromeButton" type="button" class="btn btn-info"><i class="fa fa-chrome mr-2"></i>Add to Chrome</button>
21-
<button id="extensionIsAddedToChromeButton" type="button" class="btn btn-success" hidden disabled><i class="fa fa-check mr-2"></i>Added to Chrome</button>
22-
</div>
23-
</div>
24-
<hr/>
25-
<div class="vmixStep" data-vmix-step="2" data-error-state="false">
26-
<h3>
27-
<span class="badge badge-danger pt-2 mr-2" data-toggle="tooltip" data-placement="top" title="Not complete"><i class="fa fa-exclamation-triangle"></i></span>
28-
<span class="badge badge-success pt-2 mr-2" hidden><i class="fa fa-check"></i> Done</span>
29-
<a href="#vmixStep2" data-toggle="collapse" aria-expanded="false" aria-controls="vmixStep2">Step 2: Enable vMix web controller</a>
30-
</h3>
31-
<div id="vmixStep2" class="collapse show">
32-
<ol class="ml-0 mb-2">
33-
<li>In vMix, go to <strong>Settings > Web Controller</strong>.</li>
34-
<li>Check the box to enable the <a href="http://www.vmix.com/knowledgebase/article.aspx/69/how-to-control-vmix-from-a-web-browser-using-vmix-web-controller" target="_blank">web controller</a>. Specify a port number or accept the default.</li>
35-
<li>Copy and paste the website address that appears in vMix here:</li>
36-
</ol>
37-
<div class="form-group ml-4 mb-2">
38-
<input type="url" id="vmixWebControllerAddress" class="form-control" placeholder="vMix Web Controller Address" required="true" />
39-
<p class="mb-2"><small class="form-text text-muted">Example: http://192.168.1.1:8080</small></p>
40-
</div>
41-
<p class="ml-4">
42-
<button class="btn btn-info" id="testConnectionButton"><i class="fa fa-check mr-2" hidden aria-hidden="true"></i>Test Connection</button>
43-
<i id="testConnectionSpinner" hidden class="fa fa-circle-o-notch fa-spin fa-fw"></i>
44-
<strong id="connectionSuccessMessage" hidden class="text-success ml-2">Success!</strong>
45-
<p id="couldNotConnectMessage" hidden class="text-danger ml-4"><strong>Could not connect. Check to make sure that vMix is running, web controller in vMix is enabled, and that the web controller address above is correct.</strong></p>
46-
</p>
47-
</div>
48-
</div>
49-
<hr/>
50-
<div class="vmixStep" data-vmix-step="3" data-error-state="false">
51-
<h3>
52-
<span class="badge badge-danger pt-2 mr-2" data-toggle="tooltip" data-placement="top" title="Not complete"><i class="fa fa-exclamation-triangle"></i></span>
53-
<span class="badge badge-success pt-2 mr-2" hidden><i class="fa fa-check"></i> Done</span>
54-
<a href="#vmixStep3" data-toggle="collapse" aria-expanded="false" aria-controls="vmixStep3">Step 3: Import the Web Captioner title template into vMix</a>
55-
</h3>
56-
<div id="vmixStep3" class="collapse show">
57-
<ol class="ml-0 mb-2">
58-
<li>Download the Web Captioner vMix title template:<br/> <a href="/web-captioner-title.xaml" class="btn btn-secondary mt-1 mb-2">Web Captioner vMix Title Template <i class="fa fa-external-link ml-1" aria-hidden="true"></i></a></li>
59-
<li>In vMix, go to <strong>Add Input > Title/XAML</strong>. In the upper right of the Input Select window, click <strong>Browse...</strong> and open the Web Captioner title template.</li>
60-
<li>The title will appear in the <strong>Recent</strong> tab. Double-click it.</li>
61-
<li>In the Title Editor that appears, optionally customize font and text size. Close it when you are finished.</li>
62-
<li>Test your imported title:</li>
63-
</ol>
64-
<div class="ml-4">
65-
<button class="btn btn-info" id="testVmixTitleButton"><i class="fa fa-check mr-2" hidden aria-hidden="true"></i>Send Test Message to vMix</button>
66-
<i id="testVmixTitleSpinner" hidden class="fa fa-circle-o-notch fa-spin fa-fw"></i>
67-
<p id="testVmixTitleSuccessMessage" style="font-weight:bold" hidden class="text-success ml-4">Success!</p>
68-
<p id="testVmixTitleErrorMessage" style="font-weight:bold" hidden class="text-danger ml-4">Error</p>
69-
</div>
70-
</div>
71-
</div>
3+
<p><a href="https://vmix.com" target="_blank">vMix</a> is a popular software video mixer and switcher. You can send text directly to vMix and display it in a title input. You can then use vMix's font and color controls to style captioned text. <a href="/help/integrations/vmix/">Visit the Help Center</a> to learn more.</p>
4+
<b-card no-body>
5+
<b-tabs small pills card class="nav-fill" v-model="vmixStepsTabIndex">
6+
<b-tab active>
7+
<template slot="title">
8+
<div class="text-md-left">
9+
<i class="fa fa-check" v-if="chromeExtensionInstalled" aria-hidden="true"></i> Step 1
10+
<div class="small d-none d-md-block"><span class="d-none d-xl-inline">Install </span>Chrome Extension</div>
11+
</div>
12+
</template>
13+
<h4 class="mt-0">Install the Chrome Extension</h4>
14+
<p class="mb-2">The Web Captioner Connector extension for Google Chrome lets Web Captioner connect to vMix.</p>
15+
<div class="mt-3 mb-4">
16+
<b-button v-if="!chromeExtensionInstalled" @click="initChromeExtensionInstall" variant="outline-info"><i class="fa fa-chrome mr-2"></i>Add to Chrome</b-button>
17+
<b-button v-else variant="outline-info" disabled><i class="fa fa-check mr-2"></i>Extension Installed</b-button>
18+
</div>
19+
<hr class="my-3" />
20+
<div class="text-right">
21+
<b-button @click="vmixStepsTabIndex = 1" size="sm" :variant="chromeExtensionInstalled ? 'secondary' : 'default'" :disabled="!chromeExtensionInstalled">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></b-button>
22+
</div>
23+
</b-tab>
24+
<b-tab :disabled="!chromeExtensionInstalled">
25+
<template slot="title">
26+
<div class="text-md-left" id="vmixStep2Tab">
27+
Step 2
28+
<div class="small d-none d-md-block">vMix Web Controller</div>
29+
</div>
30+
<b-tooltip v-if="!chromeExtensionInstalled" target="vmixStep2Tab">
31+
Complete step 1 first
32+
</b-tooltip>
33+
</template>
34+
<h4 class="mt-0">Enable the vMix Web Controller</h4>
35+
<p>In vMix, go to <strong>Settings > Web Controller</strong>. Check the box to enable the <a href="http://www.vmix.com/knowledgebase/article.aspx/69/how-to-control-vmix-from-a-web-browser-using-vmix-web-controller" target="_blank">web controller</a>. Specify a port number or accept the default.</p>
36+
<p>Provide the address that appears in vMix:</p>
37+
<b-input-group :class="{'append-embedded-in-input': webControllerConnected}">
38+
<input @keydown="resetWebControllerConnectedStatus()" v-model="webControllerAddress" type="url" class="form-control" placeholder="vMix Web Controller Address" required="true" />
39+
<template slot="append" v-if="webControllerConnected">
40+
<div class="input-group-text text-success">
41+
<i class="fa fa-check fa-fw pr-3" style="position:relative;top:-1px" aria-hidden="true"></i> Connected
42+
</div>
43+
</template>
44+
</b-input-group>
45+
<p class="mt-2"><small class="form-text text-muted">Example: http://192.168.1.1:8080</small></p>
46+
<b-alert :show="showConnectionFailureMessage" dismissible variant="danger">Cannot connect to vMix. Make sure Web Controller is enabled in vMix and that you've copied over the website address correctly. It should look something like this: http://192.168.1.1:8080</b-alert>
47+
<hr class="my-3" />
48+
<div class="text-right">
49+
<b-button @click="refreshVmixSetupStatus()" size="sm" :variant="webControllerAddress == '' ? 'default' : 'secondary'" :disabled="webControllerAddress == ''">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></b-button>
50+
</div>
51+
</b-tab>
52+
<b-tab>
53+
<template slot="title">
54+
<div class="text-md-left">
55+
Step 3
56+
<div class="small d-none d-md-block"><span class="d-none d-xl-inline">Import </span>Title Template</div>
57+
</div>
58+
</template>
59+
<h4 class="mt-0">Import the Web Captioner Title Template into vMix</h4>
60+
<ol class="ml-0 mb-2">
61+
<li>Download the Web Captioner vMix title template:<br/> <a href="/web-captioner-title.xaml" class="btn btn-outline-info mt-1 mb-2">Web Captioner vMix Title Template <i class="fa fa-external-link ml-1" aria-hidden="true"></i></a></li>
62+
<li>In vMix, go to <strong>Add Input > Title/XAML</strong>. In the upper right of the Input Select window, click <strong>Browse...</strong> and open the Web Captioner title template.</li>
63+
<li>The title will appear in the <strong>Recent</strong> tab. Double-click it.</li>
64+
<li>In the Title Editor that appears, optionally customize font and text size. Close it when you are finished.</li>
65+
</ol>
66+
<hr class="my-3" />
67+
<div class="text-right">
68+
<b-button size="sm" :variant="webControllerAddress == '' ? 'default' : 'secondary'" :disabled="webControllerAddress == ''">Test and Finish Setup</b-button>
69+
</div>
70+
</b-tab>
71+
</b-tabs>
72+
</b-card>
7273
</div>
7374
</template>
7475

76+
<style>
77+
.nav-link.disabled {
78+
color:#aaa!important;
79+
cursor:default;
80+
}
81+
.nav-link.disabled:hover {
82+
background:#eee;
83+
}
84+
85+
.input-group.append-embedded-in-input input {
86+
border-right: 0px solid transparent;
87+
}
88+
89+
.input-group.append-embedded-in-input .input-group-append .input-group-text {
90+
background-color: transparent;
91+
border-left: 0px solid transparent;
92+
}
93+
94+
</style>
95+
96+
7597
<script>
7698
7799
export default {
78100
name: 'settings-vmix-view',
101+
data: function() {
102+
return {
103+
vmixStepsTabIndex: 0,
104+
};
105+
},
106+
mounted: function() {
107+
this.refreshVmixSetupStatus();
108+
},
109+
methods: {
110+
initChromeExtensionInstall: function () {
111+
let self = this;
112+
chrome.webstore.install(null, function() {
113+
// Successful
114+
self.refreshVmixSetupStatus();
115+
}, function() {
116+
// Unsuccessful
117+
});
118+
},
119+
refreshVmixSetupStatus: function () {
120+
this.$store.dispatch('REFRESH_VMIX_SETUP_STATUS');
121+
},
122+
resetWebControllerConnectedStatus: function () {
123+
this.$store.commit('RESET_WEB_CONTROLLER_CONNECTED_STATUS');
124+
},
125+
},
126+
computed: {
127+
chromeExtensionInstalled: function() {
128+
return this.$store.state.integrations.vmix.chromeExtensionInstalled;
129+
},
130+
webControllerConnected: function() {
131+
return this.$store.state.integrations.vmix.webControllerConnected;
132+
},
133+
webControllerAddress: {
134+
get () {
135+
return this.$store.state.integrations.vmix.webControllerAddress;
136+
},
137+
set (webControllerAddress) {
138+
this.$store.commit('SET_VMIX_WEB_CONTROLLER_ADDRESS', {webControllerAddress});
139+
}
140+
},
141+
showConnectionFailureMessage: function () {
142+
return this.webControllerAddress != '' && this.webControllerConnected === false;
143+
},
144+
},
79145
}
80146
</script>

0 commit comments

Comments
 (0)