mirror of
https://github.com/VueTubeApp/VueTube
synced 2024-12-22 16:30:20 +00:00
Merge github.com-picklenik:Frontesque/VueTube
This commit is contained in:
commit
3844ee1a31
2 changed files with 30 additions and 0 deletions
|
@ -213,6 +213,21 @@ export default {
|
|||
this.vidSrc = this.sources[this.sources.length - 1].url;
|
||||
// TODO: detect orientation change and enter fullscreen
|
||||
// TODO: detect video loading state and send this.loading to play button :loading = loading
|
||||
|
||||
|
||||
this.$youtube.getSponsorBlock(this.$route.query.v, (data) => {
|
||||
sponsorBlock = data.segment;
|
||||
});
|
||||
|
||||
this.$refs.player.ontimeupdate = () => {
|
||||
let vidTime = this.$refs.player.currentTime;
|
||||
for (let i = 0; i < sponsorBlock.length; i++) {
|
||||
if (vidTime > sponsorBlock[i][0] && vidTime < sponsorBlock[0][i]) {
|
||||
this.$refs.player.currentTime = sponsorBlock[i][0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.isFullscreen) this.exitFullscreen();
|
||||
|
|
|
@ -64,6 +64,21 @@ const searchModule = {
|
|||
callback(err);
|
||||
});
|
||||
},
|
||||
getSponsorBlock(id, callback) {
|
||||
Http.request({
|
||||
method: "GET",
|
||||
url: `https://sponsor.ajay.app/api/skipSegments`,
|
||||
params: { videoID: id },
|
||||
})
|
||||
.then((res) => {
|
||||
logger("sponsorBlock", res.data);
|
||||
callback(res.data);
|
||||
})
|
||||
.catch((err) => {
|
||||
logger("codeRun", err, true);
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//--- Recommendations ---//
|
||||
|
|
Loading…
Reference in a new issue