feat: finish a/v sync scale, add a/v sync test

develop
Tomáš Mládek 2024-02-26 12:25:25 +01:00
parent 589e235756
commit dd4bd1d497
2 changed files with 61 additions and 7 deletions

View File

@ -3,14 +3,24 @@
export let fps: number;
</script>
<div class="scale">
<div class="scale" style="--frame: {frame}; --fps: {fps}">
<div class="labels">
<div>Video Late</div>
<div>Audio Late</div>
</div>
<div class="zero">
<div class="label">0</div>
<div class="mark"></div>
</div>
<div class="indicator"></div>
<div class="ticks">
<div class="tick"></div>
{#each Array.from({ length: fps }, (_, i) => i) as i}
<div class="spacer" class:active={i === (frame + fps / 2) % fps}>
{#if i % (fps / 10) === 0 && i !== 0 && i !== fps / 2}
<div class="label">{(i - fps / 2) * (1000 / fps)}ms</div>
{/if}
</div>
<div class="tick"></div>
{/each}
</div>
@ -48,12 +58,56 @@
.ticks {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
width: 100%;
& .spacer {
position: relative;
flex-grow: 1;
&.active {
background: var(--color-active);
z-index: 9;
}
& .label {
position: absolute;
top: calc(100% + 2em);
left: 50%;
transform: translateX(-50%) rotate(90deg);
line-height: 1;
font-size: 13px;
}
}
& .tick {
width: 2px;
height: 5vh;
background: white;
}
}
.tick {
width: 2px;
height: 3vh;
background: white;
.zero {
position: absolute;
top: calc(50% - 5vh * 2.5 / 2);
left: calc(50%);
width: calc(100% / var(--fps) - 1px);
font-size: 2vw;
& .label {
position: absolute;
top: -1.2em;
color: transparent;
}
& .mark {
width: 2px;
height: calc(5vh * 2.5);
background: white;
position: absolute;
top: 0;
left: 50%;
}
}
</style>

View File

@ -14,7 +14,7 @@
<i class="ti ti-volume"></i>
Audio
</a>
<a href="av-sync" class="disabled">
<a href="av-sync">
<i class="ti ti-time-duration-off"></i>
AV&nbsp;Sync
</a>