Created
June 2, 2019 12:34
-
-
Save ziir/aa8ae3af995df6a40de0ead650a81ac3 to your computer and use it in GitHub Desktop.
Firefox Mobile (Android) can't use an ObjectURL from a local File after using history.pushState
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
<html> | |
<body> | |
<input type="file" id="file" accept="audio/mpeg" /> | |
</body> | |
<script> | |
const input = document.getElementById('file'); | |
input.addEventListener('change', (evt) => { | |
const file = evt.target.files[0]; | |
history.pushState({}, 'Uploaded', '/uploaded'); | |
const audio = new Audio(URL.createObjectURL(file)); | |
audio.addEventListener('error', () => { | |
// MediaError { code: 4, message: "2152857618: Request failed" } MEDIA_ERR_SRC_NOT_SUPPORTED | |
// MediaError { code: 4, message: "Failed to open channel" } MEDIA_ERR_SRC_NOT_SUPPORTED | |
console.log(audio.error); | |
}); | |
audio.autoplay = true; | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
soundcut/app@d8c321c