Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mark Watson 118 posts 384 karma points
    Jul 29, 2019 @ 03:13
    Mark Watson
    0

    video/image not displaying using partial

    This should be working but returns nothing. Tried several ways I know but no luck. The code below is in a partial.

    @{ var selection = Umbraco.Content(Guid.Parse("a51c3e15-e8e5-4985-91c2-84159b3fa2bf")) .Children() .Where(x => x.IsVisible()); }

    @foreach (var item in selection)
    {
         var typedMediaPickerSingle = Model.Value<IPublishedContent>("videotwo");
              if (typedMediaPickerSingle != null)
              {
                    <video autoplay controls width="320" height="240">
                     <source src="@typedMediaPickerSingle.Url" type="video/mp4" />
                     </video> 
            }
    
            }
    

    Also tried this to display an image but that did not work either. Can anyone help to put me on the right track?

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Jul 29, 2019 @ 07:03
    Søren Gregersen
    0

    hi,

    is it the selection that is empty, or the video that is not picked or not an IPublishedContent?

  • Bo Jacobsen 608 posts 2406 karma points
    Jul 29, 2019 @ 08:18
    Bo Jacobsen
    101

    Hi Mark.

    It might be a typo, but Model should maybe be item?

    var typedMediaPickerSingle = item.Value<IPublishedContent>("videotwo");
    
  • Mark Watson 118 posts 384 karma points
    Jul 30, 2019 @ 01:09
    Mark Watson
    0

    Thanks Bo. Worked perfectly.

Please Sign in or register to post replies

Write your reply to:

Draft