如何使用 Blend/WPF 在特定时间停止视频

发布于 2024-09-27 00:09:27 字数 757 浏览 0 评论 0原文

如何在 C# 中使用 Blend/WPF 在特定时间停止视频?

示例:

当我单击名为“MONDAY”的“TreeViewItem”时,视频将开始播放。但那个视频长达 10 秒,我希望它停止。 10 秒后,该视频将显示另一个名为“TUESDAY”的“TreeViewItem”的视频。那么它的编码是什么呢?

我的编码如下所示:

        if (MONDAY.IsSelected == true)
        {
            Video.Source = new Uri(@".\weekday.wmv", UriKind.Relative);
            Video.Play();
            descriptionText.Text = "Monday Blues";

           ****When video play until 10sec, it will auto stop it****
        }

        else if (TUESDAY.IsSelected == true)
        {
            TimeSpan t = TimeSpan.FromSeconds(VideoTime.Value = 10);
            Video.Position = t;
            descriptionText.Text = "Tuesday is here";
        }

有人可以帮助我吗?谢谢。

How do I stop a video at a specific time using Blend/WPF in C#?

Example:

When I clicked on a "TreeViewItem" called "MONDAY", the video will start to play. But up to 10sec of that video, I want it to stop. As after 10sec, that video will be showing video of another "TreeViewItem" called "TUESDAY". So what is the coding for it?

My coding is shown below:

        if (MONDAY.IsSelected == true)
        {
            Video.Source = new Uri(@".\weekday.wmv", UriKind.Relative);
            Video.Play();
            descriptionText.Text = "Monday Blues";

           ****When video play until 10sec, it will auto stop it****
        }

        else if (TUESDAY.IsSelected == true)
        {
            TimeSpan t = TimeSpan.FromSeconds(VideoTime.Value = 10);
            Video.Position = t;
            descriptionText.Text = "Tuesday is here";
        }

Can someone help me? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜嗑 2024-10-04 00:09:27

运行 计时器 10 秒,当计时器已调用停止

Run a timer for 10 seconds, when timer elapsed call Stop

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文