Skip to content

Commit

Permalink
extension ready for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
pasqLisena committed Sep 24, 2014
1 parent e52e807 commit fea7e7f
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions browser_extension/chrome/js/content_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const contentRangeRegex = new RegExp("^Content-Range: bytes ([0-9]+)-([0-9]+)/([
var tRequests = {};

chrome.runtime.onInstalled.addListener(function () {
console.info('Hello\n' +
'This extension is part of the MaFFiN project developed at EURECOM.\n' +
'Enjoy it! :)\n' +
'[email protected]\n\n');
console.info('Hello\n' +
'This extension is part of the MaFFiN project developed at EURECOM.\n' +
'Enjoy it! :)\n' +
'[email protected]\n\n');
});

chrome.webRequest.onBeforeSendHeaders.addListener(
Expand Down Expand Up @@ -76,7 +76,6 @@ chrome.webRequest.onBeforeSendHeaders.addListener(
contentRange1 = contentRange1.trim().match(contentRangeRegex);
var cRange1Diff = contentRange1[2] - contentRange1[1];
console.log(cRange1Diff);
// view.skip(cRange1Diff + 1);
var mdStart = view.tell(), mdEnd;
var s = "";
while (s != null && s.trim().substr(2) != boundary) {
Expand Down Expand Up @@ -108,21 +107,19 @@ chrome.webRequest.onBeforeSendHeaders.addListener(
console.log("data: " + (dataEnd - dataStart) + " bytes");

view.seek(0);
// var videoBin = new jDataView(file, mdStart, (mdEnd - mdStart));
// videoBin.seek(videoBin.byteLength);
// var bytes = view.getBytes((dataEnd - dataStart) - 1, dataStart);
// videoBin.writeBytes(bytes);
// console.log(videoBin)

var bytes1 = view.getBytes((mdEnd - mdStart) - 1, mdStart);
var bytes2 = view.getBytes((dataEnd - dataStart) - 1, dataStart);
/*
var bytes1 = view.getBytes((mdEnd - mdStart) - 1, mdStart);
var bytes2 = view.getBytes((dataEnd - dataStart) - 1, dataStart);
var binaryLength = bytes1.length + bytes2.length;
var bin = new jBinary(binaryLength);
bin.write('blob', bytes1);
bin.write('blob', bytes2);
var binaryLength = bytes1.length + bytes2.length;
var bin = new jBinary(binaryLength);
bin.write('blob', bytes1);
bin.write('blob', bytes2);
*/

var blobUri = bin.toURI('video/mp4');
var bin = new jBinary(view);
var blobUri = bin.toURI('text/plain');
console.log(blobUri);
chrome.tabs.create({'url': blobUri});
}
Expand Down

0 comments on commit fea7e7f

Please sign in to comment.