mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 09:03:21 +00:00 
			
		
		
		
	Merge pull request #285 from glyptodon/video-error
GUAC-1375: Use Guacamole.VideoPlayer.getSupportedTypes() instead of canPlayType()
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright (C) 2014 Glyptodon LLC | ||||
|  * Copyright (C) 2015 Glyptodon LLC | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
|  * of this software and associated documentation files (the "Software"), to deal | ||||
| @@ -30,47 +30,10 @@ angular.module('client').factory('guacVideo', [function guacVideo() { | ||||
|      */ | ||||
|     return 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 | ||||
|          * working. | ||||
|          * Array of all supported video mimetypes. | ||||
|          */ | ||||
|         this.supported = []; | ||||
|  | ||||
|         // 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); | ||||
|         this.supported = Guacamole.VideoPlayer.getSupportedTypes(); | ||||
|  | ||||
|     })(); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user