Skip to content

Commit

Permalink
fix issue #19
Browse files Browse the repository at this point in the history
  • Loading branch information
daniep01 committed Feb 22, 2024
1 parent 2215f9b commit f50cac1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions companion/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ Updates for WebPresenter firmware version 3.3
- Add an action for Custom URL platforms
- Add an action for simple YouTube configuration which only needs the key
- Add separate actions for Video Mode, Stream Quality, Stream Key and SRT Passphrase

## Version 2.1.1
Fix crash when device is disconnected from network or rebooted
2 changes: 1 addition & 1 deletion companion/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "bmd-webpresenter",
"shortname": "WebPresenter",
"description": "Live stream from any SDI video source direct to YouTube, Facebook, Twitter and more",
"version": "2.1.0",
"version": "2.1.1",
"license": "MIT",
"repository": "git+https://github.com/bitfocus/companion-module-bmd-webpresenter.git",
"bugs": "https://github.com/bitfocus/companion-module-bmd-webpresenter/issues",
Expand Down
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// BlackMagic Design Web Presenter HD and 4K

import { InstanceBase, Regex, runEntrypoint, TCPHelper } from '@companion-module/base'
import { InstanceBase, InstanceStatus, Regex, runEntrypoint, TCPHelper } from '@companion-module/base'
import { updateActions } from './actions.js'
import { updateFeedbacks } from './feedback.js'
import { updatePresets } from './presets.js'
Expand Down Expand Up @@ -70,6 +70,7 @@ class WebPresenter extends InstanceBase {
this.platforms = []
this.customPlatforms = []
this.timer = undefined
this.poll = false

console.log(this.config)

Expand Down Expand Up @@ -101,11 +102,14 @@ class WebPresenter extends InstanceBase {
this.socket.on('error', (err) => {
console.log('Network error', err)
this.log('error', 'Network error: ' + err.message)
this.updateStatus(InstanceStatus.ConnectionFailure, err.message)
this.poll = false
})

this.socket.on('connect', () => {
console.log('Connected')
// poll every second
this.poll = true
this.timer = setInterval(this.dataPoller.bind(this), 1000)
})

Expand Down Expand Up @@ -307,7 +311,6 @@ class WebPresenter extends InstanceBase {
this.log('debug', 'sending: ' + cmd)
if (cmd !== undefined) {
if (this.socket !== undefined) {
// && this.socket.connected) {
this.socket.send(cmd)
} else {
this.log('warn', 'Socket not connected')
Expand All @@ -316,8 +319,7 @@ class WebPresenter extends InstanceBase {
}

dataPoller() {
if (this.socket !== undefined) {
// && this.socket.connected) {
if (this.socket !== undefined && this.poll) {
this.socket.send('STREAM STATE:\n\n')
} else {
this.log('debug', 'dataPoller - Socket not connected')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bmd-webpresenter",
"version": "2.1.0",
"version": "2.1.1",
"main": "index.js",
"type": "module",
"scripts": {
Expand Down

0 comments on commit f50cac1

Please sign in to comment.