Copied to clipboard

Flag this post as spam?

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


  • rayman 6 posts 76 karma points
    Jun 23, 2017 @ 16:47
    rayman
    0

    Display multiple videos on a page

    Hi, Newbie here.

    trying to understand how to display multiple videos on a page. Im using oembed player to show video, im successful at show just one video on the page using @Umbraco.Field("pickAVideo")

    how shall i modify the code in template to show multiple videos preferably 3 videos in a row and so on.

    Update:

    Here is code i tried: `@foreach (var item in CurrentPage.Children) {

    <iframe width="320" height="240" src="@Umbraco.Field("youtubeVideo")" type="text/html" frameborder="0" ></iframe>
    

    }
    `

    Thanks.

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jun 23, 2017 @ 22:00
    Alex Skrypnyk
    0

    Hi Rayman

    Try this code:

    @foreach (var item in Model.Content.GetPropertyValue<List<MvcHtmlString>>("pickAVideo")) {
    
        <li>
            <a href="">@item</a>
        </li>
    } 
    

    Documentation - https://bitbucket.org/dawoe/embed-property-editor

    Alex

  • rayman 6 posts 76 karma points
    Jun 23, 2017 @ 22:14
    rayman
    0

    Hey Alex,

    Try that code, getting

    Object reference not set to an instance of an object.

    error

    Youtube videos has to within an iframe tag. No ?

    Thanks.

  • Rouben Muradyan 23 posts 173 karma points
    Jun 24, 2017 @ 10:14
    Rouben Muradyan
    0

    Hi Rayman.

    In your DocumentType you have "youtubeVideo", right? Which is i guess just textfield. Try to change it's type to "Repeatable textstring" (and maybe change alias to "youtubeVideos"). This control will allow you to provide youtube links as list and then access them like in this code snippet.

    @foreach (var videoUrl in Model.Content.GetPropertyValue<string[]>("youtubeVideos")){
    
    
    
    <iframe width="320" height="240" src="@videoUrl " type="text/html" frameborder="0" ></iframe>
    
    
    }
    

    enter image description here

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 24, 2017 @ 10:58
    Dave Woestenborghs
    0

    Hi Rayman,

    What property editor are you using for displaying your video's.

    You can always use this one I created a couple of years ago : https://our.umbraco.org/projects/backoffice-extensions/oembed-picker-property-editor

    It uses the same embed technology as the embed option in the rich text editor and grid. So you can embed youtube, vimeo, ....

    As Alex already posted you can find the docs for rendering multiple video's here : https://bitbucket.org/dawoe/embed-property-editor

    Dave

  • rayman 6 posts 76 karma points
    Jun 26, 2017 @ 16:01
    rayman
    0

    Hi Dan,

    Sorry about delayed response. I was away for Eid celebrations.

    Yes, i am using oembed property picker.

    I have 2 pages, AllVideos (with list view) and Video where the individual video is shown. There are no issues with displaying individual video.

    Issue is only with AllVideos page where list of all videos are to be shown.

    @foreach (var videoUrl in Model.Content.GetPropertyValue<string[]>("pickAVideo")){
    

    }

    is returning null reference again. used above code in Videos template. Template code for AllVideos

    Thanks.

  • rayman 6 posts 76 karma points
    Jun 26, 2017 @ 16:07
    rayman
    0

    Template code for single Video page which works just fine Single Video template code

    Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft