图片音乐合并,一图多用
实际意义不大,纯娱乐.
<html>
<head></head>
<body>
<p>右击另存为最小的图片(a.gif, 也可以换成其他图片):</p>
<img src="https://img2020.cnblogs.com/blog/421045/202107/421045-20210712153938806-1136292793.gif" style="height:100px;width:100px" alt="最小的图片">
<p>准备mp3文件,如x.mp3</p>
<p>cmd运行命令,如下,合并文件,
<p>copy /b a.gif+x.mp3 ax.gif </p>
<hr/>
<p>如下是一个已生成的样例,能显示图片,也能播放音乐</p>
<p>1.显示图片</p>
<img src="https://gw.alicdn.com/imgextra/i4/O1CN011m09Hh1yHmVR2aa9G_!!6000000006554-1-tps-1-1.gif"/>
<p>2.播放音乐</p>
<audio id="music_audio" controls="controls"></audio>
<button onclick="startPlay()">播放</button>
<script type="text/javascript">
var startPlay=function(){
var oReq = new XMLHttpRequest();
oReq.open("GET", "https://gw.alicdn.com/imgextra/i4/O1CN011m09Hh1yHmVR2aa9G_!!6000000006554-1-tps-1-1.gif", true);
oReq.responseType = "arraybuffer";
oReq.onload = function(oEvent) {
window.aaa = oReq.response.slice(35);// 图片大小是35字节
var blob = new Blob([aaa], {type: "audio/mpeg"});
document.getElementById('music_audio').src = window.URL.createObjectURL(blob);
document.getElementById('music_audio').play();
};
oReq.send();
}
</script>
<p>3.直接做为音乐资源,播放音乐(非ios可用)</p>
<audio src="https://gw.alicdn.com/imgextra/i4/O1CN011m09Hh1yHmVR2aa9G_!!6000000006554-1-tps-1-1.gif" controls="controls"></audio>
</body>
</html>