-1

サーバー側の呼び出しからサムネイルを取得する方法はありますか?

私が調査した唯一の方法は次のとおりです。

$.getJSON('http://www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', { format: "json" }, function (data) {
        $(".thumbnail").attr('src', data[0].thumbnail_medium);
    });

コードビハインドから同じ呼び出しを行う方法はありますか? またはYouTubeのような単一のURL呼び出しがありますか

img.youtube.com/vi/{0}/0.jpg
4

1 に答える 1

0
  1. リスト項目

コードビハインドからこれを行う方法を見つけました:

 public static string GetVimeoPreviewImage(string videoId)
 {
     var imageUrl = string.Empty;
     try
     {
         var doc = new XmlDocument();
         doc.Load("http://vimeo.com/api/v2/video/" + videoId + ".xml");
         var root = doc.DocumentElement;
         if (root != null)
         {
             var selectSingleNode = root.FirstChild.SelectSingleNode("thumbnail_medium");
             if (selectSingleNode != null)
             {
                 var vimeoThumb = selectSingleNode.ChildNodes[0].Value;
                 imageUrl = vimeoThumb;
                 return imageUrl;
             }
         }
     }
     catch (Exception ex)
     {
         var message = string.Format("{0} Exception: {1}", typeof(VideoHelper).FullName, ex.Message);
         Log.Error(message, typeof(VideoHelper));
     }
     return imageUrl;
 }
于 2015-08-26T17:20:13.550 に答える