[英]SoundJS doesn't plays after using usual html5 tag audio player
I tested project with latest SoundJS 0.6.1, also with soundjs-NEXT libraries, got the same results. 我使用最新的SoundJS 0.6.1和soundjs-NEXT库测试了项目,结果相同。
Everything works fine on desktop, I have this issue on Android Chrome, tested on these devices: Sony Xperia T, Asus fonepad 7. 在台式机上一切正常,在Android Chrome上存在此问题,并在以下设备上进行了测试:Sony Xperia T,Asus fonepad 7。
Actually I'm using so called Audio Sprites, here is the code 实际上我正在使用所谓的Audio Sprites,这是代码
//init
createjs.Sound.initializeDefaultPlugins();
var assetsPath = "./audio/";
var manifest = [{src:"someAudio.mp3", data: {audioSprite: [{id:"sound1"}]}}];
createjs.Sound.alternateExtensions = ["ogg"];
createjs.Sound.addEventListener("fileload", loadSound);
createjs.Sound.registerSounds(manifest, assetsPath);
function loadSound()
{
//
}
//plays without problem, until HTML5 audio tag is used
someItem.addEventListener("mousedown",playSprite,this);
function playSprite()
{
createjs.Sound.play("sound1", {startTime: 1000, duration: 3400});
}
But just after using this (audio tag already exists in the same page where canvas exists): 但是,在使用此功能之后(音频标签已经存在于画布所在的同一页面中):
<!--HTML -->
<audio width="100%" height="30%" id="audio">
<source src="" type="audio/mp3">
Your browser does not support the audio tag.
</audio>
//jQuery
$("#audio")[0].src="music.mp3";
$("#audio")[0].load();
$("#someButton").click(function(e)
{
$("#audio")[0].play();
});
I can't use 我不能用
createjs.Sound.play("sound1", {startTime: 1000, duration: 3400});
It gives no errors, just silence. 它没有错误,只是沉默。
I gave up SoundJs and finished using another Audio library 我放弃了SoundJs,并使用了另一个音频库
https://github.com/pupunzi/jquery.mb.audio https://github.com/pupunzi/jquery.mb.audio
Supports "Audio Sprites", much more flexible and usable. 支持“音频精灵”,更加灵活和可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.