Skip to content

Instantly share code, notes, and snippets.

@murillo128
Created December 16, 2021 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save murillo128/77d6c8d6a860aedae6ac883d8543d897 to your computer and use it in GitHub Desktop.
Save murillo128/77d6c8d6a860aedae6ac883d8543d897 to your computer and use it in GitHub Desktop.
//Create a new instance
const millicastView = new View(streamName, tokenGenerator, video)
//Start connection to publisher
await millicastView.connect({
events: ["active", "inactive", "vad", "layers"]
})
millicastView.on("broadcastEvent", (event) =>
{
//Get event name and data
const { name, data } = event;
switch (name)
{
case "active":
//A source has been started on the steam
break;
case "inactive":
//A source has been stopped on the steam
break;
case "vad":
//A new source was multiplexed over the vad tracks
break;
case "layers":
//Updated layer information for each simulcast/svc video track
break;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment