mediaelement

Binding MediaElement to slider position

自古美人都是妖i 提交于 2019-12-12 13:54:52
问题 I have MediaElement and Slider. How I can bind MediaElement.Position to Slider.Value without DispatcherTimer? 回答1: OK SO this COULD be that : <Slider x:Name="PositionSlider" Minimum="0" Maximum="{Binding ElementName=mediaElement, Path=mediaElement.NaturalDuration.TimeSpan.TotalMilliseconds}" /> <MediaElement x:Name="mediaElement" Position="{Binding Value, ElementName=PositionSlider, Converter={StaticResource MyMsToTimeSpanConverter}}" /> !! BUT !! Position is not a dependency property, so you

UWP custom media controls not working

倖福魔咒の 提交于 2019-12-12 03:22:03
问题 below is the XAML code for my UWP app media element , but its not giving the customized media controls, why is that? <MediaElement x:Name="Media" Grid.Row="1" AutoPlay="True" AreTransportControlsEnabled="True" > <MediaElement.TransportControls> <MediaTransportControls Background="#FFF5F509" Foreground="#FF0625EA"/> </MediaElement.TransportControls> </MediaElement> 回答1: Although MediaTransportControls has Background and Foreground properties, but setting these properties won't affect the

How to fade in/out between songs with a WPF C# mediaelement

偶尔善良 提交于 2019-12-11 21:12:14
问题 I am writing a media player and I'm using WPF in C#. 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. 回答1: You could put a trigger on MediaElement.Position that starts a DoubleAnimation on MediaElement.Volume when

WP7 - playing mediaelement after page is loaded

我与影子孤独终老i 提交于 2019-12-11 18:55:57
问题 I have this MediaElement in my xaml page: <MediaElement x:Name="soundMenu" Source="Sounds/menu.wav" AutoPlay="False" MediaEnded="soundMenu_MediaEnded"/> and I want it to play when page is loaded (like background music): void MainPage_Loaded(object sender, RoutedEventArgs e) { soundMenu.Play() } It doesn't work. When I click on some button and try to play music it's working but this isn't. What's wrong with this? How can I play sound after page is loaded? P.s.: I know I must check if user is

How to create a background music?

眉间皱痕 提交于 2019-12-11 14:09:19
问题 I need to run a background music in WP7 Silverlight application. I need it to keep playing when navigating between pages. Also I don't want it to stop when another sound effect is played. 回答1: You can use a MediaElement to do that or use XNA SoundEffects but I have a better solution. Create a SilverXNA project for your app. You don't really need to use XNA but this project automatically creates some stuff which makes life easier. You can use this to build a Silverlight App with no problems.

How do I play sound when app begins windows phone

你。 提交于 2019-12-11 11:09:51
问题 On my windows phone app, I want to play a short .wav audio, similar to windows when it boots up. At first I tried using an event handler when one of my controls was loaded (this worked about 60% of the time, which is very interesting, maybe someone can clear that up as well, I'm thinking it has to do with the order things happen to load. That's why its different each time running it). I'm using visual studios 2012 ultimate, this is my xaml code for the .wav file: <MediaElement x:Name="MySound

WPF MediaElement video playback tearing

China☆狼群 提交于 2019-12-11 06:05:46
问题 I'm trying to use the MediaElement control in WPF to play back video. It works great in Vista, but when I run it on an XP machine I get tearing in the display. It looks as if it's not using the vertical synch, and just updating the screen mid-draw. Anyone know how to fix this problem? 回答1: This has more to do with the way WPF renders to the screen under XP compared to Vista. Under Vista, apps render to an offscreen buffer which is then composited with other windows that have changed and is

Combining MediaTimeline with animation in Storyboard programmatically

眉间皱痕 提交于 2019-12-11 05:13:47
问题 I am trying to use MediaTimeline and DoubleAnimation inside Storyboard to play audio with animation. Everything is implemented in C# without XAML. Nothing happens after Storyboard.Begin is called in the code below and no exception is thrown. mediaElement's HasAudio property is false and MediaOpened event of MediaElement is never called. It seems mediaElement can't load the audio file. I don't know whether MediaElement or MediaTimeline is responsible for loading the audio. DoubleAnimation

how do compare a exactly position of MediaElement while playing

你说的曾经没有我的故事 提交于 2019-12-11 03:11:41
问题 i have a single video (duration: 3 seconds) and i need to create 2 states 1- the video should always reach the second 1.5 and play it from the start. TimeSpan ts = new TimeSpan(0, 0, 0, 1, 500); TimeSpan ts_Start = new TimeSpan(0, 0, 0, 0, 0); if (mediaElement.position == ts) mediaElement.position = ts_Start; //doesnt work this block code 2- when i press a button, the video should play the full video (3 seconds). (simple flag, boolean) so my question is, how do i know when the mediaelement

How to create Source for WPF Media Element from byte array using c#?

∥☆過路亽.° 提交于 2019-12-11 02:36:44
问题 I have converted a video to bytes array and stored it in MsSql Database. Now I fetch it from database and I get the byte array. I want to set this byte array as Source of media element and then show this video in WPF application. Please suggest a way where I can convert byte array or memory stream to Media Elements Source? I will not have permission to write on users machine, so writing a file onto user machine and then setting the source will not work for me. 回答1: That's not directly