mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-10-28 07:33:08 +00:00
Detect audio and prioritize supported audio mimetypes.
This commit is contained in:
@@ -490,6 +490,9 @@ GuacamoleUI.supportedAudio = [];
|
|||||||
GuacamoleUI.eventTarget.style.top = window.pageYOffset + "px";
|
GuacamoleUI.eventTarget.style.top = window.pageYOffset + "px";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var probably_supported = [];
|
||||||
|
var maybe_supported = [];
|
||||||
|
|
||||||
// Build array of supported audio formats
|
// Build array of supported audio formats
|
||||||
[
|
[
|
||||||
'audio/ogg; codecs="vorbis"',
|
'audio/ogg; codecs="vorbis"',
|
||||||
@@ -500,11 +503,22 @@ GuacamoleUI.supportedAudio = [];
|
|||||||
var audio = new Audio();
|
var audio = new Audio();
|
||||||
var support_level = audio.canPlayType(mimetype);
|
var support_level = audio.canPlayType(mimetype);
|
||||||
|
|
||||||
if (support_level != "")
|
// Trim semicolon and trailer
|
||||||
GuacamoleUI.supportedAudio.push(mimetype);
|
var semicolon = mimetype.indexOf(";");
|
||||||
|
if (semicolon != -1)
|
||||||
|
mimetype = mimetype.substring(0, semicolon);
|
||||||
|
|
||||||
|
// Partition by probably/maybe
|
||||||
|
if (support_level == "probably")
|
||||||
|
probably_supported.push(mimetype);
|
||||||
|
else if (support_level == "maybe")
|
||||||
|
maybe_supported.push(mimetype);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Array.prototype.push.apply(GuacamoleUI.supportedAudio, probably_supported);
|
||||||
|
Array.prototype.push.apply(GuacamoleUI.supportedAudio, maybe_supported);
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Tie UI events / behavior to a specific Guacamole client
|
// Tie UI events / behavior to a specific Guacamole client
|
||||||
|
|||||||
Reference in New Issue
Block a user