Compare commits
3 Commits
bun
...
f777873432
| Author | SHA1 | Date | |
|---|---|---|---|
| f777873432 | |||
| dc84db8c79 | |||
| 7978ea5b37 |
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build && node ./scripts/create_media_symlink.js",
|
||||
"build": "vite build && bun --bun run ./scripts/create_media_symlink.js",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
|
||||
@@ -79,8 +79,16 @@
|
||||
let volumeBar = $state();
|
||||
let innerWidth = $state();
|
||||
let innerHeight = $state();
|
||||
let isSafari = $state(false);
|
||||
|
||||
onMount(async () => {
|
||||
// work around coreaudio bug
|
||||
// see https://git.webbieweb.org/apt-get/strimserve/issues/1
|
||||
const ua = navigator.userAgent;
|
||||
const isIOS = /iPad|iPhone|iPod/.test(ua);
|
||||
const isDesktopSafari = /Safari/.test(ua) && !/Chrome/.test(ua) && !/Chromium/.test(ua);
|
||||
isSafari = isIOS || isDesktopSafari;
|
||||
|
||||
// default volume
|
||||
const volumeData = localStorage.getItem('volume');
|
||||
volume = volumeData ? parseFloat(volumeData) : 0.67;
|
||||
@@ -296,13 +304,17 @@
|
||||
bind:duration={null, (d) => (duration = d || 0)}
|
||||
bind:currentTime
|
||||
{muted}
|
||||
{volume}
|
||||
onplay={setMediaMetadataOnPlay}
|
||||
onended={bubble('ended')}
|
||||
{preload}
|
||||
>
|
||||
{#if isSafari}
|
||||
<source src="{src}.mp3" type="audio/mpeg" />
|
||||
<source {src} type="audio/ogg;codecs=opus" />
|
||||
{:else}
|
||||
<source {src} type="audio/ogg;codecs=opus" />
|
||||
<source src="{src}.mp3" type="audio/mpeg" />
|
||||
{/if}
|
||||
</audio>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user