NOTE: This code review based on the running issue:

https://webrtc-codereview.appspot.com/24939004/

R=andresp@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/29819004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7499 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
houssainy@google.com
2014-10-22 17:24:20 +00:00
parent 3382059e55
commit fce8f5d319
2 changed files with 146 additions and 0 deletions

View File

@ -113,9 +113,28 @@ function getStreamFromIdentifier_(id) {
return null;
};
function downloadFile(path, onSuccess, onError) {
var xhr = new XMLHttpRequest();
function onResult() {
if (xhr.readyState != 4)
return;
if (xhr.status != 200) {
onError("Download request failed!");
return;
}
onSuccess(xhr.responseText);
}
xhr.onreadystatechange = onResult;
xhr.open('GET', path, true);
xhr.send();
};
connectToServer({
ping: ping,
getUserMedia: getUserMedia,
createPeerConnection: createPeerConnection,
showStream: showStream,
downloadFile: downloadFile,
});