コード例 #1
0
        /// <summary>
        /// Gets the URL for a thumbnail with the specified size.
        /// </summary>
        /// <param name="vimeoId">The ID of the video.</param>
        /// <param name="size">The size of the desired thumbnail.</param>
        public static string GetVimeoThumbnail(this string vimeoId, VimeoThumbnail size)
        {
            VimeoVideo video = VimeoHelpers.GetCachedVideoById(vimeoId);

            if (video == null)
            {
                return(null);
            }
            switch (size)
            {
            case VimeoThumbnail.Small:
                return(video.ThumbnailSmall);

            case VimeoThumbnail.Medium:
                return(video.ThumbnailMedium);

            default:
                return(video.ThumbnailLarge);
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the duration of the Vimeo video with the specified ID.
        /// </summary>
        /// <param name="vimeoId">The ID of the video.</param>
        /// <returns>Returns the duration in seconds if the video is found, otherwise <var>-1</var> will be returned.</returns>
        public static int GetVimeoDuration(this string vimeoId)
        {
            VimeoVideo video = VimeoHelpers.GetCachedVideoById(vimeoId);

            return(video == null ? -1 : (int)video.Duration.TotalSeconds);
        }