import config from '../config/config.js'
export const API_BASE_IMAGE = config.API_BASE_IMAGE

export const playBackgroundAudio = (url) => {
	const backgroundAudio = uni.createInnerAudioContext();
	backgroundAudio.loop = true;
	backgroundAudio.autoplay = true;
	backgroundAudio.src = API_BASE_IMAGE +  url
	return backgroundAudio

}

export const funplayAlertAudio = (url) => {
	const alertAudio = uni.createInnerAudioContext()
	alertAudio.autoplay = false;
	alertAudio.src = API_BASE_IMAGE + url
	alertAudio.onEnded(function() {
		alertAudio.destroy()
	})
	alertAudio.onStop(function() {
		alertAudio.destroy()
	})
	return alertAudio
}
