代码拉取完成,页面将自动刷新
同步操作将从 方先生123/仿羊了个羊web网页版h5源码 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/sheep.css" />
<script type="text/javascript" src="js/jquery-2.2.0.js" ></script>
<script type="text/javascript" src="js/main.js" ></script>
<script type="text/javascript" src="js/resources.js" ></script>
<script type="text/javascript" src="js/grass.js" ></script>
<script type="text/javascript" src="js/goods.js" ></script>
<script type="text/javascript" src="js/box.js" ></script>
<script type="text/javascript" src="js/button.js" ></script>
<script type="text/javascript" src="js/star.js" ></script>
<script type="text/javascript" src="js/level.js" ></script>
<script type="text/javascript" src="js/toast.js" ></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js" type="text/javascript"></script>
<title>羊了个羊</title>
</head>
<body>
<div class="div">
<canvas id="canvas" width="460px" height="800px"></canvas>
<audio controls autoplay hidden="True" loop id="bgmusic">
<source src="music/bg.mp3" type="audio/mpeg" >
您的浏览器不支持 audio 元素。
</audio>
</div>
<div id="wenzi" style="text-align:center;">
仿羊了个羊web h5版本正式上线,有疑问加微信fbao9394
<br>
<a href="https://gitee.com/fangxiansheng123">源码下载地址</a>
</div>
</body>
<script type="text/javascript">
/**
* @author ccbbs
* @file 解决安卓webview自动播放背景音乐的问题
*/
function BGMAutoPlayMgr/* solveAndroidBGMAutoplay */(url) {
this.audioContext = new (window.AudioContext || window.webkitAudioContext || window.mozAudioContext)();
this.sourceNode = null;
this.buffer = null;
this.isPlayingBGM = false;
this.toggleBGM = function () {
if (typeof this.sourceNode == 'object') {
if (this.isPlayingBGM) {
this.sourceNode.stop();
this.isPlayingBGM = false;
} else this._playSourceNode();
}
}
this._playSourceNode = function () {
const audioContext = this.audioContext;
audioContext.resume();
const _sourceNode = audioContext.createBufferSource();
_sourceNode.buffer = this.buffer;
_sourceNode.loop = true;
_sourceNode.connect(audioContext.destination);
_sourceNode.start(0);
this.sourceNode = _sourceNode;
this.isPlayingBGM = true;
}
let loadAndAutoPlay = (audioUrl) => {
const audioContext = this.audioContext;
const xhr = new XMLHttpRequest();
xhr.open('GET', audioUrl, true);
xhr.responseType = 'arraybuffer';
xhr.onreadystatechange = () => {
if (xhr.status < 400 && xhr.status >= 200 && xhr.readyState === 4) {
audioContext.decodeAudioData(xhr.response, buffer => {
this.buffer = buffer;
WeixinJSBridge.invoke("getNetworkType", {}, () => this._playSourceNode());
});
}
}
xhr.send();
}
loadAndAutoPlay(url);
loadAndAutoPlay = null;
}
const bgm = new BGMAutoPlayMgr('music/bg.mp3');
function toggleBGM() {
bgm.toggleBGM();
}
</script>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。