Paused audio resumes automatically on refocusing browser tour tab in Firefox and Chrome on Win10

  • Hi all,

    my paused sound resumes when using ATL+TAB to get back into the browser tour tab.

    Sound plays/streams by onclick on "play hotspot", then gets paused by clicking on "pause hotspot", then I use ALT+TAB to switch to another program, then use ALT+TAB again to get back to the browser tour tab and the problem occurs:
    Most of the times (not always), the paused sound resumes automatically without any other user interaction.
    Is it possible the browser audio focusing may cause this in Chrome and Firefox?

    I tried both streamsound and playsound, tried autopause and autounlock true/false without success.

    Maybe a manual autopause action could be a workaround: Once the vtour looses focus, pause the sound and switch play to pause button, but I'm not sure how to achieve this.

    Right now I use this rather dirty code:

    Code
    <hotspot name="snd1play" ... enabled="true" visible="true" onclick="destroysound(s2); streamsound(s1, 's1.mp3|s1.webm', false, 1, stopallsounds();); set(hotspot[snd1pause].visible,true); set(hotspot[snd1play].visible,false);" />
    <hotspot name="snd1pause" ... enabled="true" visible="false" onclick="pauseallsounds(); set(hotspot[snd1play].visible,true); set(hotspot[snd1pause].visible,false); set(hotspot[snd1play].onclick, togglesound(s1); set(hotspot[snd1pause].visible,true); set(hotspot[snd1play].visible,false); );" />

    Could someone share a hint please?

    Thank you!
    loki

  • Thank you very much Hamid for sending me into the right direction.

    With soundinterface setting
    autopause="true"

    below code works to prevent previously paused sound to automatically resume playing on loosing and then focussing the window/tab again:

    ... with "audio" being my helper var.


    Also with autopause="false" this bug happens Klaus.

    Best,
    Max

  • Hi,

    sorry, but I don't understand what you mean or why this is a bug?

    Automatically pausing and resuming the sounds when the browser window gets hidden or shown is the intended behavior of the autopause setting.

    So far I understand you don't want to the sounds to resume, why?

    Best regards,
    Klaus

  • Hi Klaus,

    sorry for the confusion.

    It seems like the autopause="true" setting overwrites the "pauseallsounds();"-action. Even with autopause="true", I expected that audio, which gets paused by the user would still be paused if the user changes tabs and comes back to the tour-tab. The previously paused audio (e.g. onclick audio-hotspot) would then resume unexpectedly, probably because autopause thinks a previously paused audio needs to resume on focussing the tour-tab again, which is misleading.
    Interestingly, the same happens with autopause="false".


    Bug behaviour step by step:

    For autopause="true":

    1: Start sound using streamsound(name, ......);
    sound starts as expected

    2: Pause sound using pauseallsounds();
    sound pauses as expected

    3: Switch tab/hide browser (Chrome)
    tour looses focus, sound still paused as expected

    4: Switch back to tour-tab
    tour gets focus, paused audio resumes without user interaction unexpectedly


    The same happens for autopause="false":

    1: Start sound using streamsound(name, ......);
    sound starts as expected

    2: Pause sound using pauseallsounds();
    sound pauses as expected

    3: Switch tab/hide browser (Chrome)
    tour looses focus, sound still paused as expected

    4: Switch back to tour-tab
    tour gets focus, paused audio resumes without user interaction unexpectedly


    I can create a test later.


    Best,
    Max

  • Hello,


    I have the same problem with all the tours created with Panotour (I have installed latest versions of both PTP and krpano).

    Is there any quick fix for this issue?

    Best regards,

    Lukas

Participate now!

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