Improve querying and check if 90% of video is watched.

This commit is contained in:
Kavin 2022-10-02 14:42:49 +01:00
parent 8ae7a36627
commit 6d14103e61
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD

View file

@ -185,15 +185,13 @@ export default {
if (!this.isFeed || !this.getPreferenceBoolean("hideWatched", false)) return;
const objectStore = window.db.transaction("watch_history", "readonly").objectStore("watch_history");
objectStore.openCursor().onsuccess = event => {
const cursor = event.target.result;
if (cursor) {
if (cursor.value.videoId === this.video.url.replace("/watch?v=", "")) {
const request = objectStore.get(this.video.url.substr(-11));
request.onsuccess = event => {
const video = event.target.result;
if (video && (video.currentTime ?? 0) > video.duration * 0.9) {
this.showVideo = false;
return;
}
cursor.continue();
}
};
},
},