Video duration Infinity


Hi, this is my first ask in here, so I’m sorry for anything! I’m trying to cut out a video, for this, I’m using following code for open file:
{ properties: [ ‘openFile’ ] }, function ( filename ) {
nomeArquivo = filename.toString() // Sera usado na funcao recortar()
//Set the src of tag video html5
var video = document.getElementById(‘video’).setAttribute(‘src’, filename.toString())
I need to get the total duration (getElementById(‘video’).duration) of the video, but I can only when I open a video that is in the folder of my application, otherwise it shows Infinity. Someone help me??