Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5730)

Unified Diff: chrome/test/data/webrtc/manual/peerconnection-multi.html

Issue 609733002: Replace peerconnection.html with a redirect to github. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed HTML errors Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webrtc/manual/peerconnection-multi.html
diff --git a/chrome/test/data/webrtc/manual/peerconnection-multi.html b/chrome/test/data/webrtc/manual/peerconnection-multi.html
deleted file mode 100644
index e90f7a6d89db546ffe4f95270958e0ec8027976e..0000000000000000000000000000000000000000
--- a/chrome/test/data/webrtc/manual/peerconnection-multi.html
+++ /dev/null
@@ -1,282 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<!--
- Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
-
- Use of this source code is governed by a BSD-style license
- that can be found in the LICENSE file in the root of the source
- tree. An additional intellectual property rights grant can be found
- in the file PATENTS. All contributing project authors may
- be found in the AUTHORS file in the root of the source tree.
--->
-<html>
-<head>
- <title>WebRTC Multi-PeerConnection Test</title>
- <script type="text/javascript">
- // This file can create an arbitrary number of peer connection calls, each
- // with an arbitrary number of auto-echoing data channels. It can run with
- // two separate cameras.
-
- // Our two local video / audio streams.
- var gLocalStream1 = null;
- var gLocalStream2 = null;
-
- // The number of remote view windows (2x number of calls).
- var gNumRemoteViews = 0;
-
- // Maps connection id -> { connection1, connection2 }.
- var gAllConnections = [];
- var gNumConnections = 0;
-
- // Maps data channel id -> sending channel.
- // Note: there can be many data channels per connection id.
- var gSendingDataChannels = [];
- var gTotalNumSendChannels = 0;
-
- function startTest() {
- navigator.webkitGetUserMedia(
- {video: true, audio: true},
- function(localStream) {
- gLocalStream1 = localStream;
- play(localStream, 'local-view-1');
- },
- getUserMediaFailedCallback);
- navigator.webkitGetUserMedia(
- {video: true, audio: true},
- function(localStream) {
- gLocalStream2 = localStream;
- play(localStream, 'local-view-2');
- },
- getUserMediaFailedCallback);
- }
-
- function playStreamInNewRemoteView(stream, peerNumber) {
- console.log('Remote stream to connection ' + peerNumber +
- ': ' + stream.label);
- gNumRemoteViews++;
- var viewName = 'remote-view-' + gNumRemoteViews;
- addRemoteView(viewName, peerNumber);
- play(stream, viewName);
- }
-
- function addRemoteView(elementName, peerNumber) {
- var remoteViews = $('remote-views-' + peerNumber);
- remoteViews.innerHTML +=
- '<tr><td><video width="320" height="240" id="' + elementName + '" ' +
- 'autoplay="autoplay"></video></td></tr>';
- }
-
- function play(stream, videoElement) {
- var streamUrl = URL.createObjectURL(stream);
- $(videoElement).src = streamUrl;
- }
-
- function getUserMediaFailedCallback(error) {
- console.log('getUserMedia request failed with code ' + error.code);
- }
-
- function call() {
- connection1 = new webkitRTCPeerConnection(null,
- {optional:[{RtpDataChannels: true}]});
- connection1.addStream(gLocalStream1);
-
- connection2 = new webkitRTCPeerConnection(
- null, {optional:[{RtpDataChannels: true}]});
- connection2.addStream(gLocalStream2);
- connection2.onicecandidate = function(event) {
- if (event.candidate) {
- var candidate = new RTCIceCandidate(event.candidate);
- connection1.addIceCandidate(candidate);
- }
- };
- connection1.onicecandidate = function(event) {
- if (event.candidate) {
- console.log('Ice candidate: ' + event.candidate);
- var candidate = new RTCIceCandidate(event.candidate);
- connection2.addIceCandidate(candidate);
- }
- };
- connection1.onaddstream = function(event) {
- playStreamInNewRemoteView(event.stream, 1);
- //addDataChannelAnchor(connection1, connection2);
- };
- connection2.onaddstream = function(event) {
- playStreamInNewRemoteView(event.stream, 2);
- };
- // TODO(phoglund): hack to work around
- // https://code.google.com/p/webrtc/issues/detail?id=1203. When it is fixed,
- // uncomment the negotiate call, remove addDataChannel and uncomment in
- // connection1.onaddstream. Also remove the notice at the top of the HTML!
- // negotiate(connection1, connection2);
- addDataChannelAnchor(connection1, connection2);
- }
-
- function negotiate(connection1, connection2) {
- connection1.createOffer(function(offer) {
- connection1.setLocalDescription(offer);
- connection2.setRemoteDescription(offer);
- connection2.createAnswer(function(answer) {
- console.log('Created answer ' + answer);
- connection2.setLocalDescription(answer);
- connection1.setRemoteDescription(answer);
- });
- });
- }
-
- function addDataChannelAnchor(connection1, connection2) {
- var connectionId = gNumConnections++;
- gAllConnections[connectionId] = { connection1: connection1,
- connection2: connection2 };
- addOneAnchor(1, connectionId);
- addOneAnchor(2, connectionId);
- }
-
- function makeDataChannelAnchorName(peerId, connectionId) {
- return 'data-channels-peer' + peerId + '-' + connectionId;
- }
-
- // This adds a target table we'll add our input fields to later.
- function addOneAnchor(peerId, connectionId) {
- var newButtonId = 'add-data-channel-' + connectionId;
- var remoteViewContainer = 'remote-views-' + peerId;
- $(remoteViewContainer).innerHTML +=
- '<tr><td><button id="' + newButtonId + '" ' +
- 'onclick="addDataChannel(' + connectionId + ')">' +
- ' Add Echoing Data Channel</button></td></tr>';
-
- var anchorName = makeDataChannelAnchorName(peerId, connectionId);
- $(remoteViewContainer).innerHTML +=
- '<tr><td><table id="' + anchorName + '"></table></td></tr>';
- }
-
- // Called by clicking Add Echoing Data Channel.
- function addDataChannel(connectionId) {
- var dataChannelId = gTotalNumSendChannels++;
-
- var peer1SinkId = addDataChannelSink(1, connectionId, dataChannelId);
- var peer2SinkId = addDataChannelSink(2, connectionId, dataChannelId);
- var connections = gAllConnections[connectionId];
-
- configureChannels(connections.connection1, connections.connection2,
- peer1SinkId, peer2SinkId, dataChannelId);
-
- // Add the field the user types in, and a
- // dummy field so everything lines up nicely.
- addDataChannelSource(1, connectionId, dataChannelId);
- addDisabledInputField(2, connectionId, '(the above is echoed)');
-
- negotiate(connections.connection1, connections.connection2);
- }
-
- function configureChannels(connection1, connection2, targetFor1, targetFor2,
- dataChannelId) {
- // Label the channel so we know where to send the data later in dispatch.
- sendChannel = connection1.createDataChannel(
- targetFor2, { reliable : false });
- sendChannel.onmessage = function(messageEvent) {
- $(targetFor1).value = messageEvent.data;
- }
-
- gSendingDataChannels[dataChannelId] = sendChannel;
-
- connection2.ondatachannel = function(event) {
- // The channel got created by a message from a sending channel: hook this
- // new receiver channel up to dispatch and then echo any messages.
- event.channel.onmessage = dispatchAndEchoDataMessage;
- }
- }
-
- function addDataChannelSink(peerNumber, connectionId, dataChannelId) {
- var sinkId = 'data-sink-peer' + peerNumber + '-' + dataChannelId;
- var anchor = $(makeDataChannelAnchorName(peerNumber, connectionId));
- anchor.innerHTML +=
- '<tr><td><input type="text" id="' + sinkId + '" disabled/></td></tr>';
- return sinkId;
- }
-
- function addDataChannelSource(peerNumber, connectionId, dataChannelId) {
- var sourceId = 'data-source-peer' + peerNumber + '-' + dataChannelId;
- var anchor = $(makeDataChannelAnchorName(peerNumber, connectionId));
- anchor.innerHTML +=
- '<tr><td><input type="text" id="' + sourceId + '"' +
- ' onchange="userWroteSomethingIn(\'' + sourceId + '\', ' +
- dataChannelId + ');"/></td></tr>';
- }
-
- function userWroteSomethingIn(sourceId, dataChannelId) {
- var source = $(sourceId);
- var dataChannel = gSendingDataChannels[dataChannelId];
- dataChannel.send(source.value);
- }
-
- function addDisabledInputField(peerNumber, connectionId, text) {
- var anchor = $(makeDataChannelAnchorName(peerNumber, connectionId));
- anchor.innerHTML +=
- '<tr><td><input type="text" value="' + text + '" disabled/></td></tr>';
- }
-
- function dispatchAndEchoDataMessage(messageEvent) {
- // Since we labeled the channel earlier, we know to which input element
- // we should send the data.
- var dataChannel = messageEvent.currentTarget;
- var targetInput = $(dataChannel.label);
- targetInput.value = messageEvent.data;
- dataChannel.send('echo: ' + messageEvent.data);
- }
-
- window.onload = function() {
- startTest();
- }
-
- $ = function(id) {
- return document.getElementById(id);
- };
- </script>
-</head>
-<body>
- <table border="0">
- <tr>
- <td colspan="2">
- Notes:
- <ul>
- <li>Due to https://code.google.com/p/webrtc/issues/detail?id=1203,
- you must create a data channel to actually get a call negotiated. Add
- one call at a time and click "add echoing data channel" for each and
- you'll be fine.</li>
- <li>For unknown reasons, adding a new data channel will clear the
- input field contents for all other channels on the same call. This is
- not the data channel's fault though.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>Local Preview for Peer 1</td>
- <td>Local Preview for Peer 2</td>
- </tr>
- <tr>
- <td><video width="320" height="240" id="local-view-1"
- autoplay="autoplay"></video></td>
- <td><video width="320" height="240" id="local-view-2"
- autoplay="autoplay"></video></td>
- </tr>
- <tr>
- <td><button id="add-call" onclick="call();">Add Call</button></td>
- </tr>
- <tr>
- <td>
- <table id="remote-views-1">
- <tr>
- <td>Remote (Incoming to Peer 1)</td>
- </tr>
- </table>
- </td>
- <td>
- <table id="remote-views-2">
- <tr>
- <td>Remote (Incoming to Peer 2)</td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
-</body>
-</html>
« no previous file with comments | « chrome/test/data/webrtc/manual/peerconnection-iframe.html ('k') | chrome/test/data/webrtc/manual/peerconnection_manual.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698