cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1548
Views
0
Helpful
2
Comments
Jaime MATEUS Gomes
Spotlight
Spotlight

Hello Experts.

 

We would like to write macro to create a button to switch sources during a call. The only possible view today is content on upside and participants down. This is not the best experience for user's perspective.

 

Someone, could please help-me send a macro code to do this challenge?

 

Vertical SetVertical Set

2 Comments
Bobby McGonigle
Level 1
Level 1

Hello,

You can use a macro to adjust Monitor role settings. This specific macro below, was made for an Sx80/pro, so you will need to. edit to avoid an errors, as the system you're using has no third output.

I used the Group Button for this code, and the Values for each button, are each case in the script.

Good Luck, and hopefully this helps. 

const xapi = require('xapi');

xapi.event.on('UserInterface Extensions Widget Action', (event) => {
  if (event.Type == 'released'){
        switch(event.Value){
            case 'display_scene_1': // Far End Presentation Mode
                xapi.command('UserInterface Message TextLine Clear');
                xapi.command('UserInterface Message TextLine Display', {
                                                                  Text: 'Layout: Default',
                                                                  Duration: 30,
                                                                  X: 5000,
                                                                  Y: 10000
                });
                console.log('LayoutSelected= Default');
                xapi.config.set('Video Output Connector 1 MonitorRole', 'first');
                xapi.config.set('Video Output Connector 2 MonitorRole', 'first');
                xapi.config.set('Video Output Connector 3 MonitorRole', 'first');
                xapi.command('Video Layout LayoutFamily Set', {
                              Target: 'Local',
                              LayoutFamily: 'Prominent',
                });
                break;
            case 'display_scene_2': // Local Presentation Mode
                xapi.command('UserInterface Message TextLine Clear');
                xapi.command('UserInterface Message TextLine Display', {
                                                                  Text: 'Layout: Local Presenter',
                                                                  Duration: 30,
                                                                  X: 5000,
                                                                  Y: 10000
                });
                console.log('LayoutSelected= Local Presenter');
                xapi.config.set('Video Output Connector 1 MonitorRole', 'second');
                xapi.config.set('Video Output Connector 2 MonitorRole', 'first');
                xapi.config.set('Video Output Connector 3 MonitorRole', 'first');
                break;
            case 'display_scene_3':// Presentation All Mode
                xapi.command('UserInterface Message TextLine Clear');
                xapi.command('UserInterface Message TextLine Display', {
                                                                  Text: 'Layout: Shared Content Only',
                                                                  Duration: 30,
                                                                  X: 5000,
                                                                  Y: 10000
                });
                console.log('LayoutSelected= Shared Content Only');
                xapi.config.set('Video Output Connector 1 MonitorRole', 'first');
                xapi.config.set('Video Output Connector 2 MonitorRole', 'first');
                xapi.config.set('Video Output Connector 3 MonitorRole', 'first');
                xapi.command('Video Layout LayoutFamily Set', {
                              Target: 'Local',
                              LayoutFamily: 'Single',
                });
                break;
            case 'display_scene_5':// Presentation All w/Far PIP && Far End All
                xapi.command('UserInterface Message TextLine Clear');
                xapi.command('UserInterface Message TextLine Display', {
                                                                  Text: 'Layout: Shared Content w/Remote PIP Dual',
                                                                  Duration: 30,
                                                                  X: 5000,
                                                                  Y: 10000
                });
                console.log('LayoutSelected= Shared Content w/Remote PIP Dual');
                xapi.config.set('Video Output Connector 1 MonitorRole', 'first');
                xapi.config.set('Video Output Connector 2 MonitorRole', 'first');
                xapi.config.set('Video Output Connector 3 MonitorRole', 'first');
                xapi.command('Video Layout LayoutFamily Set', {
                              Target: 'Local',
                              LayoutFamily: 'overlay',
                });
                break;
            case 'display_scene_4':
                xapi.command('UserInterface Message TextLine Clear');
                xapi.command('UserInterface Message TextLine Display', {
                                                                  Text: 'Layout: Shared Content w/Remote PIP Single',
                                                                  Duration: 30,
                                                                  X: 5000,
                                                                  Y: 10000
                });
                console.log('LayoutSelected= Shared Content w/Remote PIP Single');
                xapi.config.set('Video Output Connector 1 MonitorRole', 'first');// Output 1 = First
                xapi.config.set('Video Output Connector 2 MonitorRole', 'presentationonly');
                xapi.config.set('Video Output Connector 3 MonitorRole', 'first');// Output 2 = First
                xapi.command('Video Layout LayoutFamily Set', {
                              Target: 'Local',
                              LayoutFamily: 'overlay',
                });
                break;
           case 'display_scene_6':// Button VALUE ID
              console.log('LayoutSelected= Half and Half');
                xapi.config.set('Video Output Connector 1 MonitorRole', 'first');// Output 1 = First
                xapi.config.set('Video Output Connector 2 MonitorRole', 'first');
                xapi.config.set('Video Output Connector 3 MonitorRole', 'first');// Output 2 = First
                xapi.command('Video Layout LayoutFamily Set', {
                              Target: 'Local',
                              LayoutFamily: 'equal',
                });
                break;
            default:
                break;
        }
  }
});
Jaime MATEUS Gomes
Spotlight
Spotlight

Hello.

I belive that I found the solution, please refer to: API Reference Guide CE 9.7

 

So, the macro code would be like:

Macro Code Switch_Display.JPG

 

Unfortunately, this code does not compile. (error in writting).

We are almost there, seems to be close to solve it !

 

Thank You for any helping.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links