如何使用WPF C#中介元素在歌曲之间淡入/淡出 [英] How to fade in/out between songs with a WPF C# mediaelement

查看:96
本文介绍了如何使用WPF C#中介元素在歌曲之间淡入/淡出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写媒体播放器,并且正在C#中使用WPF.

I am writing a media player and I'm using WPF in C#.

我的问题是我不知道如何创建淡入/淡出功能(使用媒体元素),这意味着正在播放的歌曲的最后7秒将开始淡出,而同时下首歌曲的前7秒将开始播放.

My problem is that I have no idea of how to create a fade in/ fade out function (using the media element), meaning that the last 7 seconds of the playing song will start to fade out and at the same time the first 7 seconds of the next song will start to play.

有人这样做吗?如果是这样,那么有人可以帮我吗? 谢谢.

Has anyone done this? If so, then can someone please help me? Thank you.

推荐答案

您可以在 MediaElement.Volume (在结束后七秒内)(

You could put a trigger on MediaElement.Position that starts a DoubleAnimation on MediaElement.Volume when within seven seconds of the end (MediaElement.NaturalDuration)

这篇关于如何使用WPF C#中介元素在歌曲之间淡入/淡出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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