snapshot of https://github.com/pion/webrtc.git (main, 2026-09-15; blobs > 131072B omitted)
Some checks failed
REUSE Compliance Check / lint (push) Failing after 0s
Browser E2E / Test (push) Failing after 3s
Test / test (1.24) (push) Failing after 0s
Test / test-i386 (1.25) (push) Failing after 0s
Test / test-i386 (1.24) (push) Failing after 0s
Test / test-windows (1.25) (push) Failing after 0s
Test / test-windows (1.24) (push) Failing after 0s
Test / test (1.25) (push) Failing after 0s
Examples Tests / Test (push) Failing after 3s
Test / test-macos (1.25) (push) Failing after 0s
Test / test-macos (1.24) (push) Failing after 0s
Go mod tidy / tidy (push) Failing after 0s
Test / test-wasm (push) Failing after 0s
CodeQL / analyze (push) Failing after 1s
Fuzz / fuzz (push) Failing after 0s
Some checks failed
REUSE Compliance Check / lint (push) Failing after 0s
Browser E2E / Test (push) Failing after 3s
Test / test (1.24) (push) Failing after 0s
Test / test-i386 (1.25) (push) Failing after 0s
Test / test-i386 (1.24) (push) Failing after 0s
Test / test-windows (1.25) (push) Failing after 0s
Test / test-windows (1.24) (push) Failing after 0s
Test / test (1.25) (push) Failing after 0s
Examples Tests / Test (push) Failing after 3s
Test / test-macos (1.25) (push) Failing after 0s
Test / test-macos (1.24) (push) Failing after 0s
Go mod tidy / tidy (push) Failing after 0s
Test / test-wasm (push) Failing after 0s
CodeQL / analyze (push) Failing after 1s
Fuzz / fuzz (push) Failing after 0s
This commit is contained in:
81
examples/play-from-disk-renegotiation/index.html
Normal file
81
examples/play-from-disk-renegotiation/index.html
Normal file
@@ -0,0 +1,81 @@
|
||||
<html>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
|
||||
SPDX-License-Identifier: MIT
|
||||
-->
|
||||
<head>
|
||||
<title>play-from-disk-renegotiation</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<button onclick="window.addVideo()"> Add Video </button><br />
|
||||
<button onclick="window.removeVideo()"> Remove Video </button><br />
|
||||
|
||||
|
||||
<h3> Video </h3>
|
||||
<div id="remoteVideos"></div> <br />
|
||||
|
||||
<h3> Logs </h3>
|
||||
<div id="logs"></div>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
let activeVideos = 0
|
||||
let pc = new RTCPeerConnection({
|
||||
iceServers: [
|
||||
{
|
||||
urls: 'stun:stun.l.google.com:19302'
|
||||
}
|
||||
]
|
||||
})
|
||||
pc.ontrack = function (event) {
|
||||
var el = document.createElement(event.track.kind)
|
||||
el.srcObject = event.streams[0]
|
||||
el.autoplay = true
|
||||
el.controls = true
|
||||
|
||||
event.track.onmute = function(event) {
|
||||
el.parentNode.removeChild(el);
|
||||
}
|
||||
|
||||
document.getElementById('remoteVideos').appendChild(el)
|
||||
}
|
||||
|
||||
let doSignaling = method => {
|
||||
pc.createOffer()
|
||||
.then(offer => {
|
||||
pc.setLocalDescription(offer)
|
||||
|
||||
return fetch(`/${method}`, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(offer)
|
||||
})
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(res => pc.setRemoteDescription(res))
|
||||
.catch(alert)
|
||||
}
|
||||
|
||||
// Create a noop DataChannel. By default PeerConnections do not connect
|
||||
// if they have no media tracks or DataChannels
|
||||
pc.createDataChannel('noop')
|
||||
doSignaling('createPeerConnection')
|
||||
|
||||
window.addVideo = () => {
|
||||
if (pc.getTransceivers().length <= activeVideos) {
|
||||
pc.addTransceiver('video')
|
||||
activeVideos++
|
||||
}
|
||||
|
||||
doSignaling('addVideo')
|
||||
};
|
||||
|
||||
window.removeVideo = () => {
|
||||
doSignaling('removeVideo')
|
||||
};
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user