mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Device.canPlayAudio now supports the opus
files directly, as well as opus
encoded audio stored in ogg containers (#1232)
This commit is contained in:
parent
88a97b935b
commit
5d84f38f6e
2 changed files with 7 additions and 2 deletions
|
@ -82,6 +82,7 @@ Version 2.1.3 - "Ravinda" - in development
|
|||
* Changed the Animation constructor parameter `delay` to `frameRate` as it's a more accurate term of what it should be. Internally nothing changed.
|
||||
* Circle.getBounds added.
|
||||
* Ellipse.getBounds added.
|
||||
* Device.canPlayAudio now supports the `opus` files directly, as well as `opus` encoded audio stored in ogg containers (#1232)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -712,7 +712,7 @@ Phaser.Device.prototype = {
|
|||
this.ogg = true;
|
||||
}
|
||||
|
||||
if (audioElement.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, '')) {
|
||||
if (audioElement.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, '') || audioElement.canPlayType('audio/opus;').replace(/^no$/, '')) {
|
||||
this.opus = true;
|
||||
}
|
||||
|
||||
|
@ -876,7 +876,7 @@ Phaser.Device.prototype = {
|
|||
/**
|
||||
* Check whether the host environment can play audio.
|
||||
* @method Phaser.Device#canPlayAudio
|
||||
* @param {string} type - One of 'mp3, 'ogg', 'm4a', 'wav', 'webm'.
|
||||
* @param {string} type - One of 'mp3, 'ogg', 'm4a', 'wav', 'webm' or 'opus'.
|
||||
* @return {boolean} True if the given file type is supported by the browser, otherwise false.
|
||||
*/
|
||||
canPlayAudio: function (type) {
|
||||
|
@ -893,6 +893,10 @@ Phaser.Device.prototype = {
|
|||
{
|
||||
return true;
|
||||
}
|
||||
else if (type == 'opus' && this.opus)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (type == 'wav' && this.wav)
|
||||
{
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue