diff --git a/README.md b/README.md index 1f20dda..a0f14ef 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This project is a demonstration of integrating the popular [video.js](https://vi ``` 2. [Create a Dolby.io account](https://streaming.dolby.io/signup) and create a publish token from the "Live Broadcast" menu. 3. Set the environment variable `VITE_WHEP_URL` to a WHEP URL from the [Dolby.io Real-time streaming dashboard](https://streaming.dolby.io/#/tokens). Find this in the "API" tab once you have selected your publish token. +4. OPTIONAL: Set the environment variable `VITE_WHEP_TOKEN` if your WHEP server requires bearer token. If this env is unset, no bearer token is transfered in WHEP communication. ## Run the example 1. Ensure you are in the `examples` folder. diff --git a/example/main.js b/example/main.js index 7b77a8c..2500095 100644 --- a/example/main.js +++ b/example/main.js @@ -8,6 +8,8 @@ const params = new Proxy(new URLSearchParams(window.location.search), { }) const whepUrl = params.whepUrl ? params.whepUrl : import.meta.env.VITE_WHEP_URL +const whepTokenInput = params.whepToken ? params.whepToken : import.meta.env.VITE_WHEP_TOKEN +const whepToken = whepTokenInput ? whepTokenInput : null; videojs.registerPlugin('MillicastWhepPlugin', MillicastWhepPlugin) @@ -19,5 +21,5 @@ const options = { // Initialize Video.js player videojs('my-video', options, function onPlayerReady () { videojs.log('Your player is ready!') - this.MillicastWhepPlugin({ url: whepUrl }) + this.MillicastWhepPlugin({ url: whepUrl, token: whepToken }) }) diff --git a/videojs-whep-viewer.js b/videojs-whep-viewer.js index d8d8048..44fff63 100644 --- a/videojs-whep-viewer.js +++ b/videojs-whep-viewer.js @@ -91,7 +91,7 @@ export default class MillicastWhepPlugin extends Plugin { direction: 'recvonly' }) - await this.whep.view(this.pc, options.url) + await this.whep.view(this.pc, options.url, options.token) this.modal.close() // Add tracks transceiver receiver tracks to our Media Stream object