mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-18 06:03:54 +03:00
Fixed guacamole audio & video
This commit is contained in:
parent
7a2bd7dcf5
commit
c47501e3e6
@ -97,53 +97,15 @@ GuacUI.removeClass = function(element, classname) {
|
|||||||
*/
|
*/
|
||||||
GuacUI.Audio = new (function() {
|
GuacUI.Audio = new (function() {
|
||||||
|
|
||||||
var codecs = [
|
|
||||||
'audio/ogg; codecs="vorbis"',
|
|
||||||
'audio/mp4; codecs="mp4a.40.5"',
|
|
||||||
'audio/mpeg; codecs="mp3"',
|
|
||||||
'audio/webm; codecs="vorbis"',
|
|
||||||
'audio/wav; codecs=1'
|
|
||||||
];
|
|
||||||
|
|
||||||
var probably_supported = [];
|
|
||||||
var maybe_supported = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of all supported audio mimetypes, ordered by liklihood of
|
* Array of all supported audio mimetypes, ordered by liklihood of
|
||||||
* working.
|
* working.
|
||||||
*/
|
*/
|
||||||
this.supported = [];
|
this.supported = Guacamole.AudioPlayer.getSupportedTypes();
|
||||||
|
|
||||||
// If sound disabled, we're done now.
|
// If sound disabled, declare that no types are supported
|
||||||
if (GuacamoleSessionStorage.getItem("disable-sound", false))
|
if (GuacamoleSessionStorage.getItem("disable-sound", false))
|
||||||
return;
|
this.supported = [];
|
||||||
|
|
||||||
// Build array of supported audio formats
|
|
||||||
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)
|
|
||||||
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);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add probably supported types first
|
|
||||||
Array.prototype.push.apply(
|
|
||||||
this.supported, probably_supported);
|
|
||||||
|
|
||||||
// Prioritize "maybe" supported types second
|
|
||||||
Array.prototype.push.apply(
|
|
||||||
this.supported, maybe_supported);
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@ -152,48 +114,12 @@ GuacUI.Audio = new (function() {
|
|||||||
*/
|
*/
|
||||||
GuacUI.Video = new (function() {
|
GuacUI.Video = new (function() {
|
||||||
|
|
||||||
var codecs = [
|
|
||||||
'video/ogg; codecs="theora, vorbis"',
|
|
||||||
'video/mp4; codecs="avc1.4D401E, mp4a.40.5"',
|
|
||||||
'video/webm; codecs="vp8.0, vorbis"'
|
|
||||||
];
|
|
||||||
|
|
||||||
var probably_supported = [];
|
|
||||||
var maybe_supported = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of all supported video mimetypes, ordered by liklihood of
|
* Array of all supported video mimetypes, ordered by liklihood of
|
||||||
* working.
|
* working.
|
||||||
*/
|
*/
|
||||||
this.supported = [];
|
this.supported = Guacamole.VideoPlayer.getSupportedTypes();
|
||||||
|
|
||||||
// Build array of supported audio formats
|
|
||||||
codecs.forEach(function(mimetype) {
|
|
||||||
|
|
||||||
var video = document.createElement("video");
|
|
||||||
var support_level = video.canPlayType(mimetype);
|
|
||||||
|
|
||||||
// Trim semicolon and trailer
|
|
||||||
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);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add probably supported types first
|
|
||||||
Array.prototype.push.apply(
|
|
||||||
this.supported, probably_supported);
|
|
||||||
|
|
||||||
// Prioritize "maybe" supported types second
|
|
||||||
Array.prototype.push.apply(
|
|
||||||
this.supported, maybe_supported);
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user