constructor
This commit is contained in:
DylanSpeiser-BMD 2024-07-09 09:55:57 -07:00
parent 3c1c8aaed5
commit 2e6676f50b
2 changed files with 6 additions and 4 deletions

View file

@ -190,9 +190,9 @@ class BMDevice {
// Child Class Specifically for Cameras
class BMCamera extends BMDevice {
// Child class constructor
// Just passing the hostname to the superclass's constructor
constructor(hostname) {
super(hostname);
// Just passing the hostname and security to the superclass's constructor
constructor(hostname, secure=false) {
super(hostname, secure);
}
// Sets the white balance and tint based on the following preset:

View file

@ -85,7 +85,9 @@ For more information about using the BMD REST API and how I wrote `BMDevice.js`,
### Basic Use
You are more than welcome to use this JavaScript class in your own projects. Just include the file (with its attributions).
Cameras are represented as BMCamera objects, instantiated with the `new` keyword and the constructor, which takes the hostname as a String argument. If you are using this file to control a HyperDeck, instantiate it as a `BMDevice` object.
Cameras are represented as BMCamera objects, instantiated with the `new` keyword and the constructor, which takes the hostname as a String argument. The constructor also (optionally) takes another boolean argument for whether or not to use HTTPS and WSS requests rather than their unsecre counterparts. In order to use the secure protocols, you must generate a certificate in **Blackmagic Camera Setup**.
If you are using this file to control a HyperDeck, instantiate it as a `BMDevice` object.
### Updating the UI
After instantiation, the constructor automatically subscribes to and pulls data from every available WebSocket property. If you don't like this, comment out lines 93-98 of `BMDevice.js`.