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:
@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user