mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-1044: Fix audio error when using IE over RDP - it's blocking testing (regression of GUAC-882).
This commit is contained in:
@@ -30,6 +30,11 @@ angular.module('client').factory('guacAudio', [function guacAudio() {
|
||||
*/
|
||||
return new (function() {
|
||||
|
||||
/**
|
||||
* Array of codecs to test.
|
||||
*
|
||||
* @type String[]
|
||||
*/
|
||||
var codecs = [
|
||||
'audio/ogg; codecs="vorbis"',
|
||||
'audio/mp4; codecs="mp4a.40.5"',
|
||||
@@ -38,30 +43,58 @@ angular.module('client').factory('guacAudio', [function guacAudio() {
|
||||
'audio/wav; codecs=1'
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of all codecs that are reported as "probably" supported.
|
||||
*
|
||||
* @type String[]
|
||||
*/
|
||||
var probably_supported = [];
|
||||
|
||||
/**
|
||||
* Array of all codecs that are reported as "maybe" supported.
|
||||
*
|
||||
* @type String[]
|
||||
*/
|
||||
var maybe_supported = [];
|
||||
|
||||
/**
|
||||
* Internal audio element for the sake of testing codec support. If
|
||||
* audio is explicitly not supported by the browser, this will instead
|
||||
* be null.
|
||||
*
|
||||
* @type Audio
|
||||
*/
|
||||
var audio = null;
|
||||
|
||||
// Attempt to create audio element
|
||||
try {
|
||||
audio = new Audio();
|
||||
}
|
||||
catch (e) {
|
||||
// If creation fails, allow audio to remain null
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of all supported audio mimetypes, ordered by liklihood of
|
||||
* working.
|
||||
*/
|
||||
this.supported = [];
|
||||
|
||||
// Build array of supported audio formats
|
||||
// Build array of supported audio formats (if audio supported at all)
|
||||
if (audio) {
|
||||
codecs.forEach(function(mimetype) {
|
||||
|
||||
var audio = new Audio();
|
||||
var support_level = audio.canPlayType(mimetype);
|
||||
|
||||
// Trim semicolon and trailer
|
||||
var semicolon = mimetype.indexOf(";");
|
||||
if (semicolon != -1)
|
||||
if (semicolon !== -1)
|
||||
mimetype = mimetype.substring(0, semicolon);
|
||||
|
||||
// Partition by probably/maybe
|
||||
if (support_level == "probably")
|
||||
if (support_level === "probably")
|
||||
probably_supported.push(mimetype);
|
||||
else if (support_level == "maybe")
|
||||
else if (support_level === "maybe")
|
||||
maybe_supported.push(mimetype);
|
||||
|
||||
});
|
||||
@@ -73,6 +106,7 @@ angular.module('client').factory('guacAudio', [function guacAudio() {
|
||||
// Prioritize "maybe" supported types second
|
||||
Array.prototype.push.apply(
|
||||
this.supported, maybe_supported);
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
|
Reference in New Issue
Block a user