From 9eb0a4db77cb0343bed5b2e284af434d5af11a27 Mon Sep 17 00:00:00 2001 From: James Kao Date: Sat, 5 Dec 2020 16:54:33 -0800 Subject: [PATCH] Add status polling to evade iOS websocket idle lag problem. TBD display the status --- src/layouts/MainLayout.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index edd9e46..b48114d 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -79,6 +79,8 @@ import SourcePanel from 'components/SourcePanel.vue' import FaderPanel from 'components/FaderPanel.vue' import MidiHub from 'components/MidiHub.vue' +var interval = null + export default { name: 'MainLayout', components: { ScenePanel, SourcePanel, FaderPanel, MidiHub }, @@ -89,6 +91,7 @@ export default { obsIsConnected: false, obsBtnLabel: 'Connect', obsAddressLabel: 'OBS Address', + obsStreamingStatus: null, obs: {}, scenes: [], sources: [], @@ -117,7 +120,7 @@ export default { }, destroyed: function () { try { - this.obs.disconnect() + this.disconnectOBS() } catch (err) { // Do nothing } @@ -164,8 +167,17 @@ export default { .catch(err => { this.onOBSError(err) }) + + clearInterval(interval) + interval = setInterval(this.obsInterval, 1000) + }, + obsInterval () { + this.obs.send('GetStreamingStatus').then(data => { + this.obsStreamingStatus = data + }) }, disconnectOBS () { + clearInterval(interval) this.obs.disconnect() this.obsConnectionPending = false },