C#WPF MediaElement BufferingProgress和DownloadProgress总是1 [英] C# WPF MediaElement BufferingProgress and DownloadProgress always 1

查看:112
本文介绍了C#WPF MediaElement BufferingProgress和DownloadProgress总是1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们!



我有一个问题,我的Mediaelement属性没有按预期工作。



我的问题解释了这个场景,一小时后搜索出同样问题的人,我没有发现任何关于这个问题的信息。



这是我的代码,我希望这对你来说很简单:



我的Xaml:

Hey guys!

I have a Problem, its that my Mediaelement properties dont work as expected.

My questions explains the scenario, after an hour searching for people with the same problem, i didn't find anything about this problem.

Here's my Code, i hope it's an easy thing for you:

My Xaml:

<MediaElement  x:Name="MediaelementVideoPlayer" HorizontalAlignment="Stretch" Height="Auto" VerticalAlignment="Stretch" Width="Auto" Margin="0,31,0,42" LoadedBehavior="Manual" Stretch="Uniform" MouseMove="MouseMoveMediaElementVideoPlayer" MouseLeave="MediaelementVideoPlayer_MouseLeave" MouseEnter="MediaelementVideoPlayer_MouseEnter" MouseLeftButtonDown="MediaelementVideoPlayer_MouseLeftButtonDown" MediaFailed="MediaelementVideoPlayer_MediaFailed" MediaOpened="MediaelementVideoPlayer_MediaOpened" BufferingStarted="MediaelementVideoPlayer_BufferingStarted" BufferingEnded="MediaelementVideoPlayer_BufferingEnded"/>





我的C#:



My C#:

private void MediaelementVideoPlayer_BufferingStarted(object sender, RoutedEventArgs e)
        {

            BufferTimer.Interval = new TimeSpan(0, 0, 1);
            BufferTimer.Tick += new EventHandler(TimerBufferTick);
            BufferTimer.Start();
            
        }

        public void TimerBufferTick(object sender, EventArgs e)
        {
            LabelCrtDownloadProgress.Content = (MediaelementVideoPlayer.DownloadProgress).ToString();
        }





我正在使用.Net Framework 4.0。



非常感谢!! :)



Im using .Net Framework 4.0.

Big Thanks!! :)

推荐答案

这篇关于C#WPF MediaElement BufferingProgress和DownloadProgress总是1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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