Copied to clipboard

Flag this post as spam?

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


  • Kieron 152 posts 390 karma points
    Oct 04, 2018 @ 11:26
    Kieron
    0

    Access information such as ID, title

    Hi, I hoped to use this plugin to print a list of videos, before the user goes into a video to view it, but ideally, I need the youtube ID, so I can generate an image, and the name, to display.

    It's a different plugin but here's how I did it before so you can see the usage;

    foreach (var typedVideo in item.GetPropertyValue<YouTube>("youtubeVideo")){
                var itemID = @typedVideo.Id;
                var previewUrl = "https://img.youtube.com/vi/" + @itemID + "/maxresdefault.jpg";
                <div class="col-sm-6">
                  <article class="videoitem feature" style="height: 361px;">
                      <a href="@item.Url">
                          <img src="@previewUrl" class="img-responsive">
                      </a>
                        <div class="inner">
                            <h2><a href="@item.Url">@typedVideo.Snippet.Title</a></h2>
                            <ul class="author">
                                <li>Uploaded <span data-momentify="@(item.GetPropertyValue<DateTime>("publishedDate").ToString("yyyyMMddTHHmm"))"></span></li>
                            </ul>
                        </div>
                    </article>
                </div>
                }
    

    Are these variables available with this plugin? I cant use the prior, because it only supports one channel for youtube searching.

  • David Sheiles 69 posts 339 karma points
    Nov 26, 2018 @ 12:54
    David Sheiles
    1

    Hi Kieron,

    I'm so sorry for the late reply. I had missed the notification to your post and have only just seen it.

    You can currently get the Youtube ID from .Id on the video object. Unfortunately, I don't yet store any of the meta information with the video, but its on my list.

    So you can do something like (But cant get the Name or Publish date at this time):

    @{ 
    var typedVideo = Model.Content.GetPropertyValue<Videolizer.VideolizerVideo>("youtubeVideo");
    var itemID = typedVideo.Id;
    var previewUrl = "https://img.youtube.com/vi/" + @itemID + "/maxresdefault.jpg";
    
    <article class="videoitem feature" style="height: 361px;">
        <a href="@typedVideo.Url" >
            <img src="@previewUrl" class="img-responsive">
        </a>
    </article>
    

    }

    I'll be looking at adding this in the next release as it would be a useful addition.

Please Sign in or register to post replies

Write your reply to:

Draft