Initial commit
This commit is contained in:
107
Backend/dist/Integrations/buildin/wirecast/actions/setLiveByName.js
vendored
Normal file
107
Backend/dist/Integrations/buildin/wirecast/actions/setLiveByName.js
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
exports.__esModule = true;
|
||||
module.exports = function (ActionAPI) {
|
||||
ActionAPI.handle(function (properties, status) {
|
||||
var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
|
||||
var shotID = properties.shotID != undefined && properties.shotID.length > 0 ? properties.shotID : 'none';
|
||||
if (connectionID != 'none') {
|
||||
if (shotID != 'none') {
|
||||
var connection = ActionAPI.getConnection('wirecast-bridge', connectionID);
|
||||
if (connection && connection.instance) {
|
||||
connection.instance
|
||||
.setShotLiveByID(shotID)
|
||||
.then(function () {
|
||||
status('Shot has been published', 'info');
|
||||
})["catch"](function (error) {
|
||||
status(error, 'error');
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
status('No shot specified', 'error');
|
||||
}
|
||||
else
|
||||
status('No connection specified', 'error');
|
||||
});
|
||||
function filterValues(values) {
|
||||
var newValues = [
|
||||
{ id: 'none', text: 'None' }
|
||||
];
|
||||
for (var i = 0; i < values.length; i++)
|
||||
if (values[i].text != 'Clear Layer')
|
||||
newValues.push(values[i]);
|
||||
return newValues;
|
||||
}
|
||||
ActionAPI.onOpenEditor(function (EditorAPI, properties) {
|
||||
var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
|
||||
var shotID = properties.shotID != undefined ? properties.shotID : 'none';
|
||||
var connection = ActionAPI.getConnection('wirecast-bridge', connectionID);
|
||||
var connectionField = {
|
||||
id: 'connectionID',
|
||||
name: 'Connection',
|
||||
type: 'connection',
|
||||
connectionType: 'wirecast-bridge',
|
||||
value: connectionID
|
||||
};
|
||||
var shotsField = {
|
||||
id: 'shotID',
|
||||
name: 'Shot',
|
||||
type: 'select',
|
||||
values: [],
|
||||
value: shotID
|
||||
};
|
||||
var fields = [
|
||||
connectionField
|
||||
];
|
||||
if (connectionID != 'none') {
|
||||
shotsField.values = [
|
||||
{ id: '%loading%', text: 'Please wait for shots dropdown to load' }
|
||||
];
|
||||
}
|
||||
EditorAPI.setFields(fields);
|
||||
var sendFields = function () {
|
||||
shotsField.value = shotID;
|
||||
EditorAPI.setFields([
|
||||
connectionField,
|
||||
shotsField
|
||||
]);
|
||||
};
|
||||
var updateShots = function () {
|
||||
if (connection != undefined && connection.instance != undefined) {
|
||||
connection.instance.getShotsList(null, function (shots) {
|
||||
shotsField.values = filterValues(shots.map(function (shot) {
|
||||
return { id: shot.id, text: shot.name };
|
||||
}));
|
||||
sendFields();
|
||||
});
|
||||
}
|
||||
else
|
||||
sendFields();
|
||||
};
|
||||
updateShots();
|
||||
EditorAPI.onFieldChanges(function (fields) {
|
||||
var fieldObject = EditorAPI.tools.objectifyFieldsValues(fields);
|
||||
connectionField.value = fieldObject.connectionID;
|
||||
shotsField.value = fieldObject.shotID;
|
||||
EditorAPI.saveProperties({ connectionID: fieldObject.connectionID, shotID: fieldObject.shotID });
|
||||
if (connectionID != fieldObject.connectionID) {
|
||||
connectionID = fieldObject.connectionID;
|
||||
shotsField.values = [
|
||||
{ id: '%loading%', text: 'Please wait for shots dropdown to load' }
|
||||
];
|
||||
EditorAPI.setFields([
|
||||
connectionField,
|
||||
shotsField
|
||||
]);
|
||||
if (connectionID != 'none') {
|
||||
connection = ActionAPI.getConnection('wirecast-bridge', connectionID);
|
||||
updateShots();
|
||||
}
|
||||
else {
|
||||
shotsField.values = [];
|
||||
sendFields();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=setLiveByName.js.map
|
||||
Reference in New Issue
Block a user