|
728 | 728 | <div style="position:absolute;bottom:8px;left:24px;width:40px;height:40px;border-bottom:1px solid rgba(0,212,255,0.2);border-left:1px solid rgba(0,212,255,0.2);"></div> |
729 | 729 | <div style="position:absolute;bottom:8px;right:24px;width:40px;height:40px;border-bottom:1px solid rgba(0,212,255,0.2);border-right:1px solid rgba(0,212,255,0.2);"></div> |
730 | 730 |
|
| 731 | +<audio id="tp-intro-music" loop preload="auto"> |
| 732 | + <source src="https://assets.mixkit.co/music/preview/mixkit-tech-house-vibes-130.mp3" type="audio/mpeg"> |
| 733 | +</audio> |
| 734 | + |
731 | 735 | </div> |
732 | 736 |
|
733 | 737 | <style> |
|
924 | 928 | // ── Dismiss logic ───────────────────────────────────────────── |
925 | 929 | var dismissed = false; |
926 | 930 |
|
| 931 | + // Autoplay music — browsers require user gesture first |
| 932 | + // Attempt autoplay immediately, fall back to playing on first interaction |
| 933 | + var music = document.getElementById('tp-intro-music'); |
| 934 | + if (music) { |
| 935 | + music.volume = 0.18; |
| 936 | + var playPromise = music.play(); |
| 937 | + if (playPromise !== undefined) { |
| 938 | + playPromise.catch(function() { |
| 939 | + // Autoplay blocked — play on first mousemove or touch |
| 940 | + var startOnInteraction = function() { |
| 941 | + music.play(); |
| 942 | + document.removeEventListener('mousemove', startOnInteraction); |
| 943 | + document.removeEventListener('touchstart', startOnInteraction); |
| 944 | + }; |
| 945 | + document.addEventListener('mousemove', startOnInteraction); |
| 946 | + document.addEventListener('touchstart', startOnInteraction); |
| 947 | + }); |
| 948 | + } |
| 949 | + } |
| 950 | + |
927 | 951 | function dismiss() { |
928 | 952 | if (dismissed) return; |
929 | 953 | dismissed = true; |
930 | 954 |
|
| 955 | + // Stop and reset music when splash closes |
| 956 | + var music = document.getElementById('tp-intro-music'); |
| 957 | + if (music) { |
| 958 | + music.pause(); |
| 959 | + music.currentTime = 0; |
| 960 | + } |
| 961 | + |
931 | 962 | clearTimeout(typeTimer); |
932 | 963 | if (typeof animFrame !== 'undefined' && animFrame) cancelAnimationFrame(animFrame); |
933 | 964 |
|
|
0 commit comments