Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/player.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ on:
pull_request:
paths:
- 'web/**'
- 'packages/long-string-scroller/**'
- 'src/channels.ts'
- 'src/fragments.ts'
- 'src/playlist-input.ts'
- 'test/playlist-stream.test.ts'
- 'src/protocol.ts'
- 'src/i18n.ts'
- 'src/ui-languages.ts'
Expand Down Expand Up @@ -30,6 +35,9 @@ jobs:
bun-version: latest
- run: bun install --frozen-lockfile
- run: bun run typecheck
- name: Install media test tools
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- run: bun test test/playlist-stream.test.ts
- run: bun test test/i18n.test.ts web/test/player.test.ts web/test/web.test.ts web/test/accessibility.test.ts
- run: bun run web:build
- run: bun run backtoschool:build
Expand All @@ -50,6 +58,10 @@ jobs:
env:
NIXAMP_PLAYWRIGHT_MODULE: ${{ runner.temp }}/nixamp-browser/node_modules/playwright/index.mjs
run: bun web/scripts/check-parties.mjs
- name: Live playlist row stability and mouse scrolling
env:
NIXAMP_PLAYWRIGHT_MODULE: ${{ runner.temp }}/nixamp-browser/node_modules/playwright/index.mjs
run: bun web/scripts/check-playlist.mjs
- name: Browser screenshots
if: always()
uses: actions/upload-artifact@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
- run: bun run build
- run: bun run web:build
- run: bun run backtoschool:build
- name: Install media test tools
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- run: bun test test web/test
# Prove the OpenStream envelope on the build we are about to ship, and
# gate the release on it: the command exits non-zero if any codec that
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nixamp",
"version": "0.28.35",
"version": "0.28.36",
"description": "It really whips the terminal's ass. A Winamp-shaped audio player for your terminal.",
"license": "MIT",
"type": "module",
Expand Down
14 changes: 8 additions & 6 deletions packages/long-string-scroller/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ export function attachLongStringScroller(viewport: HTMLElement, content: HTMLEle
content.classList.add("long-string-scroller-content");
content.title = content.textContent ?? "";
let frame = 0;
let lastX = 0;
let target = 0;
let position = 0;
let returning = false;
let releaseHeight: ReturnType<typeof setTimeout> | null = null;
const animate = (): void => {
frame = 0;
const next = position + (target - position) * 0.22;
const next = matchMedia("(prefers-reduced-motion: reduce)").matches ? target : position + (target - position) * 0.22;
position = Math.abs(target - next) < 0.5 ? target : next;
content.style.setProperty("--path-shift", `${position}px`);
if (Math.abs(target - position) >= 0.5) {
Expand All @@ -34,7 +33,7 @@ export function attachLongStringScroller(viewport: HTMLElement, content: HTMLEle
if (!frame) frame = requestAnimationFrame(animate);
};
viewport.addEventListener("pointerenter", (event) => {
if (event.pointerType !== "mouse") return;
if (event.pointerType !== "mouse" || !matchMedia("(hover: hover) and (pointer: fine)").matches) return;
if (releaseHeight !== null) {
clearTimeout(releaseHeight);
releaseHeight = null;
Expand All @@ -47,11 +46,14 @@ export function attachLongStringScroller(viewport: HTMLElement, content: HTMLEle
});
viewport.addEventListener("pointermove", (event) => {
if (content.dataset["pan"] !== "true") return;
lastX = event.clientX;
const overflow = Math.max(viewport.scrollWidth, content.scrollWidth) - viewport.clientWidth;
const style = getComputedStyle(viewport);
const padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
// The viewport's scrollWidth includes the transformed child and changes
// while panning. Measure the untransformed content against the text area.
const overflow = Math.max(0, content.scrollWidth - (viewport.clientWidth - padding));
if (overflow <= 0) return;
const box = viewport.getBoundingClientRect();
const raw = Math.max(0, Math.min(1, (lastX - box.left) / Math.max(1, box.width)));
const raw = Math.max(0, Math.min(1, (event.clientX - box.left) / Math.max(1, box.width)));
// Reserve a small edge band for the physical limits of a mouse: the
// pointer rarely lands on the exact last pixel, but the string must still
// reach both ends. Smoothstep gives the acceleration/deceleration curve in
Expand Down
4 changes: 2 additions & 2 deletions src/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export interface Codecs {
* answering other requests, and a synchronous probe per media request is how
* the whole library came to be tagged with the process wedged solid.
*/
export async function codecsOf(tools: Tools, path: string, input: string[] = []): Promise<Codecs> {
export async function codecsOf(tools: Tools, path: string, input: string[] = [], signal?: AbortSignal): Promise<Codecs> {
const [cmd, ...rest] = tools.ffprobe;
const empty: Codecs = { video: "", audio: "", container: "" };
if (!cmd) return empty;
Expand All @@ -469,7 +469,7 @@ export async function codecsOf(tools: Tools, path: string, input: string[] = [])
...input,
path,
],
{ stdio: ["ignore", "pipe", "ignore"] },
{ stdio: ["ignore", "pipe", "ignore"], signal },
);
let out = "";
child.stdout.on("data", (chunk: Buffer) => {
Expand Down
Loading
Loading