Permalink
Browse files

hopefully fixed it now

  • Loading branch information...
1 parent 4ef08d9 commit a0836b962e5be600d36508f27125359bcf164678 @BlackScorp committed Mar 5, 2012
Showing with 4 additions and 3 deletions.
  1. +2 −2 assets/js/audio.js
  2. +2 −1 assets/js/loader.js
View
@@ -19,7 +19,7 @@ Crafty.extend({
var audio,source,ext,url,canplay;
if(arguments.length === 1 && typeof id === "object"){
for(var i in id){
- audio = document.createElement('audio');
+ audio = new Audio("");
audio.id = i;
audio.autobuffer = true;
audio.preload = "auto";
@@ -30,7 +30,7 @@ Crafty.extend({
url = id[i][src];
ext = url.substr(url.lastIndexOf('.') + 1).toLowerCase();
canplay = audio.canPlayType(this.type[ext]);
- if(canplay === "probably"){
+ if(canplay !== "" && canplay !== "no"){
source = document.createElement('source');
source.src = url;
source.type=this.srcType[ext];
View
@@ -65,7 +65,8 @@ Crafty.extend({
if (Crafty.support.audio && (ext === "mp3" || ext === "wav" || ext === "ogg" || ext === "mp4")) {
- event = 'loadedmetadata';
+ event = 'loadedmetadata';
+ if (navigator.userAgent.indexOf('Chrome') != -1 && ext !== "mp3") j++;
} else if (ext === "jpg" || ext === "jpeg" || ext === "gif" || ext === "png") {
event = 'load';
} else {

0 comments on commit a0836b9

Please sign in to comment.