Mix vtour multires images and videos

  • Hello,

    I feel really stupid :/ After hours and hours trying different things I can't manage to do what I want. Even on some basic steps I can't manage. My knowledge must be to weak.

    I have a virtual tour with 60 HD images in multiresolution. I also have a 360video of 2 seconds with 60 frames corresponding to the HD images. On this video I have a hotspot that plays the video "ondown" and pauses it "onup" (coded in vtourskin.xml in hotspotsyle). The first image of the tour is the first frame in HD, it has a hotspot that plays the video when I click on it and keep the button down.

    All this works, adding "onvideocomplete" it shows the last HD image.

    Now here's what I would like to do. Instead of pausing the video "onup" I want krpano to look the position of the video and to load the HD image corresponding to this frame (or duration, I undertood it will be in 0.xx seconds). But I don't even manage to "trace" the video position when it's on pause. I tried so many things ^^

    How do you think I should try to do this ? Any advise would be welcome as I'm really stuck... I've read the doc, looked at the forum and don't find any clue (or I"m too stupid to understand how it works). Any advise on a good way to start would be welcome too, I guess it's perhaps not a good idea to play videos and try to interact with them in vtourskin but I don't manage anything from scratch.

    If somebody was kind enough to help me that would be really great :)

  • Thanks a lot for your answer Klaus. The problem is that I don't really know exactly what to do nor which steps I need to go thrue for the moment. I've read lot of things and sometimes manage to "hack" things, but it's generally just chance when it works ^^ I'm not that stupid but not far from it!

    Anyway, I understand perfectly how difficult it can be to help me with such a general demand and no code to help on, I'm gonna try to give examples as soon as possible.

    Perhaps a best way would be to ask on precise things and get them fixed one by one. For example, in my vtourskin.xml I have

    onup="loadscene(scene_02, null, MERGE|KEEPVIEW|KEEPLOOKAT,BLEND(0.01));"

    This works fine. The view is kept when I click on the hotspot.

    In the standard tourskin.xml I would like to have the same feature when I click on the button next and prev of the menu showed on the bottom in vtourskin. By looking the code I thought perhaps I had to work on "skin_btn_next" and "prev". That lead me to " loadscene_blend_next" and prev. Am I right ?

    I tried

    loadscene_blend_next="KEEPVIEW|KEEPLOOKAT,BLEND(0.01)"

    But it seems I don't use the good syntax,or worse, I'm just not in the good place. Here it is for a first example of a simple thing to manage but that I'm not even able to manage ^^

    Best regards :)

    • Offizieller Beitrag

    Look at the code step by step.

    E.g.

    1. the 'skin_btn_next' button calls in its onclick event the 'skin_nextscene' action
    2. in the 'skin_nextscene' action the 'skin_loadscene' is called
    3. and the 'skin_loadscene' action there is this code:
    Code
    loadscene(get(scene[get(newscenenameorindex)].name), null, get(skin_settings.loadscene_flags), get(blendmode));

    There you see actual call and the parameter you wanted to change in your example from above is the skin_settings.loadscene_flags one. There you also see that adding something to blend parameter wouldn't work.


    If you want to always keep the viewing direction when switching scenes, you could either change:

    Code
    loadscene_flags="MERGE"

    to:

    Code
    loadscene_flags="MERGE|KEEPVIEW"

    or to:

    Code
    loadscene_flags="MERGE|KEEPMOVING"


    Or do that dynamically by modifying the skin_settings.loadscene_flags variable - or even directly use some custom calls.

    For learning it might be also easier to start without vtourskin.xml and manually implement only the pieces and parts you need...

    Best regards,
    Klaus

  • Thank you so much for that quick answer ! Yes, I agree with the idea of going from scratch, I even tried, but honnestly I don't have enough knowledge at the moment, I might be mistaken, if only because I might encounter conflicts when using vtourskin + videoplayerinterface, and I would have to do as you say, but the task seems so massive to me and vtourskin is already so complete.

    However, I am well aware that you are right, and that's the way I should proceed. I guess I'll end this way ^^ In any case, I have thoroughly read the documentation and code in recent days, and I am already pleased with my progress in understanding krpano, even though there are still significant gaps. Anyway, I sincerely thank you for your assistance and also for this fantastic tool that is krpano :)"

  • Me again ! ^^ But not with a pb, just a precision for future readers if there are some noobies like me reading that topic in the future.

    Those changes wouldn't accept to work in vtourskin.xml, after minuts trying to figure out why (I don't want to give the impression I don't try to learn and understand) I saw those parameters could be set (and it was the case) in tour.xml and that it overrides vtourskin. Important precision, otherwise you keep trying changes that have no effect (and I guess lots of things that didn't work past days were perhaps for that reason). Happy to see that I manage to improve a bit :) Klaus is right, it wouldn't have been the case if I went from scratch ^^

  • Hello !

    Here we are for the serious stuff I don't manage... Example of my latest try :

    Code
       <action name="loadscenebyt" scope="global" >
      set(videofps, calc(plugin[video].time * 30));
      set(scenenam, 'scene_', videofps);
      loadscene(scenenam);
      </action>

    I guess it seems normal for you that it doesn't work. I've tried so much things ^^ For example I saw in vtourskin "copy(t1, plugin[video].time);", so I also tried to call directly "t1" but I guess I didn't do it the good way. I've read a lot in the doc about args, variables but I must miss something, or my understanding isn't good enough.

  • Code
    <action name="loadscenebyt" scope="local">
        calc(videofps, plugin[video].time * 30); 
        calc(scenenam, 'scene_' + videofps); 
        loadscene(get(scenenam)); 
    </action>

    set(a,calc(b+c)); === calc(a, b+c);

    set(a,get(b)); === copy(a, b);

    set() can not join parts, for that you need calc() or txtadd()

    you forgot to use get() in loadscene

    --> normally get() is needed to access a variable, with a few execption like in calc(), trace(), debug(), etc

    --> better use local scope, otherwise it is possible to run into variable name conflicts.

  • Thanks a lot for that quick answer ! I feel like I understand what you say, I'm gonna try to see if I manage this. The next step for me will be to set videofps variable to the nearest integer to make it work but I think that if I arrive to that step I will already be pretty proud, even if it will never work if I don't convert the value to an integer ^^

  • Hey hey hey ! Sorry for the double post, thanks so much it work perfecly ! But now, how can I set the videofps value to an integer (lol) ? I'm gonna search but trust me when I say it will probably take me ages with 90% of chance of failing ^^

    Anyway thank you so much for that quick and perfect answser :)

    EDIT : I'm pretty proud, calc(videofpsInteger, floor(videofps));

    works perfecty ! I have a pb with keepview now, strange, I'll try to find the problem before annoying you again. Thanks so much Klaus and indexofrefraction :)

    2 Mal editiert, zuletzt von gn0o0b (10. Januar 2024 um 12:22)

    • Offizieller Beitrag

    Here your code with rounding and clamping to a certain range to ensure a valid value (replace YOUR_MAX_FRAME_NUMBER with a number). Additionally also the KEEPVIEW flag and BLENDING was added:

    Code
    <action name="loadscenebyt" scope="local">
       video_frame_n = roundval(plugin[video].time * 30);
       clamp(video_frame_n, 0, YOUR_MAX_FRAME_NUMBER);
       scenenam = 'scene_' + video_frame_n; 
       loadscene(get(scenenam), null, KEEPVIEW, BLEND(0.5)); 
    </action>
  • Thank you Klaus, does it mean I'd rather use this than calc(videofpsInteger, floor(videofps));

    ? Because it seem to work like that too. Thanks for the keepview. I'm so happy of the result. Now I have to work on the hardest part, reload the video at the good place when I click on the hotspot to go in the video again. I doubt I can manage that alone but I'm gonna try before asking.

  • Thanks for that answer, it's always great to learn new things. I'm still far from the end of my journey as I don't even manage to go to at a precise point of the video on loading, so before I can use a variable to do it I guess it's gonna be long !

  • Here I am again :)

    Happy because I've learned a lot and because I managed few things and steps, but stuck again^^

    Context:

    After loading my HD pano after the first interaction (HDpano -> ondown video -> onup HDpano on the good frame) I want to load the video at the good time position when I click again on the hotspot. I found how to load a video at a given time but know I need to set a variable (or something else ?) to give the "good" time for the video loading.

    First I tried by working on the video part, I quickly thought a better way as I'm a noob and I don't really understand what's executing and happening exactly that I could try another method.

    An easy way to play the video at a good moment was to use the scenename and to convert it to numbers only, then I would only have to divide it by 30 (frames) to have the time set in my variable. But I don't manage to take letters off my scenenames to keep only numbers.

    So I'm back on trying to load my videoscene by manipulating the video plugin.

    I swear I've read (being concentrated) the wole xml reference doc page, same for action-scripting reference, I learned a lot but as I said, I have huge gaps in my coding comprehension. So please, don't laugh too much with the code written above, as I don't really understand (even if it becomes better) I have to try until it works then know that I finally understood.

    Code
         <action name="vidpaused" scope="global">
        if(plugin[video].onvideoplay), copy(vidpaused, plugin[video].time);
                 trace(vidpaused);
          </action>

    I also tried with "onvideopause".

    I want to have the "plugin[video].time" at the moment the video has been paused. I guess the pb of this one is that it needs to be refreshed regularly, it's called when onup so perhaps the value doesn't exist anymore, but this action is before " plugin[video].pause",sure there are probably other problems :/ I need a variable that stocks this value "onup" or "onvideopaused" and that this value can be available on the next scene.

    I've read how "scope" works, but even if I understand my knowledge isn't good enough to be sure if I use the good one, I generally try with both, but sometimes forget...

  • Hmmm, for the video pausing and matching with the HD images it might involve some scripting to track video progress and trigger the image swap. As for the editing part, especially if you're on a Mac and looking for something a bit more intuitive, this guide: https://www.movavi.com/learning-porta…re-for-mac.html might make life a bit easier for cutting, editing, and maybe even syncing stuff. Good luck!

Jetzt mitmachen!

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