使用C#查找.avi文件 [英] Seeking in .avi file using C#

查看:298
本文介绍了使用C#查找.avi文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我是C#的新手,所以请多多包涵.

First of all, I'm new to C#, so bear with me.

我正在制作一个应用程序,该应用程序在Windows Media Player中显示如下所示的.avi文件:

I am making an application, that shows an .avi file in windows media player like this:

private void button1_Click(object sender, EventArgs e)
    {
        axWindowsMediaPlayer1.URL = @"C:BlaBla\Family Guy\Season 10\S10E16.HDTV.x264-LOL.avi";
    }

我发现您无法在.avi文件中进行快进或快退,因为它没有索引.但是,使用axWindowsMediaPlayer1的WMP滑块,您可以将文件设置为在特定点播放.例如,开始播放电影,然后将滑块拖至05:00以跳过前5分钟.

I've found out that you cant fastforward or fastrewind in an .avi file, because it's not indexed. But using the WMP-slider of axWindowsMediaPlayer1, you can set the file to play at a specific point. For instance, start the movie, and then drag the slider to 05:00 to skip the first 5 minutes.

我想以编程方式执行此操作,但是我不知道如何执行此操作?

I want to do this programaticly, but i have no clue as to how?

推荐答案

免责声明:我以前从未使用过.

Disclaimer: I've never used this before.

但是,它从

However, it looks from the documentation that you can set the position in the video like this:

axWindowsMediaPlayer1.Ctlcontrols.currentPosition = 300d;

(此处的值是您要导航到视频开头的秒数-我已根据要求将其设置为5分钟).

(Where the value is how many seconds from the beginning of the video you want to navigate to - I've set it to 5 minutes in as requested).

编辑:从下面的评论开始-快进,有一种方法可以帮助您.您可以检查是否可以先执行此操作,文档

From the comments below - to fast forward, there is a method to do that for you. You can check if you can do it first, there's an example in the documentation here that I've modified for you:

if (axWindowsMediaPlayer1.Ctlcontrols.get_isAvailable("fastForward"))
{
   axWindowsMediaPlayer1.Ctlcontrols.fastForward();
}

这会检查它是否可以快进,然后以5倍的正常速度播放,直到您告诉它做其他事情,或者它碰到我猜视频的结尾!

This checks to see if it can fast forward, then plays at 5x normal speed until you tell it to do something else, or it hits the end of the video I guess!

这篇关于使用C#查找.avi文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆