mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 22:33:50 +02:00
Usharp Video Sync
This commit is contained in:
@@ -8008,6 +8008,12 @@ speechSynthesis.getVoices();
|
||||
this.lastVideoUrl = gameLog.videoUrl;
|
||||
this.addGameLogVideo(gameLog, location, userId);
|
||||
return;
|
||||
case 'video-sync':
|
||||
var timestamp = gameLog.timestamp.replace(/,/g, '');
|
||||
if (this.nowPlaying.playing) {
|
||||
this.nowPlaying.offset = parseInt(timestamp, 10);
|
||||
}
|
||||
return;
|
||||
case 'api-request':
|
||||
var bias = Date.parse(gameLog.dt) + 60 * 1000;
|
||||
if (!this.isGameRunning || bias < Date.now()) {
|
||||
@@ -9198,10 +9204,6 @@ speechSynthesis.getVoices();
|
||||
videoLength = this.convertYoutubeTime(
|
||||
data.items[0].contentDetails.duration
|
||||
);
|
||||
if (videoLength) {
|
||||
// add loading time
|
||||
videoLength += 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
@@ -9395,6 +9397,7 @@ speechSynthesis.getVoices();
|
||||
name: '',
|
||||
length: 0,
|
||||
startTime: 0,
|
||||
offset: 0,
|
||||
elapsed: 0,
|
||||
percentage: 0,
|
||||
remainingText: '',
|
||||
@@ -9407,6 +9410,7 @@ speechSynthesis.getVoices();
|
||||
name: '',
|
||||
length: 0,
|
||||
startTime: 0,
|
||||
offset: 0,
|
||||
elapsed: 0,
|
||||
percentage: 0,
|
||||
remainingText: '',
|
||||
@@ -9430,7 +9434,8 @@ speechSynthesis.getVoices();
|
||||
url: ctx.videoUrl,
|
||||
name,
|
||||
length: ctx.videoLength,
|
||||
startTime: Date.parse(ctx.created_at) / 1000 - ctx.videoPos,
|
||||
startTime: Date.parse(ctx.created_at) / 1000,
|
||||
offset: ctx.videoPos,
|
||||
elapsed: 0,
|
||||
percentage: 0,
|
||||
remainingText: ''
|
||||
@@ -9439,7 +9444,8 @@ speechSynthesis.getVoices();
|
||||
this.nowPlaying = {
|
||||
...this.nowPlaying,
|
||||
length: ctx.videoLength,
|
||||
startTime: Date.parse(ctx.created_at) / 1000 - ctx.videoPos,
|
||||
startTime: Date.parse(ctx.created_at) / 1000,
|
||||
offset: ctx.videoPos,
|
||||
elapsed: 0,
|
||||
percentage: 0,
|
||||
remainingText: ''
|
||||
@@ -9459,7 +9465,7 @@ speechSynthesis.getVoices();
|
||||
return;
|
||||
}
|
||||
var now = Date.now() / 1000;
|
||||
np.elapsed = Math.round((now - np.startTime) * 10) / 10;
|
||||
np.elapsed = Math.round((now - np.startTime + np.offset) * 10) / 10;
|
||||
if (np.elapsed >= np.length) {
|
||||
this.clearNowPlaying();
|
||||
return;
|
||||
@@ -9647,7 +9653,10 @@ speechSynthesis.getVoices();
|
||||
if (this.nowPlaying.playing) {
|
||||
Discord.SetTimestamps(
|
||||
Date.now(),
|
||||
(this.nowPlaying.startTime + this.nowPlaying.length) * 1000
|
||||
(this.nowPlaying.startTime -
|
||||
this.nowPlaying.offset +
|
||||
this.nowPlaying.length) *
|
||||
1000
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user