Soundinterface icon in wrong state on iOS

  • I'm using the soundinterface to play a sound.

    Code
    <events name="currentpano"
    onnewpano="playsound(bgsnd, 'assets/sound.mp3|assets/sound.ogg', 0);"
    onremovepano="stopsound(bgsnd);"
    />
    
    
    <plugin name="snd" url="soundonoff.png" align="leftbottom" x="10" y="10" alpha="0.5" scale="0.5" onover="tween(alpha,1);" onout="tween(alpha,0.5);"
    crop="0|0|50|50"
    onclick="pausesoundtoggle(bgsnd); switch(crop, 0|0|50|50, 0|50|50|50);"
    />

    From the HTML5 and iOS (iPhone / iPad) Notes I read:
    A sound can't start to play automatically! An user interaction is needed to start playing the sound, e.g. a touch on the screen by the user. The krpano soundinterface plugin automatically detects that situations and when the playing is not possible it automatically queues the playsound() command and waits for the next user interaction to start the sound automatically (e.g. when the user touches the screen to pan the pano or to click a button).

    This results on iOS that when there is no sound the "sound on" icon is visible and when the user taps the sound icon the sounds starts playing but the "sound off" icon is displayed. This is the opposite of what I want and how it works on other devices.

    How can I invert the crop state on iOS devices or even better make it depend on whether the sound is playing or not?

  • Solved it by using a plugin for iOS devices and a plugin for non-iOS devices.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!