Skip to content

Commit

Permalink
Add status polling to evade iOS websocket idle lag problem.
Browse files Browse the repository at this point in the history
TBD display the status
  • Loading branch information
jmkao committed Dec 6, 2020
1 parent 2b80757 commit 9eb0a4d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -89,6 +91,7 @@ export default {
obsIsConnected: false,
obsBtnLabel: 'Connect',
obsAddressLabel: 'OBS Address',
obsStreamingStatus: null,
obs: {},
scenes: [],
sources: [],
Expand Down Expand Up @@ -117,7 +120,7 @@ export default {
},
destroyed: function () {
try {
this.obs.disconnect()
this.disconnectOBS()
} catch (err) {
// Do nothing
}
Expand Down Expand Up @@ -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
},
Expand Down

0 comments on commit 9eb0a4d

Please sign in to comment.