mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
Make the indexeddb call syncronous to fix race condition
This commit is contained in:
parent
6578f0f82b
commit
dd83474126
1 changed files with 18 additions and 15 deletions
|
@ -401,7 +401,7 @@ export default {
|
||||||
videoEl.currentTime = segment.segment[1];
|
videoEl.currentTime = segment.segment[1];
|
||||||
segment.skipped = true;
|
segment.skipped = true;
|
||||||
},
|
},
|
||||||
setPlayerAttrs(localPlayer, videoEl, uri, mime, shaka) {
|
async setPlayerAttrs(localPlayer, videoEl, uri, mime, shaka) {
|
||||||
const url = "/watch?v=" + this.video.id;
|
const url = "/watch?v=" + this.video.id;
|
||||||
|
|
||||||
if (!this.$ui) {
|
if (!this.$ui) {
|
||||||
|
@ -502,6 +502,7 @@ export default {
|
||||||
startTime = parseTimeParam(time);
|
startTime = parseTimeParam(time);
|
||||||
this.initialSeekComplete = true;
|
this.initialSeekComplete = true;
|
||||||
} else if (window.db && this.getPreferenceBoolean("watchHistory", false)) {
|
} else if (window.db && this.getPreferenceBoolean("watchHistory", false)) {
|
||||||
|
await new Promise(resolve => {
|
||||||
var tx = window.db.transaction("watch_history", "readonly");
|
var tx = window.db.transaction("watch_history", "readonly");
|
||||||
var store = tx.objectStore("watch_history");
|
var store = tx.objectStore("watch_history");
|
||||||
var request = store.get(this.video.id);
|
var request = store.get(this.video.id);
|
||||||
|
@ -513,11 +514,13 @@ export default {
|
||||||
startTime = currentTime;
|
startTime = currentTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
resolve();
|
||||||
};
|
};
|
||||||
|
|
||||||
tx.oncomplete = () => {
|
tx.oncomplete = () => {
|
||||||
this.initialSeekComplete = true;
|
this.initialSeekComplete = true;
|
||||||
};
|
};
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this.initialSeekComplete = true;
|
this.initialSeekComplete = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue