Permalink
Browse files

Add support (detection) for mp4 and mp4 audio

  • Loading branch information...
1 parent 4308f9b commit 859f72ab905591a0d8051452a6faedeff9a49b7e Ivo Wetzel committed Feb 5, 2013
Showing with 21 additions and 1 deletion.
  1. +21 −1 CocosDenshion/SimpleAudioEngine.js
@@ -58,14 +58,24 @@ cc.AudioEngine = cc.Class.extend(/** @lends cc.AudioEngine# */{
this._capabilities.mp3 = ("no" != au.canPlayType("audio/mpeg"))
&& ("" != au.canPlayType("audio/mpeg"));
+ this._capabilities.mp4 = ("no" != au.canPlayType("audio/mp4"))
+ && ("" != au.canPlayType("audio/mp4"));
+
+ this._capabilities.m4a = (("no" != au.canPlayType("audio/x-m4a"))
+ && ("" != au.canPlayType("audio/x-m4a")))
+ || (("no" != au.canPlayType("audio/aac"))
+ && ("" != au.canPlayType("audio/aac")));
+
this._capabilities.ogg = ("no" != au.canPlayType('audio/ogg; codecs="vorbis"'))
&& ("" != au.canPlayType('audio/ogg; codecs="vorbis"'));
this._capabilities.wav = ("no" != au.canPlayType('audio/wav; codecs="1"'))
&& ("" != au.canPlayType('audio/wav; codecs="1"'));
// enable sound if any of the audio format is supported
- this._soundEnable = this._capabilities.mp3 || this._capabilities.ogg || this._capabilities.wav;
+ this._soundEnable = this._capabilities.mp3 || this._capabilities.mp4
+ || this._capabilities.m4a || this._capabilities.ogg
+ || this._capabilities.wav;
}
},
@@ -533,6 +543,16 @@ cc.AudioEngine = cc.Class.extend(/** @lends cc.AudioEngine# */{
return;
}
+ // check for MP4
+ if (this._capabilities.mp4) {
+ this._supportedFormat.push("mp4");
+ }
+
+ // check for M4A
+ if (this._capabilities.m4a) {
+ this._supportedFormat.push("m4a");
+ }
+
// check for MP3
if (this._capabilities.mp3) {
this._supportedFormat.push("mp3");

0 comments on commit 859f72a

Please sign in to comment.