The Producer class is used to create a stream from a browser to a PulseVision room.
let isLoading = false;const producer = new Producer({ domain: 'https://app.pulsevision.io', apiToken: 'YOUR-API-TOKEN', roomName: 'user1', meta: { username: 'user1@example.com' }, debug: true});producer.on('connected', () => { isLoading = false; console.log('Connected');});producer.on('disconnected', () => { console.log('Disconnected');});producer.on('error', (error) => { console.log('Error', error);});// To start the streamtry { isLoading = true; producer.connect();} catch (error) { if (error instanceof CredentialsInvalidError) { console.log('Credentials are invalid'); }}// To stop the streamproducer.disconnect(); Copy
let isLoading = false;const producer = new Producer({ domain: 'https://app.pulsevision.io', apiToken: 'YOUR-API-TOKEN', roomName: 'user1', meta: { username: 'user1@example.com' }, debug: true});producer.on('connected', () => { isLoading = false; console.log('Connected');});producer.on('disconnected', () => { console.log('Disconnected');});producer.on('error', (error) => { console.log('Error', error);});// To start the streamtry { isLoading = true; producer.connect();} catch (error) { if (error instanceof CredentialsInvalidError) { console.log('Credentials are invalid'); }}// To stop the streamproducer.disconnect();
The options used to configure the Producer.
Private
Optional
Readonly
Connects to PulseVision, requests access to capture the screen, and starts streaming to the room.
Disconnects from PulseVision and stops streaming to the room.
Stop listening for events.
Start listening for events.
Generated using TypeDoc
The Producer class is used to create a stream from a browser to a PulseVision room.
Example