Created
November 15, 2017 22:09
-
-
Save mqp/58c00aa9923a101e96febed9aa25927c to your computer and use it in GitHub Desktop.
Test page for Firefox media stream code
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Tiny test page</title> | |
</head> | |
<body> | |
<form id="form"> | |
<input id="file" type="file" /> | |
<input type="submit" val="Load"/> | |
</form> | |
<video id="video" controls></video> | |
<script> | |
var form = document.getElementById("form"); | |
var input = document.getElementById("file"); | |
var video = document.getElementById("video"); | |
form.onsubmit = function(e) { | |
var f = input.files[0]; | |
var url = URL.createObjectURL(f); | |
video.src = url; | |
video.play(); | |
var stream = video.mozCaptureStream(); | |
console.log(stream.getTracks()); // no tracks | |
setTimeout(() => console.log(stream.getTracks()), 10); // no tracks | |
setTimeout(() => console.log(stream.getTracks()), 100); // video + audio track | |
e.preventDefault(); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment