JavaScript window.URL is undefined in function

Use window.webkitURL in Chrome.

This whould work in both Chrome and FireFox

function setVideoSrc(player,file){
    var myURL = window.URL || window.webkitURL
    console.log('winurl='+myURL);
    var fileURL = myURL.createObjectURL(file);
    player.src=fileURL;
    player.load();
    return;
}

See also:

  • http://caniuse.com/#feat=bloburls
  • https://developer.mozilla.org/en/DOM/window.URL.createObjectURL
  • http://www.w3.org/TR/FileAPI/#url