Quality selector reload stream
This commit is contained in:
parent
24acfe1137
commit
392a9d7fc3
|
@ -2,8 +2,8 @@ document.getElementById("quality").addEventListener("change", (event) => {
|
||||||
console.log(`Stream quality changed to ${event.target.value}`)
|
console.log(`Stream quality changed to ${event.target.value}`)
|
||||||
|
|
||||||
// Restart the connection with a new quality
|
// Restart the connection with a new quality
|
||||||
// FIXME: set quality
|
peerConnection.close()
|
||||||
peerConnection.createOffer({ "iceRestart": true }).then(offer => {
|
peerConnection = null
|
||||||
return peerConnection.setLocalDescription(offer)
|
streamPath = window.location.href + event.target.value
|
||||||
}).catch(console.log)
|
startPeerConnection()
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
let peerConnection;
|
let peerConnection
|
||||||
|
let streamPath = window.location.href
|
||||||
|
|
||||||
startPeerConnection = () => {
|
startPeerConnection = () => {
|
||||||
// Init peer connection
|
// Init peer connection
|
||||||
|
@ -52,7 +53,7 @@ startPeerConnection = () => {
|
||||||
// The server replies with its description
|
// The server replies with its description
|
||||||
// After setRemoteDescription, the browser will fire ontrack events
|
// After setRemoteDescription, the browser will fire ontrack events
|
||||||
console.log("Sending session description to server")
|
console.log("Sending session description to server")
|
||||||
fetch(window.location.href + document.quality_form.quality.value, {
|
fetch(streamPath, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
|
Loading…
Reference in New Issue