Skip to content

Commit

Permalink
if query param access_token
Browse files Browse the repository at this point in the history
is found in url,
then add Authorization to
/pub /sub requests
  • Loading branch information
cameronelliott committed Nov 4, 2021
1 parent fe962ab commit 7b5f74e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions html/deadsfu.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ window.onload = async function () {

let video1 = /** @type {HTMLVideoElement} */ (document.getElementById('video1'))
let searchParams = new URLSearchParams(window.location.search)
let bearerToken = searchParams.get('access_token')
if (searchParams.has('send')) {

pc.addEventListener('negotiationneeded', ev => whipwhap.handleNegotiationNeeded(ev, '/pub'))
pc.addEventListener('negotiationneeded', ev => whipwhap.handleNegotiationNeeded(ev, '/pub', bearerToken))

/** @type {MediaStream} */
var gum
Expand All @@ -51,7 +52,7 @@ window.onload = async function () {
document.title = "Sending"

} else {
pc.addEventListener('negotiationneeded', ev => whipwhap.handleNegotiationNeeded(ev, '/sub'))
pc.addEventListener('negotiationneeded', ev => whipwhap.handleNegotiationNeeded(ev, '/sub', bearerToken))

pc.addTransceiver('video', { 'direction': 'recvonly' }) // build sdp
pc.addTransceiver('audio', { 'direction': 'recvonly' }) // build sdp
Expand Down

0 comments on commit 7b5f74e

Please sign in to comment.