import { View, Director } from '@wowzamediasystems/sdk-rts'
//Define getSubscriber as callback for Subscribe
const streamName = "My Wowza Stream Name"
const accountId = "Wowza Publisher account Id"
const tokenGenerator = () => Director.getSubscriber({streamName, accountId})
//... or for an secure stream
const tokenGenerator = () => Director.getSubscriber({streamName, accountId, subscriberToken: '176949b9e57de248d37edcff1689a84a047370ddc3f0dd960939ad1021e0b744'})
//Create a new instance
const wowzaView = new View(streamName, tokenGenerator)
//Set track event handler to receive streams from Publisher.
wowzaView.on('track', (event) => {
addStreamToYourVideoTag(event.streams[0])
})
//View Options
const options = {
}
//Start connection to broadcast
await wowzaView.connect(options)