SoundPlay Helper Plugin xml only plugin(krpano 1.21.2)
简述
本插件可一举解决关于背景声音播放、场景声音分组播放以及场景内热点声音播放的问题。
- 在项目启动时即播放背景音乐、即使场景切换音乐也不会变化
- 全局声音与单场景声音
- 随心所欲控制各场景声音,也就是不同场景可能用同一背景音乐,而没有中断
- 控制场景中不同位置的热点声音
- 可为同一个场景设置两组不同的声音,例如中英解说切换。
演示
其中两个场景含有热点音乐,第二个场景和第三个场景为同一组场景声音,第五个和第七个也为同一组场景音乐,也就是在这两组的场景内切换声音是不会中断,而是继续播放的。
功能简介
- 可添加背景音乐,在项目启动时播放,可设置是否循环播放。
- 可为每个场景单独添加声音,在进入场景时播放,可设置是否循环播放。
- 当切换的两个场景的场景声音是一样的时,则声音不中断,继续播放。
- 可在场景里单独设置声音播放热点。
- 不建议同时播放2个以上声音,建议在有场景声音或热点声音时,将背景音乐屏蔽,设置为false。
使用方法
本插件需要配合官方插件soundinterface插件。请在使用前确认在plugin文件夹中已经拷贝了对应版本的soundinterface.swf和soundinterface.js。
将soundhelper.xml以及ypopen.png拷贝到项目根目录下。
在主xml文件加入以下代码:
| 1 | <include url="soundhelper.xml" /> | 
热点按钮的写法,要有style=”skin_soundbutton”
| 1 2 3 | <hotspot name="spot1" style="skin_soundbutton" ath="13.267" atv="-6.054"   /> <hotspot name="spot2" style="skin_soundbutton" ath="-105.872" atv="-7.814"  /> <hotspot name="spot3" style="skin_soundbutton" ath="151.117" atv="-2.083"    /> | 
声音播放的设置在soundhelper.xml中进行。
背景音乐的id为bgsnd,对应的停止动作为stopsound(bgsnd);
场景背景声的id为bgs,对应的停止动作为stopsound(bgs);
当前热点音乐的id为get(sound_settings.now_play),对应的停止动作为stopsound(get(sound_settings.now_play));
soundhelper.xml设置
基本设置
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | <!--  	        bgsound 是否启用背景声音,可填true或false,建议有其它声音时,填false                 bgsoundurl 背景声音的路径                 bgsoundloop 背景声音是否循环,循环为0,不循环为1	                            hotspoturl 音乐热点按钮的路径                 play_crop 按钮播放时的crop                 pause_crop 按钮暂停时的crop                 now_play=""  默认,不要修改                 musicgroup="" 默认,不要修改                 muteglobal="true" 静音按钮是只针对当前场景还是全局性的 --> 	<sound_settings bgsound="false" 	                bgsoundurl="backgroundmusic.mp3" 	                bgsoundloop="0" 	                       	                hotspoturl="ypopen.png" 	                play_crop="68|0|68|68" 	                pause_crop="0|0|68|68" 	                now_play="" 	                mute="false" 	                muteglobal="true" 	                musicgroup="" 	                musicplaybutton_name="button" 	                musicchangebutton_name="button3" 	                musicchange="2" 	                buttonhtml="中文" 	               /> <!--  	      scenesound的name也就是scene的name。scenemusic对应该场景音乐的路径。loop为循环设置。 hotspotmusic的name也就是对应hotspot的name,musicurl对应热点音乐的路径。 --> 	<scenesound name="scene_achilleion-hof-unten"     > 	        <hotspotmusic name="spot1" musicurl="1.mp3"/> 	        <hotspotmusic name="spot2" musicurl="3.mp3"/> 	        <hotspotmusic name="spot3" musicurl="5.mp3"/>	       	</scenesound>      	<scenesound name="scene_canaldemure5" scenemusic="soundfile/Section 1/01-01.mp3" scenemusic2="soundfile/Section 1/01-02.mp3" loop="1"  >        	</scenesound>  	<scenesound name="scene_kalamaki-strand" scenemusic="soundfile/Section 1/01-01.mp3" scenemusic2="soundfile/Section 1/01-02.mp3" loop="1" >      	</scenesound>  	<scenesound name="scene_korfu-stadt-alte-festung-ganz-oben" scenemusic="soundfile/Section 1/01-04.mp3" scenemusic2="soundfile/Section 2/01-06.mp3" loop="1" >      	</scenesound>  	<scenesound name="scene_pantokrator-antenne" scenemusic="soundfile/Section 1/01-05.mp3"  loop="1" > 	        <hotspotmusic name="spot1" musicurl="1.mp3"/> 	        <hotspotmusic name="spot2" musicurl="3.mp3"/> 	        <hotspotmusic name="spot3" musicurl="5.mp3"/>	 	</scenesound>  	<scenesound name="scene_pantokrator-kloster" scenemusic="soundfile/Section 1/01-04.mp3" scenemusic2="soundfile/Section 2/01-06.mp3" loop="1">         	</scenesound> |