You are not logged in.

1

Thursday, March 29th 2018, 9:05am

Soundinterface icon in wrong state on iOS

I'm using the soundinterface to play a sound.

Source code

1
2
3
4
5
6
7
8
9
<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?

2

Wednesday, April 25th 2018, 8:39am

The background sound example also shows the same behavior on iOS:
https://krpano.com/examples/119/krpano.h…groundsound.xml

The sound icon is 'on' when the sound is initially not playing and the sound icon is 'off' when the sound starts playing on the first user interaction.

3

Thursday, April 26th 2018, 1:32pm

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

Source code

1
2
3
4
5
6
7
8
9
10
11
<!-- a button to pause/play the sound (iOS devices) -->
<plugin devices="ios" 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|50|50|50"
onclick="pausesoundtoggle(bgsnd); switch(crop, 0|50|50|50, 0|0|50|50);"
/>

<!-- a button to pause/play the sound (non iOS devices) -->
<plugin devices="!ios" 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);"
/>

4

Saturday, June 22nd 2019, 7:04am

chrome

the latest version of chrome mobile browser has the same problem, so does your solution still work?

Similar threads