[Webkit-unassigned] [Bug 278672] Regression: Creating peer connection fails on Safari 17.5+ with IPv6-only network
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Aug 26 22:13:11 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=278672
--- Comment #5 from Byungseon(Sun) Shin <sun.shin at webkit.org> ---
Comment on attachment 472308
--> https://bugs.webkit.org/attachment.cgi?id=472308
ice binding test
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ICE Connection Test</title>
</head>
<body>
<h1>ICE Connection Test</h1>
<video id="localVideo" playsinline autoplay muted></video>
<video id="remoteVideo" playsinline autoplay></video>
<p>
<button id="startButton">Start ICE Test</button>
<pre id="output"></pre>
<script>
const startButton = document.getElementById('startButton');
const output = document.getElementById('output');
const localVideo = document.getElementById('localVideo');
const remoteVideo = document.getElementById('remoteVideo');
startButton.addEventListener('click', startTest);
async function startTest() {
const configuration = {
iceServers: [
{ urls: 'stun:stun.l.google.com:19302' } // Example STUN server
]
};
const localPeer = new RTCPeerConnection(configuration);
const remotePeer = new RTCPeerConnection(configuration);
localPeer.onicecandidate = (event) => {
if (event.candidate) {
remotePeer.addIceCandidate(event.candidate);
log(`Local ICE candidate: ${event.candidate.candidate}`);
}
};
remotePeer.onicecandidate = (event) => {
if (event.candidate) {
localPeer.addIceCandidate(event.candidate);
log(`Remote ICE candidate: ${event.candidate.candidate}`);
}
};
localPeer.oniceconnectionstatechange = () => {
log(`Local ICE connection state: ${localPeer.iceConnectionState}`);
};
remotePeer.oniceconnectionstatechange = () => {
log(`Remote ICE connection state: ${remotePeer.iceConnectionState}`);
};
remotePeer.addEventListener('track', (event) => {
gotRemoteStream(event);
});
try {
let localStream;
//localPeer.createDataChannel('testChannel');
const offerOptions = {
offerToReceiveAudio: 1,
offerToReceiveVideo: 1
};
const stream = await navigator.mediaDevices.getUserMedia({audio: true, video: true});
localVideo.srcObject = stream;
localStream = stream;
const videoTracks = localStream.getVideoTracks();
const audioTracks = localStream.getAudioTracks();
if (videoTracks.length > 0) {
console.log(`Using video device: ${videoTracks[0].label}`);
}
if (audioTracks.length > 0) {
console.log(`Using audio device: ${audioTracks[0].label}`);
}
localStream.getTracks().forEach(track => localPeer.addTrack(track, localStream));
const offer = await localPeer.createOffer();
await localPeer.setLocalDescription(offer);
log('Local peer created and set local offer');
await remotePeer.setRemoteDescription(offer);
log('Remote peer set remote offer');
const answer = await remotePeer.createAnswer();
await remotePeer.setLocalDescription(answer);
log('Remote peer created and set local answer');
await localPeer.setRemoteDescription(answer);
log('Local peer set remote answer');
} catch (error) {
log(`Error: ${error}`);
}
}
function gotRemoteStream(e) {
if (remoteVideo.srcObject !== e.streams[0]) {
remoteVideo.srcObject = e.streams[0];
console.log('remote peer received remote stream');
}
}
function log(message) {
output.textContent += `${message}\n`;
}
</script>
</body>
</html>
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240827/32ad91f0/attachment-0001.htm>
More information about the webkit-unassigned
mailing list