Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiview Archive Sync start time logic #790

Open
meiamsome opened this issue Dec 28, 2024 · 0 comments
Open

Multiview Archive Sync start time logic #790

meiamsome opened this issue Dec 28, 2024 · 0 comments

Comments

@meiamsome
Copy link
Contributor

The logic for choosing a start time when opening the Multiview Archive Sync feature is somewhat unexpected.

Relevant code is here:

findStartTime() {
if (this.routeCurrentTs) return +this.routeCurrentTs;
const times = [];
let firstOverlap = this.minTs;
if (!this.$parent?.$refs?.videoCell) return this.minTs;
this.$parent.$refs.videoCell
.forEach((cell, index) => {
const { video, currentTime } = cell;
// Find corresponding overlapping video
const olVideo = video && this.overlapVideos.find((v) => v.id === video.id);
if (!olVideo) return;
const t = currentTime + olVideo.startTs;
// Find times that is within 2 seconds of other videos
if (index === 0 || Math.abs(times[index - 1] - t) < 2000) {
times.push(t);
}
if (olVideo.startTs > firstOverlap && olVideo.endTs > firstOverlap) {
firstOverlap = olVideo.startTs;
}
});
// Return average if all the times are close
if (times.length === this.overlapVideos.length) {
return times.reduce((a, c) => a + c, 0) / times.length;
}
// Use first overlapping time as start time
return firstOverlap;
},

In particular this section:

if (times.length === this.overlapVideos.length) {
return times.reduce((a, c) => a + c, 0) / times.length;
}

This causes the average of the streams to be used in almost all cases, when it doesn't seem correct.

For example: https://holodex.net/multiview/AAMYQIQnwYp3tjY%2CMAMYYj6CH1ZdGpU
These two streams start around 27 minutes apart, and yet the average time is chosen and so we start 13 minutes in to the first stream and 13 minutes before the second.

There is a comment above:

// Return average if all the times are close

This to me implies that the intention was to have a condition more like:

if (times.length === this.overlapVideos.length && Math.max(times) - Math.min(times) < MAX_VIDEO_OVERLAP_AVERAGE_DIFFERENCE) {

Which would only apply the average if the streams start within a small amount of time. However, if MAX_VIDEO_OVERLAP_AVERAGE_DIFFERENCE is set too large, the behaviour would appear odd to the user (like the above example), and if small it would be identical to just jumping to the start of one of the specific streams.

We could:

  • Always start at the earliest stream start time
  • Always start at the 'first overlap' (the first time two streams overlap, although I think the current way this is calculated has some issues)
  • Always start at the latest stream start time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant