---
title: "krpano 加入背景音乐"
author: "starnc"
date: "2019-11-22T16:24:46Z"
tags: []
categories: ["Web前端"]
slug: "krpano"
draft: false
lastmod: "2019-11-22T16:24:46Z"
id: 2510258
url: "https://starnc.iteye.com/blog/2510258"
---

krpano version="1.19" pr16

1、在tour.xml里加入

	<plugin name="soundinterface"
	    url.flash="%SWFPATH%/plugins/soundinterface.swf"
	    url.html5="%SWFPATH%/plugins/soundinterface.js"
	    rootpath=""
	    preload="true"
	    keep="true"
    />


	<action name="bgsnd_action" autorun="onstart">
	   playsound(bgsnd, 'backgroundmusic.mp3', 0);
	</action>


其中backgroundmusic.mp3放在根目录下

2、在vtourskin.xml中查找layer的name为skin_btn_vr、skin_btn_fs，在这两个layer之间加入黑体字部分的代码

<layer name="skin_btn_vr"        style="skin_base|skin_glow" crop="0|0|80|64"    align="center"      x="+146" y="0"  scale="0.5" onclick="webvr.enterVR();" visible="false" />
 
**				<layer name="skin_btn_sound"     style="skin_base|skin_glow" crop="64|704|64|64"  align="right"      ox="0"   x="130"   y="0"  scale="0.5" onclick="pausesoundtoggle(bgsnd);switch(crop,64|704|40|64,64|704|64|64);switch(alpha,1,0.25);switch(ox,0,-12)"  />**
				 
				<layer name="skin_btn_fs"        style="skin_base|skin_glow" crop="0|576|64|64"  align="right"       x="90"   y="0"  scale="0.5" onclick="switch(fullscreen);" devices="fullscreensupport" />