Determine which video files is the most likely to play smoothly, based on the supported types and formats available.
Source
List<String> getOptimalVideoUrls(String primaryUrl) { var availableTypes = VideoLoader.supportedTypes.toList(); if (!this.webm) availableTypes.remove("webm"); if (!this.mp4) availableTypes.remove("mp4"); if (!this.ogg) availableTypes.remove("ogg"); var urls = new List<String>(); var regex = new RegExp(r"([A-Za-z0-9]+)$", multiLine:false, caseSensitive:true); var primaryMatch = regex.firstMatch(primaryUrl); if (primaryMatch == null) return urls; if (availableTypes.remove(primaryMatch.group(1))) urls.add(primaryUrl); if (this.alternativeUrls != null) { for(var alternativeUrl in this.alternativeUrls) { var alternativeMatch = regex.firstMatch(alternativeUrl); if (alternativeMatch == null) continue; if (availableTypes.contains(alternativeMatch.group(1))) urls.add(alternativeUrl); } } else { for(var availableType in availableTypes) { urls.add(primaryUrl.replaceAll(regex, availableType)); } } return urls; }