Skip to content

Commit

Permalink
retrive platform options from device
Browse files Browse the repository at this point in the history
  • Loading branch information
daniep01 committed Feb 25, 2022
1 parent e1ff766 commit e6b8574
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
4 changes: 2 additions & 2 deletions HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Module to control and monitor the [Blackmagic Design Web Presenter HD and 4K](https://www.blackmagicdesign.com/products/blackmagicwebpresenter). This module does not support the discontinued USB only **Web Presenter** product.

Once connection to the device has been established the stream 'Video Mode' and 'Quality' action parameters will be populated with the options that the device supports. If no device connection is possible then these parameters will be unavailable.
Once connection to the device has been established the stream 'Video Mode', 'Quality' and 'Platform' action parameters will be populated with the options that the device supports. If no device connection is possible then these parameters will be unavailable.

## Version 1.0.0
This first release of the module allows you to start/stop the stream and to receive the stream state as a variable and feedback. Please log issues and feature requests on [github](https://github.com/bitfocus/companion-module-bmd-webpresenterhd).
Expand All @@ -17,5 +17,5 @@ Internal changes
## Version 1.0.3
Add support for both 4K and HD
Add more variables for monitoring
Retrieve the 'Video Mode' and 'Quality' options from device
Retrieve the 'Video Mode', 'Quality' and 'Platform' options from device

37 changes: 27 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function instance(system) {
self.command = null
self.formats = []
self.quality = []
self.platforms = []

// super-constructor
instance_skel.apply(this, arguments)
Expand Down Expand Up @@ -68,6 +69,19 @@ instance.prototype.deviceInformation = function (key, data) {
self.actions()
}

if (data['Available Default Platforms'] !== undefined) {
p = data['Available Default Platforms'].split(',')
self.platforms = []
for (var i = 0; i < p.length; i++) {
self.platforms.push({ id: p[i].trim(), label: p[i].trim() })
}
self.has_data = true

console.log('platforms available from device:')
console.log(self.platforms)
self.actions()
}

if (data['Video Mode'] !== undefined) {
self.setVariable('video_mode', data['Video Mode'])
self.has_data = true
Expand Down Expand Up @@ -197,8 +211,8 @@ instance.prototype.init_tcp = function () {

self.stash = []
self.command = null
} else {
console.log('weird response from device: ' + line)
} else if (line.length > 0) {
console.log('weird response from device: ' + line.toString() + ' ' + line.length)
}
})
}
Expand Down Expand Up @@ -422,16 +436,25 @@ instance.prototype.actions = function () {
choices: self.formats,
},
{
type: 'textinput',
type: 'dropdown',
label: 'Platform',
id: 'platform',
default: 'YouTube',
choices: self.platforms,
},
{
type: 'textinput',
label: 'Server',
id: 'server',
default: 'Primary',
default: '',
tooltip: 'Depends on platform.\nRefer to Blackmagic Web Presenter desktop application for possible options.',
},
{
type: 'textinput',
label: 'Stream Key',
id: 'key',
default: '',
tooltip: 'Provided by the streaming platform.',
},
{
type: 'dropdown',
Expand All @@ -440,12 +463,6 @@ instance.prototype.actions = function () {
default: 'Streaming Medium',
choices: self.quality,
},
{
type: 'textinput',
label: 'Stream Key',
id: 'key',
default: '',
},
],
},
device: {
Expand Down

0 comments on commit e6b8574

Please sign in to comment.