[PLEASE HELP] when my Halloween Party Barn Tour loads - the music doesn't auto play

  • Tour Link:

    https://www.i-zombie.com/BP/Tour.html

    in Safari and Chrome - when the tour link loads the music for the first scene is not playing (and it should be). but, if i click anywhere on the tour - the music starts playing. i want it to load when the link is clicked because there is no instruction that anyone would know that they need to click on the screen first. some people may just sit there as it auto-rotates and never know there is sound.

    is there a way to have the first pano (front of barn) start playing the music when the page loads instead of when someone clicks on the pano.

    for some reason it works correctly in Firefox but not the other two that i have. i don't know if there is some magic code that will force the first scene's mp3 file to play on load.

    ______________________________________

    second question - the first and last panos have the gyro working and it shows up in the menu bar at the bottom. but the middle two panos don't. the gyro option is missing on those. any idea why?

    the only thing different that i did was add a 'vlookatmax' and changed the 'limitview' to limitview="range" on those. here is the xml:

    please let me know and thanks in advance!

    6 Mal editiert, zuletzt von LSDMT (8. September 2020 um 22:17)

  • hm your sound setup is a bit strange...

    you have put xml inside the start action, i'm surprised that this doesnt trigger an errror. you should remove it.

    the soundinterface plugin should be loaded at the xml root level with keep="true" (next to the start action, not inside)
    (you need to add keep="true" to not unload things when the scene changes)

    also at the xml root level i would add an <events onremovepano="stopsound(bgsnd);" keep="true" />

    from all scenes i'd remove loading the soundinterface and those events

    the playsound() call for each scene i'd put into the scenes onstart="" action

    as for the auto play... nowadays audio play must be unlocked on most browsers first by a click...
    you can add a splash screen, play a silent sound and if the user clicks to enter the tour, audio play is unlocked


  • well - the instructions i was following was on the krpano page:

    https://krpano.com/releases/1.20.7/examples/#backgroundsound

    and specifically the .xml file that is linked for using as an example:

    https://krpano.com/viewsource.htm…groundsound.xml

    that's where i got the 'how'. i guess it was wrong but i am not much of a coder. i know enough to be dangerous but that's about it.

    so - is there any way you could modify my code so i know where and how you are talking about modifying it? i could PayPal you for your time if necessary..

  • this is the streamlined version...

    you need to add a jpg for the splash screen, some pic with something like "click to enter"
    i didnt test it, but the idea is that on loading the first scene is behind the splash
    if you click, the sound starts and the splash hides

    best, index

  • thank you! it's super sore :(

    so - i made a splash image and saved it as a .png file. i made a folder and called it 'images' and put splash image in it. i changed the code to:

    <layer name="splashscreen"
    width="100%" height="100%"
    zorder="99"
    url="https://www.i-zombie.com/BP/images/Enter.png"
    onclick="removelayer(splashscreen);"
    />

    but it is not working. the panos all load correctly and the sound plays correctly but the space image never comes up. i tried it in safari, firefox, and chrome. is there a plugin i need so that the splash image shows itself?

    here is a screenshot of the directory on my FTP:

  • ok. i had tried the local url first and it didn't work so i did the whole url thinking maybe that was why (which also didn't work but was there when i copied the code). thanks for letting me know the local would work fine.

    --

    so i changed it to this:

    <layer name="splashscreen"
    width="800px" height="600px"
    zorder="99"
    url="images/Enter.png"
    onclick="removelayer(splashscreen);"
    keep="true"
    />

    because the width and height at 100% filled the whole screen. either way - it DID work. however, clicking on it DOES make the splash screen go away but the pano still doesn't have sound unless you click somewhere on it. i can live with that if i have to.

    also - the splash screen is at the top-left instead of centered. i'm sure there is a code to tell it to center it vertically and horizontally on the screen but if it doesn't make the sound go on when you click to dismiss it - then ill probably just get rid of it.

    i saved it and it is live if you want to check it out:

    https://www.i-zombie.com/BP/Tour.html

    (also - if you have PayPal and DM me your PayPal email i would be happy to send you some money for helping me).

  • hm, to free the audio play the first mp3 played must probably get started from within the onclick event

    you can try something... make an mp3 with a very blank sound. 0.5 seconds of silence
    and change the onclick in the splash. you can also set the align for centering

    align="center"
    onclick="playsound(unlocksnd, 'sound/Blank.mp3', 0);removelayer(splashscreen);"

    the idea is that this also frees the blocked playback of your scene mp3...

    and nono, you dont have to pay anything. forget that.

    ps. for testing you can use just any mp3, we'll see if it frees the scene audio
    just use a different id for the unlock sound (see unlocksnd above)

  • thanks, Index. i just went ahead and changed the name of the first pano to include instructions to get sound. my dad didn’t want the splash screen.

    so - i should be good! i REALLY appreciate all your help.

  • for the sake of learning i tested it, now, and this works :

    Code
    <layer name="splashscreen" 
    		width="100%" height="100%"  align="center" zorder="99" url="splash.png"
    		onclick="playsound(unlocksnd, 'sound/blank.mp3', false, 0, removelayer(splashscreen));"
    		keep="true"
    		/>

    the unlock sound can be used with volume=0 and will unlock the playback of all audio.
    important is to remove the splash layer not too early, so this is done as oncomplete in the playsound() call

    ofc that is not beautyful, yet,
    it is just an example on how to use a splash layer to unlock audio play.

    best, index

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!