Video
Contents
[
Hide
]
Bài viết này trình bày cách chèn khung video và thiết lập các tùy chọn phát lại bằng Aspose.Slides for .NET.
Thêm khung video
Chèn một khung video trống vào một slide.
static void AddVideo()
{
using var presentation = new Presentation();
var slide = presentation.Slides[0];
// Thêm video.
var videoFrame = slide.Shapes.AddVideoFrame(50, 50, 320, 240, "video.mp4");
}
Truy cập khung video
Lấy khung video đầu tiên được thêm vào slide.
static void AccessVideo()
{
using var presentation = new Presentation();
var slide = presentation.Slides[0];
var videoFrame = slide.Shapes.AddVideoFrame(50, 50, 320, 240, "video.mp4");
// Truy cập khung video đầu tiên trên slide.
var firstVideo = slide.Shapes.OfType<IVideoFrame>().First();
}
Xóa khung video
Xóa khung video khỏi slide.
static void RemoveVideo()
{
using var presentation = new Presentation();
var slide = presentation.Slides[0];
var videoFrame = slide.Shapes.AddVideoFrame(50, 50, 320, 240, "video.mp4");
// Xóa khung video.
slide.Shapes.Remove(videoFrame);
}
Cài đặt phát video
Cấu hình video để tự động phát khi slide được hiển thị.
static void SetVideoPlayback()
{
using var presentation = new Presentation();
var slide = presentation.Slides[0];
var videoFrame = slide.Shapes.AddVideoFrame(50, 50, 320, 240, "video.mp4");
// Cấu hình video để tự động phát.
videoFrame.PlayMode = VideoPlayModePreset.Auto;
}