var adMain = document.querySelector("#adMain");
var adAnother = document.querySelector("#adAnother");
// 播放第index展厅背景音乐
function jsPlayBg(index) {
adMain.src = "StreamingAssets/Audios/ZT" + index + ".mp3";
// adMain.play();
adMain.load();
adMain.currentTime = 0;
let playPromise = adMain.play();
if (playPromise) {
playPromise.then(() => {
audio.play();
}).catch(() => {
})
}
}
///
/// 暂停背景音乐
///
function jsPauseBackgroundMusic() {
adMain.pause();
}
///
/// 恢复背景音乐
///
function jsResumeBackgroundMusic() {
adMain.play();
}
///
/// 设置背景音乐静音
///
function jsSetBackgroundMute() {
adMain.muted = !adMain.muted;
}
///
/// 播放音效(默认在摄像机位置播放)
///
function jsPlayAudio(audioName) {
adAnother.volume = 0.5;
adAnother.src = "StreamingAssets/Audios/" + audioName + ".mp3";
adAnother.play();
}
///
/// 停止音效
///
function jsStopAudio() {
adAnother.stop();
}