<!-- These files are in place when executing on W3C. -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript"> var test = async_test('Can set up a basic WebRTC call with only data using promises.');
var gFirstConnection = null; var gSecondConnection = null;
var onIceCandidateToFirst = test.step_func(function(event) {
gSecondConnection.addIceCandidate(event.candidate);
});
var onIceCandidateToSecond = test.step_func(function(event) {
gFirstConnection.addIceCandidate(event.candidate);
});
var onIceConnectionStateChange = test.step_func(function(event) {
assert_equals(event.type, 'iceconnectionstatechange'); var stateinfo = document.getElementById('stateinfo');
stateinfo.innerHTML = 'First: ' + gFirstConnection.iceConnectionState
+ ' Second: ' + gSecondConnection.iceConnectionState;
// Note: All these combinations are legal states indicating that the
// call has connected. All browsers should end up in completed/completed,
// but as of this moment, we've chosen to terminate the test early.
// TODO: Revise test to ensure completed/completed is reached.
if (gFirstConnection.iceConnectionState == 'connected' &&
gSecondConnection.iceConnectionState == 'connected') {
test.done()
}
if (gFirstConnection.iceConnectionState == 'connected' &&
gSecondConnection.iceConnectionState == 'completed') {
test.done()
}
if (gFirstConnection.iceConnectionState == 'completed' &&
gSecondConnection.iceConnectionState == 'connected') {
test.done()
}
if (gFirstConnection.iceConnectionState == 'completed' &&
gSecondConnection.iceConnectionState == 'completed') {
test.done()
}
});
// This function starts the test.
test.step(function() {
gFirstConnection = new RTCPeerConnection(null);
test.add_cleanup(() => gFirstConnection.close());
gFirstConnection.onicecandidate = onIceCandidateToFirst;
gFirstConnection.oniceconnectionstatechange = onIceConnectionStateChange;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.