bugfix: borked station switching w/ prior revision ++ remove iOS tap to allow audio type overlay, not needed
This commit is contained in:
		@@ -36,7 +36,6 @@ export function Player() {
 | 
			
		||||
  const [coverArt, setCoverArt] = useState("/images/radio_art_default.jpg");
 | 
			
		||||
  const [elapsed, setElapsed] = useState(0);
 | 
			
		||||
  const [duration, setDuration] = useState(0);
 | 
			
		||||
  const [userHasInteracted, setUserHasInteracted] = useState(false);
 | 
			
		||||
 | 
			
		||||
  const soundRef = useRef(null);
 | 
			
		||||
  const uuidRef = useRef(null);
 | 
			
		||||
@@ -84,7 +83,6 @@ export function Player() {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
const togglePlayback = () => {
 | 
			
		||||
  if (isIOS && !userHasInteracted) return;  // block only on iOS until interaction
 | 
			
		||||
  if (isPlaying) {
 | 
			
		||||
    soundRef.current?.pause();
 | 
			
		||||
    setIsPlaying(false);
 | 
			
		||||
@@ -98,20 +96,21 @@ const togglePlayback = () => {
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
useEffect(() => {
 | 
			
		||||
  if (soundRef.current) {
 | 
			
		||||
    soundRef.current.stop();
 | 
			
		||||
    soundRef.current.unload();
 | 
			
		||||
    soundRef.current = null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (isPlaying) {
 | 
			
		||||
    playStream();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}, [activeStation]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
    if (!userHasInteracted) return;
 | 
			
		||||
 | 
			
		||||
    if (isPlaying) {
 | 
			
		||||
      playStream();
 | 
			
		||||
    } else {
 | 
			
		||||
      if (soundRef.current) {
 | 
			
		||||
        soundRef.current.stop();
 | 
			
		||||
        soundRef.current.unload();
 | 
			
		||||
        soundRef.current = null;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }, [activeStation]);
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
    clearGlobalMetadataInterval();
 | 
			
		||||
@@ -170,25 +169,6 @@ const togglePlayback = () => {
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <>
 | 
			
		||||
      {/* Unlock overlay */}
 | 
			
		||||
      {!userHasInteracted && isIOS && (
 | 
			
		||||
        <div
 | 
			
		||||
          className="fixed inset-0 z-50 bg-black bg-opacity-80 flex items-center justify-center text-white text-xl cursor-pointer"
 | 
			
		||||
         onClick={() => {
 | 
			
		||||
            setUserHasInteracted(true);
 | 
			
		||||
 | 
			
		||||
            if (Howler.ctx?.state === "suspended") {
 | 
			
		||||
              Howler.ctx.resume();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            playStream(); // <-- Immediate play within same gesture
 | 
			
		||||
        }}
 | 
			
		||||
 | 
			
		||||
        >
 | 
			
		||||
          Tap to Start Audio
 | 
			
		||||
        </div>
 | 
			
		||||
      )}
 | 
			
		||||
 | 
			
		||||
      <div className="station-tabs flex gap-2 justify-center mb-4 flex-wrap z-10 relative">
 | 
			
		||||
        {Object.entries(STATIONS).map(([key, { label }]) => (
 | 
			
		||||
          <button
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user