Multiple playsounds in VR mode

  • Hi Guys,

    I wasn't too sure where to ask this question within the thread. I am trying to have multiple sounds being played on VR mode. I have a few panos each pano with a certain number of hotspots who's onclick activates the sounds. Since the VR mode requires an initial user-interaction for the playsound, I created an event where the user presses on the VR button headset and records this as a user interaction. Then my code fires a set of playsound(id,...,...); methods to have the sound objects created.


    I chose to keep the mute paramter to true, that way the sounds are being played without the user realising it. Then at this point i am in VR mode and I go onto a specific hotspot in a different scene, which only plays the sound of the last playsound () method. Then later on in my code for each hotspot I set


    At this point the played sound will be that of the sound.


    I would very much appreciate your help if anyone could give me any insight on this issue.


    Thank you so much *smile* *smile*

    Edited once, last by Aladdin_VR (January 19, 2017 at 2:31 PM).

  • Hi Thanks for your reply spacerywirtualne.

    I managed to figure it out by loading all the sounds at the very first touch and then the rest is just calling the preloaded sound.

    I am trying to do the same thing in order to bypass the constraints for videos (which require a user interaction). Creating an event where onmousedown calls an action that plays and pauses all the videos. That way second I click on the VR headset the user has already interacted with the pano (using the touchworkaround). However as soon as I move to another scene where there is another video. It still requires a touch. Do you have any idea about this ?

    Thanks once again ;)   *wink* *wink*

  • Hi

    I know that, and it is strange. Video VR mode does not start automatically. You have to touch the screen and it is troublesome, but only on Android and Google Chrome. On the IOS video starts immediately without touching. Android Firefox works well. I do not know if this Android or Chrome bug *huh*


    Maybe Klaus write something in this matter.


    Piotr

  • Hey thanks for your reply ;)  
    Yes i agree it's weird. I'm assuming since it works on android firefox, it must surely be a chrome issue and not an android one.

    I used the same trick with the sound to bypass the need for a user interaction. I set up the onmousedown event to playall the sounds (muted) thus creating the objects, and the onmouseup to stopall the sounds. This preloads all the sound and creates the sound object. Therefore upon wondering the scenes, it remembers the sound objects. Unfortunately, the video is not created the same way since I am calling it off a hotspot.

    I can use this method when the videos are on the same scene and make them work in VR mode, but as soon as I go in VR mode and move to another scene, it requires a user interaction.

    No of any smart tricks to keep the flow going while changing scenes in VR mode. *tongue* *squint* ?

    Best

    A.E

  • Hi,


    Until Klaus helps shed some light onto this I've managed to find a way that makes it seem like it's working up until, Chrome decides to support autoplay. (temporary fix)

    The logic is to have an event that plays the all the videos on the first touch (using the onmousedown function). Then when navigating to the other scenes, simply play around with the keep= "true" attribute and the onstart="true/false" attrbutes to have the video you would like to be clicked on when in VR to "autoplay".

    The idea here is to make use of the first click when the user clicks on the VR headset and take that as a userinteraction to load all the videos required, so when in VR mode we can have a functionality that looks like autoplay.

    I hope this could help Piotr.

    A.E

  • Good evening at all.
    @aelboudali did you ever tested this way?

    We created some scripts, wich catch the first touch event, to control some Audio and Videos at the Start-Scene.
    So actually we can play or handle with javascript all videos / audios in the first screne (also we can play multiple audio files at the same time without some problems).
    If we change the scene, we lost every control of the videos. we also tried to put all videos in the first scene also with keep="true" but there going to be lost on change in VR mode?!
    We use the <audio> Tags outside of krpano in the normal HTML Template, we still can handle them on changing the scene with Javascript, because they don't need some "visible" in VR mode.

    Do you have an example of playing videos in VR on changing the scene? and u still can control them after the change without a touch on iOS and Android?

    P.S. We found out, if you bookmark a tour as a Home-Screen-Bookmark on iOS, it doesen't need a touch anymore! Hope this help some other Peoples! Like an Trusted-Web-App for iOS!

    Thanks for the help and have a nice weekend!

Participate now!

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