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

Stream and recording start/stop event notification #338

Open
WolfeComputerServices opened this issue Feb 20, 2022 · 4 comments
Open

Stream and recording start/stop event notification #338

WolfeComputerServices opened this issue Feb 20, 2022 · 4 comments

Comments

@WolfeComputerServices
Copy link

Is there a way for a plugin (or other method) to be notified (for the purpose of causing an outside action) to "notified" when a stream starts and stops and when a recording starts and stops?

@SML-MeSo
Copy link
Collaborator

I think the functionality you are looking for is in the ChannelManager class. You need to bind separately to the stream-start and stream-end events, but both of them should return a StreamInfo object which contains the channel name and other stats.

@WolfeComputerServices
Copy link
Author

WolfeComputerServices commented Feb 22, 2022 via email

@SML-MeSo
Copy link
Collaborator

SML-MeSo commented Feb 23, 2022

I'm afraid we don't have separate events for streaming and recording. You can, however, check in the event itself which channel (stream) or recording triggered the event, as shown below:

xjs.ChannelManager.on('stream-start', function(res) {
  if (!res.error) { // No error
    const { channel } = res; // StreamInfo Object

    // const name = channel.getName();
    // if (name === 'Local Recording') {
    if (channel._channel.serviceName === 'LocalRecording') {
      console.log('LOCAL RECORDING STARTED!!!')
    } else {
      console.log('STREAM STARTED!!!')
    }
  }
});

The commented lines are the previous codes used to check for local recording. But this is now insufficient since this only shows the local recording for the active scene. Recent changes to XBC allowed recording of non-active scenes, which use a different channel name, but with still the same service name.

@WolfeComputerServices
Copy link
Author

WolfeComputerServices commented Feb 23, 2022 via email

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