Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request : send event to obs-browser #25

Closed
Grummfy opened this issue Sep 10, 2022 · 4 comments
Closed

feature request : send event to obs-browser #25

Grummfy opened this issue Sep 10, 2022 · 4 comments

Comments

@Grummfy
Copy link
Contributor

Grummfy commented Sep 10, 2022

Hello,
I think a nice feature using the CallVendorRequest could be a specific call for the browser.

Here is an example :

    var response = await obsWebSocket.send('CallVendorRequest', {
      'vendorName': 'obs-browser',
      'requestType': 'emit_event',
      'requestData': {
        'event_name': 'obs-websocket-test-event',
        'event_data': {'my':'data', 'that':'will be displayed in an event'},
      },
    });

    print(response.toString());
    print(response?.requestType);
    print(response?.requestId);
    print(response?.requestStatus);
    print(response?.responseData);

this will display as

flutter: {"requestType":"CallVendorRequest","requestId":"e2bd885e-a382-4090-964b-98f90a76e7f9","requestStatus":{"result":true,"code":100,"comment":null},"responseData":{"requestType":"emit_event","responseData":{},"vendorName":"obs-browser"}}
flutter: CallVendorRequest
flutter: e2bd885e-a382-4090-964b-98f90a76e7f9
flutter: {"result":true,"code":100,"comment":null}
flutter: {requestType: emit_event, responseData: {}, vendorName: obs-browser}

In the browser, we can see the result

window.addEventListener('obs-websocket-test-event', function(event) {
	console.log(event.detail) //  {"my":"data","that":"will be displayed in an event"}
})

I think that adding an event to the browser could be really interesting, because it is a plugin that is really use everywhere.

obsproject/obs-browser#340 for the browser integration

@faithoflifedev
Copy link
Owner

faithoflifedev commented Sep 18, 2022

Hi @Grummfy,

Are you recommending something like:

await obsWebSocket.browserEvent(eventName: 'obs-websocket-test-event', eventData: {'my': 'data', 'that': 'will be displayed in an event'});

@Grummfy
Copy link
Contributor Author

Grummfy commented Sep 19, 2022

yes, something like this.

@faithoflifedev
Copy link
Owner

The package released today (v5.0.0+9) allows:

await obsWebSocket.general.obsBrowserEvent( eventName: 'obs-websocket-test-event', eventData: { 'my': 'data', 'that': 'will be displayed in an event', }, );

@Grummfy
Copy link
Contributor Author

Grummfy commented Sep 23, 2022

thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants