private static void AddVideoFromYouTube(Presentation pres, string videoId)
{
//add videoFrame
IVideoFrame videoFrame = pres.Slides[0].Shapes.AddVideoFrame(10, 10, 427, 240, "https://www.youtube.com/embed/" + videoId);
videoFrame.PlayMode = VideoPlayModePreset.Auto;
//load thumbnail
using (WebClient client = new WebClient())
{
string thumbnailUri = "http://img.youtube.com/vi/" + videoId + "/hqdefault.jpg";
videoFrame.PictureFormat.Picture.Image = pres.Images.AddImage(client.DownloadData(thumbnailUri));
}
}
}