Devtool.network - call to getContent(callback) return content == null (video mp4)

803 views
Skip to first unread message

Kevin Leduc

unread,
Apr 30, 2016, 4:33:44 PM4/30/16
to Google Chrome Developer Tools
Hi,

I try to find a way to extract mp4 content received and manipulated by the browser. 
I need to extract it without make a new call to the server. I try to use the devtools.network API.
Inside the onRequestFinished event, I call the function getContent to get the content.
The problem is the value I got is always null and I don't know why... 


I navigate in this page for my test : "http://www.w3schools.com/html/html5_video.asp"
Thank for your help, here my code : 



chrome.devtools.network.onRequestFinished.addListener(
  function(request) {
    if(request.response.content.mimeType == "video/mp4" &&
      request.getContent(function(content){
        if(content == null) {
          console.log("Why content is null! :( ... and my content size is suppose to be :");
          console.log(request.response.content.size);
        }
        sendFileToMyOwnServer("video123.mp4", content);
      });
    }
  }
);

function sendFileToMyOwnServer(title, content) {
  $.ajax({url:"http://localhost:3000/" + title, 
          type: 'POST',
          contentType: 'video/mp4', 
          data: content});
}

Ala Rihane

unread,
Aug 25, 2016, 8:30:22 AM8/25/16
to Google Chrome Developer Tools
Same thing, did you found a solution ?

PhistucK

unread,
Aug 25, 2016, 8:31:32 AM8/25/16
to Google Chrome Developer Tools
You can search crbug.com for an existing issue and star it. If you cannot find one, file a new issue using the "New issue" link on the same page.
Please, do not add a "+1" or "Me too" or "Confirmed" (or similar) comment. It just wastes the time of Chrome engineers and sends unnecessary e-mails to all of the people who starred the issue.

You can reply with a link to the found or created issue and might get triaged (and fixed) faster.

Thank you.



PhistucK

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-developer-tools+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/c35624b9-3e1a-4ddf-9cf0-9722ab84dcaf%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Леонид Горшков

unread,
May 9, 2019, 5:06:06 PM5/9/19
to Chrome DevTools
I have the same problem, now in Chrome 74.0.3729.131. Sometimes but not always content is null, I think it reles how often requests are sended


 

Леонид Горшков

unread,
May 9, 2019, 5:06:06 PM5/9/19
to Chrome DevTools
This is my case, content null because of some error
null_content.png

 

Леонид Горшков

unread,
May 9, 2019, 5:18:34 PM5/9/19
to Chrome DevTools
I checked when was called xhr.abort() and AbortController.abort() that is used in a 'fetch' call. So I found out If abort occured before reading headers, that getContent API returns response with code=0. But if request aborted while reading body, that getConent callback will be called with null. So this is my case and it is not bug in my opinion.
Reply all
Reply to author
Forward
0 new messages