mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-26 15:37:24 +00:00
parent
4ec67a4884
commit
6ee9592218
@ -216,19 +216,29 @@ export default {
|
||||
mounted() {
|
||||
this.getVideoData().then(() => {
|
||||
(async () => {
|
||||
const videoId = this.getVideoId();
|
||||
const instance = this;
|
||||
if (window.db) {
|
||||
var tx = window.db.transaction("watch_history", "readwrite");
|
||||
var store = tx.objectStore("watch_history");
|
||||
var video = {
|
||||
videoId: this.getVideoId(),
|
||||
title: this.video.title,
|
||||
duration: this.video.duration,
|
||||
thumbnail: this.video.thumbnailUrl,
|
||||
uploaderUrl: this.video.uploaderUrl,
|
||||
uploaderName: this.video.uploader,
|
||||
var request = store.get(videoId);
|
||||
request.onsuccess = function(event) {
|
||||
var video = event.target.result;
|
||||
if (video) {
|
||||
video.watchedAt = Date.now();
|
||||
} else {
|
||||
video = {
|
||||
videoId: videoId,
|
||||
title: instance.video.title,
|
||||
duration: instance.video.duration,
|
||||
thumbnail: instance.video.thumbnailUrl,
|
||||
uploaderUrl: instance.video.uploaderUrl,
|
||||
uploaderName: instance.video.uploader,
|
||||
watchedAt: Date.now(),
|
||||
};
|
||||
store.add(video);
|
||||
}
|
||||
store.put(video);
|
||||
};
|
||||
}
|
||||
})();
|
||||
if (this.active) this.$refs.videoPlayer.loadVideo();
|
||||
|
Loading…
Reference in New Issue
Block a user