Last active
October 1, 2017 17:43
-
-
Save victorvhpg/a1849eed4400c6c607f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
downloadArquivo("./video.ogv", function(progresso, total, perc) { | |
document.querySelector("progress").value = perc; | |
}).then(function(arrayBuffer) { | |
//cria um Blob a partir do arrayBuffer | |
var blob = new Blob([arrayBuffer], { | |
type: "video/ogg" | |
}); | |
//cria o elemento video | |
var video = document.createElement("video"); | |
video.autoplay = true; | |
//cria uma URL para o video // blob: xxxxxxx | |
video.src = window.URL.createObjectURL(blob); | |
//apos o video carregar pode remover url window.URL.revokeObjectURL(video.src); | |
//coloca o video no body | |
document.querySelector("body").appendChild(video); | |
document.querySelector("#url").innerHTML = "URL do video: <a href='" + video.src + "' target='_blank'>" + video.src + "</a>"; | |
}).catch(function(erro) { | |
console.log(erro); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment