I am getting that error message when I try to retrieve and play a video file(blob),stored in indexedDB.I basically open a transaction to the db,get the file and then assign the source object to the HTML video element.
Basically I managed to store the videos in indexedDB,all i want to do now is retrieve and play the video files in the browser. I get that error message.I did some reading and found out it could be due to the deprecation of "createObjectURL" but I am not sure as to how to incooperate the new approach into my code.
<script type="text/javascript">
(function () {
if (!('indexedDB' in window)) {
console.log('This browser doesn\'t support IndexedDB');
return;
}
// IndexedDB
window.indexedDB = window.indexedDB || window.webkitIndexedDB ||
window.mozIndexedDB || window.OIndexedDB ||
window.msIndexedDB,
IDBTransaction = window.IDBTransaction ||
window.webkitIDBTransaction ||
window.OIDBTransaction || window.msIDBTransaction,
dbVersion = 1.0;
var indexedDB = window.indexedDB;
// Create/open database
var request = indexedDB.open("Syafunda_Videos");
request.onerror = function (event) {
// Failed to Open the indexedDB database
};
request.onsuccess = function (event) {
db = request.result;
// Open a transaction to the database
var transaction = db.transaction(["Videos"], "readwrite");
//Retrieve the video file
transaction.objectStore("Videos").get("1").onsuccess = function (event) {
var videoFile = event.target.result;
var URL = window.URL || window.webkitURL;
var videoURL = URL.createObjectURL(videoFile) ;
// Set video src to ObjectURL
var videoElement = document.getElementById("video");
videoElement.setAttribute("src", videoURL);
var mimeDisplayElement = document.getElementById("vidMimeDisplay");
mimeDisplayElement.innerHTML = videoFile.type;
};
}
})();
</script>