Step Two. How will our small plugin work?
- First we need to think it over a bit and decide what we do inside the xml and all those actions. One thing we need is to say which pano starts which music. Second thing we need is to know whether the music common for some two panoramas was already started and if yes, then don’t play it, and if there’s another pano with different sound file, then stop playing current music and start new one.
- Probably you didn’t know this, but we can add any custom attributes to xml elements. Let’s add ‘music’ attribute to our scenes inside tour.xml file. Let’s take names of sound files as values.
- Open ‘tour.xml’ in any editor and add
music="Kai_Engel_-_05_-_Hopes_and_Dreams" for first two scenes
music="Kai_Engel_-_06_-_Changing_Reality" for the third scene, and
music="Kai_Engel_-_08_-_Oecumene_Sleeps for the last two scenes
The code should go somewhere between scene attributes, e.g.
|
Source code
|
1
2
3
|
<scene name="scene_5440"
title="5440" music="Kai_Engel_-_08_-_Oecumene_Sleeps"
onstart="" havevrimage="true" >
|
4. Now let’s create our small plugin. Fast way is to copy our ‘tour.xml’ to ‘sound’ folder, rename it ‘sound.xml’, then open it in editor and delete everything except <krpano> tags. Now we need to include this file into our main ‘tour.xml’. Open it and at the very top you’ll find the line <include url="skin/vtourskin.xml" /> .This one includes KRpano skin. Copy this line and paste it below (or put cursor on this line and press Ctrl+D to duplicate the line). Change path to our ‘sound.xml’ file. Both lines will look like this:
|
Source code
|
1
2
|
<include url="skin/vtourskin.xml" />
<include url="sound/sound.xml" />
|