MCPcopy
hub / github.com/stemdeckapp/stemdeck / togglePlay

Function togglePlay

static/mobile/app.js:300–317  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

298}
299
300function togglePlay() {
301 if (!state.current) return;
302 ensureAudioCtx(); // unlock audio within this gesture
303 // Engine not loaded for this track yet → load then autoplay.
304 if (!engine || engineTrackId !== state.current.id) {
305 openTrack(state.current, { autoplay: true });
306 return;
307 }
308 // Decode still in flight → remember the intent and play once ready.
309 if (!engineReady) {
310 pendingPlay = true;
311 return;
312 }
313 if (engine.isPlaying()) engine.pause();
314 else engine.play();
315 state.playing = engine.isPlaying();
316 render();
317}
318
319function seekToFraction(frac) {
320 if (!engine) return;

Callers 1

app.jsFile · 0.85

Calls 3

ensureAudioCtxFunction · 0.85
openTrackFunction · 0.85
renderFunction · 0.70

Tested by

no test coverage detected