3
在这里,我正在我的网站实施视频网站地图,我正试图在sitecore中获得视频的详细信息。我可以阅读标题,描述等细节。可是如何才能让下面的细节,如时间,球员位置和XML如何从sitecore媒体项目检索视频详细信息?
<video:video>
<video:thumbnail_loc>http://www.example.com/thumbs/123.jpg</video:thumbnail_loc>
<video:title>Grilling steaks for summer</video:title>
<video:description>Alkis shows you how to get perfectly done steaks every
time</video:description>
<video:content_loc>http://www.example.com/video123.flv</video:content_loc>
<video:player_loc allow_embed="yes" autoplay="ap=1">
http://www.example.com/videoplayer.swf?video=123</video:player_loc>
<video:duration>600</video:duration>
<video:expiration_date>2009-11-05T19:20:30+08:00</video:expiration_date>
<video:rating>4.2</video:rating>
<video:view_count>12345</video:view_count>
<video:publication_date>2007-11-05T19:20:30+08:00</video:publication_date>
<video:family_friendly>yes</video:family_friendly>
<video:restriction relationship="allow">IE GB US CA</video:restriction>
<video:gallery_loc title="Cooking Videos">http://cooking.example.com</video:gallery_loc>
<video:price currency="EUR">1.99</video:price>
<video:requires_subscription>yes</video:requires_subscription>
<video:uploader info="http://www.example.com/users/grillymcgrillerson">GrillyMcGrillerson
</video:uploader>
<video:live>no</video:live>
</video:video>
这里下文提到的其他细节是我的代码:
HtmlAgilityPack.HtmlDocument document = htmlWeb.Load("http://www.example.com/us/cars/new-models/xc60");
var urls = document.DocumentNode.Descendants("source")
.Select(x => x.Attributes[1].Value).ToList();
DynamicLink dynamicLink;
_videoval = new Videodetails();
foreach (var singleurl in urls)
{
if (!DynamicLink.TryParse(singleurl, out dynamicLink))
return;
MediaItem mediaItem = Sitecore.Context.Database.GetItem(dynamicLink.ItemId, dynamicLink.Language ?? Sitecore.Context.Language);
var videodetail = new Videodetails() { Title = mediaItem.Title,Description = mediaItem.Description };
videolist.Add(videodetail);
}
缩略图位置如何? – Rooney
嗨鲁尼,我不认为缩略图位置是所有视频格式的元数据的标准部分。你最好的选择是使用某种图书馆从视频中提取一帧 - 尝试看看http://www.nrecosite.com/video_converter_net.aspx –
[答案只包含其他地方的链接,真的是“好答案” ?](http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers) – Liam