Error executing template "Designs/dechra-dvp/Paragraph/Video.cshtml" System.ArgumentNullException: Value cannot be null. Parameter name: input at System.Text.RegularExpressions.Regex.Match(String input) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at CompiledRazorTemplates.Dynamic.RazorEngine_b621a03251f34ed3b6908f6770e78e49.Execute() in D:\Dynamicweb.NET\Solutions\eu.dvp.dechra.espresso4.dk\Files\Templates\Designs\dechra-dvp\Paragraph\Video.cshtml:line 17 at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader) at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Co3.Espresso.Website.TemplateBases.Paragraphs.Video 2 @using System.Text; 3 @using System.Text.RegularExpressions; 4 @{ 5 var Url = Espresso.Item.Video; 6 var UrlRegex = new Regex( @"^.*((youtu.be\/|vimeo.com\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*" ); 7 8 var VimeoControlsColor = Espresso.Item.VideoVimeoControlsColor ?? string.Empty; 9 var VimeoShowTitle = Espresso.Item.VideoVimeoTitle; 10 var VimeoShowByLine = Espresso.Item.VideoVimeoByline; 11 12 13 var YoutubeShowControls = Espresso.Item.VideoYoutubeControls; 14 var YoutubeShowTitle = Espresso.Item.VideoYoutubeTitle; 15 var YoutubeShowLogo = Espresso.Item.VideoYoutubeLogo; 16 17 Match videoUrlMatch = UrlRegex.Match( Url ); 18 var EmbedUrl = String.Empty; 19 20 if(Espresso.Item.VideoProvider == "vimeo"){ 21 if( videoUrlMatch.Success && videoUrlMatch.Groups.Count >= 8 ) { 22 if( videoUrlMatch.Groups[ 1 ].Value == "vimeo.com/" ) { 23 EmbedUrl = string.Format( "//player.vimeo.com/video/{0}?title={1}&byline={2}&portrait=0&color={3}", videoUrlMatch.Groups[ 7 ].Value, VimeoShowTitle == "True" ? "1" : "0", VimeoShowByLine == "True" ? "1" : "0", VimeoControlsColor ); 24 } 25 } 26 } else if(Espresso.Item.VideoProvider == "youtube"){ 27 if( videoUrlMatch.Success && videoUrlMatch.Groups.Count >= 8 ) { 28 EmbedUrl = string.Format( "https://www.youtube.com/embed/{0}?controls={1}&showinfo={2}&modestbranding={3}", videoUrlMatch.Groups[ 7 ].Value, YoutubeShowControls == "True" ? "1" : "0", YoutubeShowTitle == "True" ? "1" : "0", YoutubeShowLogo == "True" ? "0" : "1"); 29 } 30 } 31 var index = 0; 32 } 33 <div class="@Espresso.Container.ClassList" id="@Espresso.Id"> 34 <div class="@Espresso.Wrapper.ClassList"> 35 @if( string.IsNullOrEmpty( Espresso.Text.Raw ) == false ){ 36 <div class="@Espresso.Text.Container.ClassList"> 37 @Espresso.Text.Raw 38 </div> 39 } 40 <div class="@Espresso.Video.Container.ClassList"> 41 <div class="embed-responsive embed-responsive-16by9"> 42 <iframe class="embed-responsive-item" src="@EmbedUrl" width="1080" height="608" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 43 </div> 44 </div> 45 </div> 46 </div> 47 48 49 50