public IActionResult GetYoutube(string id, bool autoPlay) { try { var mediaUrl = string.Format("//www.youtube-nocookie.com/embed/{0}?rel=0&modestbranding=1&wmode=transparent&autoplay={1}", id, autoPlay.ToString().ToLower()); var data = _mediaService.ApplyTemplate("youtube.html", new Dictionary <string, string>() { { "###media-placeholder###", mediaUrl } }); return(Content(data, "text/html")); } catch (Exception ex) { _logger.LogCritical(string.Format("Failed to get Youtube html content. Please, check templates are available. Input parameters are Id:\"{0}\" , Autoplay:\"{1}\".", id, autoPlay), ex); throw; // 500 Internal Server Error } }