Soundinterface not working.

  • I have tried the soundinterface but it does not work.

    I can not see any thing wrong with this. I started with a very simple setup with a button for sound

    <plugin name="soundinterface" url="plugins/soundinterface.swf" rootpath="sounds/"
    />
    <plugin zorder="1" name="sound1" keep="true" align="bottomleft" x="10" y="155" visible="true" alpha="0.8" url="skin/sound1.png" onclick="playsound(sound1,water.mp3);"
    />

    I also tried onclick="playsound(sound1,sounds/water.mp3);"
    but I assume that this should be taken care of with the rootpath
    Full demo tour here http://www.panoramas.dk/panorama/krpano/vtour1/tour.html

    I can see from the activity window that the soundinterface.swf does not load but as you can see it is here
    http://www.panoramas.dk/panorama/krpan…ndinterface.swf

    Hans

  • Hans i checked tour.xml and then tested the same code on my tour it did not work. the problem is keep="true" changed that and it worked for me. since the soundinterface is outside of the scene tags keep="true" is needed to carry that in.

  • Hans i checked tour.xml and then tested the same code on my tour it did not work. the problem is keep="true" changed that and it worked for me. since the soundinterface is outside of the scene tags keep="true" is needed to carry that in.

    Thanks
    That did it.

    Now I just have to figure out how to make it start at opening the panorama with a stop/start button and how to have different sounds on each pano.

    I asume KRpano does not have the simple Linked option as we have in FPP.

    Hans

  • use this for different sounds on each scene you will have to include this piece of code in every scene changing the target mp3. auto assigns and automatic ID you could leave sound1 but them you have to change that ID in each scene to sound2, sound3 and so on.

    <events onxmlcomplete=""
    onpreviewcomplete=""
    onloadcomplete="playsound(auto,mp3file.mp3);"
    onloaderror=""
    onkeydown=""
    onkeyup=""
    onclick=""
    onviewchange=""
    onidle=""
    onresize=""
    onenterfullscreen=""
    onexitfullscreen=""
    />

  • Hans if you add these 2 lines of code you can get Titles to display when hovering over the thumbs.

    set(plugin[get(thumbname)].onclick, openthumbs() );


    add these 2 lines below the line above inside the buildthumbs action

    copy(plugin[get(thumbname)].scenetitle, scene[get(i)].title);
    set(plugin[get(thumbname)].onhover, showtext(get(scenetitle)) );

  • Well I already got this working but the problem is that the sound continues to play when you change panorama.
    There is no command like onunload.

    I tried the onviewchange="" but if I use that also the sound does not play at all.

    Hans

  • add this line of code to stop the current sound when loading a new pano.

    <action name="openthumbs">
    if(%1 != NEXT,
    set(i,0);
    set(events.onclick, set(events.onclick,null); delayedcall(0.1, closethumbs() ); );
    );

    if(i LT scene.count,
    txtadd(thumbname,'thumb_',get(i));
    openthumb(get(thumbname)); stopallsounds();
    set(plugin[get(thumbname)].onclick, set(events.onclick,null); closethumbs(); loadscene(get(linkedscene),null,MERGE,BLEND(1)); );
    inc(i);
    openthumbs(NEXT);
    );
    </action>


  • Well I already got this working but the problem is that the sound continues to play when you change panorama.
    There is no command like onunload.

    I tried the onviewchange="" but if I use that also the sound does not play at all.

    Hans

    if onviewchange does not work then it is most likey still blending or doing some other action. onviewchange does not work very well when loading the panos. it is better used after the pano is fully loaded. when that type of stuff happens to me i try to delay the action some to let other things finish. try a different event or

    delayedcall(1,everythingelse());

  • Super, that did it.

    Hans

  • confirmed. i made a tour yesterday with the vtour droplet and the sound I added also does not work in safari in ipad mode. soundinterface is not on the list of unsupported items for Idevices. No idea why it does not work.

    Yes I also wonder why. Seems that I need to get an iPad to do some real test.

    I finally got it working in Flash but that is also difficult with the Vtour opotion.
    The problem is to stop previous sound.

    Including stopallsounds here work.
    if(i LT scene.count,
    txtadd(thumbname,'thumb_',get(i));
    openthumb(get(thumbname));
    set(plugin[get(thumbname)].onclick, set(events.onclick,null); closethumbs(); stopallsounds(); loadscene(get(linkedscene),null,MERGE,BLEND

    However to start a new sound on next loaded panorama you can only use onloadcomplete. That means the sound will not load until sometimes 10 sec.
    If I use onxmlcomplete or on previewcomplete the stopsounds does not work but I can easy get many sounds playing at the same time.

    I do not understand this as I do stop the sound at the click on the thumbnail. It looks like there is some delay before it works. I do have the preload tag on the soundinterface.

    If you use separate xml for each pano you can get it to work fine with sound starting first.

    All this would be so much easier if KRpano had the simple linked option like in FPP. Everything is so much easier in FPP because of this.

    Hans

  • did you try moving your stopallsounds() in each individual scene from the onloadcomplete to onstart? that should stop the sound very first thing.

    Quote

    - <scene name="scene_09" title="09" onstart="" thumburl="09.tiles/thumb.jpg">
    <view hlookat="0" vlookat="0" fovtype="MFOV" fov="90" maxpixelzoom="2.0" fovmin="60" fovmax="120" />
    <events onloadcomplete="stopallsounds();" />

    to

    Quote

    - <scene name="scene_09" title="09" onstart="stopallsounds();" thumburl="09.tiles/thumb.jpg">
    <view hlookat="0" vlookat="0" fovtype="MFOV" fov="90" maxpixelzoom="2.0" fovmin="60" fovmax="120" />
    <events onloadcomplete=""/>

  • first thing is see is that you are have made an action of your own called playsound. there is a native build in action for krpano called playsound that could cause problems. next thing i see is that you are using the regular playsound, setting ath and atv for 0 then calling a 360 degree falloff for the sound. all that is not needed. jsut playsound(auto,duck.mp3,0); is enough. the ath and atv go with playsound2d, playsound3d if you want to direct where the sound is coming.

    Hans if you want something like what FPP can do you could do this. Put these buttons outside of all the scene tags. I added keep="true" so they stay for all scenes, change the onlick to use variables for settings. use an action to populate those settings while loading a scene.

    <plugin zorder="1" name="sound1on" align="bottomleft" x="10" y="155" visible="false" alpha="0.8" url="skin/sound1.png" onclick="playsound(auto,%1, %2);</); set(plugin[sound1on].visible,false); set(plugin[sound1off].visible,true); keep="true"/>

    <plugin zorder="1" name="sound1off" align="bottomleft" x="10" y="155" visible="true" alpha="0.8" url="skin/sound1off.png" onclick="action(mute); set(plugin[sound1off].visible,false); set(plugin[sound1on].visible,true); keep="true"/>

    onstart of each scene try this. your off button never changes, we just need to tell the ON button what to play when each scene loads. using your playsound action we sub out the name and looping settings and such with variables that we can populate on each scene load. below is the action for each scene

    onstart="stopallsounds(); playsound(auto,water.mp3, 0); set(plugin[sound1on].onclick, playsound(auto,water.mp3, 0));" this would be for scene_01
    onstart="stopallsounds(); playsound(auto,water.mp3, 0); set(plugin[sound1on].onclick, playsound(auto,water.mp3, 0));" this would be for scene_03

    that action should stop any sound playing first, start playing the correct sound for the scene, then set the on button to play that sound in case the user turns the sound off and then wants it back on again.

    GRRR - i found something easier after all that thinking. second option is super easy. for your button audio button you would only need 1 not 2. code the onclick for the audio button to onclick="pausesoundtoggle(id);" each time you click the audio button it will eitehr pause or unpause what ever it is already playing. so it would be this.

    onstart="stopallsounds();" on each scene.
    onloadcomplete=" playsound(id1,water.mp3, 0);" - example for each scene
    onloadcomplete=" playsound(id1,duck.mp3, 0);" - example for each scene

    place this outside all scene tags
    <plugin zorder="1" name="soundon_off" align="bottomleft" x="10" y="155" visible="true" alpha="0.8" url="skin/sound1.png" onclick="pausesoundtoggle(id1);"/>

  • well the logic behind it all should be applicable to anything you end up with especially the last easy one.

    EDIT you need to add keep="true" to the soundon_off button example if you choose to go that route.

    Thanks I will look at it when I get time to look at my own things again.

    Personally I have no problem with the sound starting after images are loading , actually I think that is better but I was making a tour for another photographer who wanted the sound to start before everything else.
    Right now I am more interested in knowing why KRPano sound does not seem to work with HTML5.

    Hans

Participate now!

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