hotfix: no sound in ios webkit

This commit is contained in:
Felix Roos 2022-06-19 11:50:00 +02:00
parent ad053361dc
commit 5334abebaa
2 changed files with 9 additions and 3 deletions

View File

@ -3,7 +3,7 @@
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"dev": "vite --host",
"start": "vite",
"build": "vite build",
"preview": "vite preview",

View File

@ -14,7 +14,7 @@ import logo from './logo.svg';
import * as tunes from './tunes.mjs';
import * as WebDirt from 'WebDirt';
import { loadWebDirt } from '@strudel.cycles/webdirt';
import { resetLoadedSamples } from '@strudel.cycles/webaudio';
import { resetLoadedSamples, getAudioContext } from '@strudel.cycles/webaudio';
evalScope(
Tone,
@ -140,7 +140,13 @@ function App() {
<h1 className={isEmbedded ? 'text-l' : 'text-xl'}>Strudel {isEmbedded ? 'Mini ' : ''}REPL</h1>
</div>
<div className="flex">
<button onClick={() => togglePlay()} className={cx('hover:bg-gray-300', !isEmbedded ? 'p-2' : 'px-2')}>
<button
onClick={() => {
getAudioContext().resume(); // fixes no sound in ios webkit
togglePlay();
}}
className={cx('hover:bg-gray-300', !isEmbedded ? 'p-2' : 'px-2')}
>
{!pending ? (
<span className={cx('flex items-center', isEmbedded ? 'w-16' : 'w-16')}>
{cycle.started ? (