mediaelement

MediaElement fails after several plays

你离开我真会死。 提交于 2019-12-06 10:14:43
I have a problem with MediaElement control. I've put six MediaElements on my form, then I start them and change played files by timer. After several times, these elements stop playing. Here is the sample XAML: <Grid> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <MediaElement x:Name="element1" UnloadedBehavior="Close" LoadedBehavior="Manual" Grid.Column="0" Grid.Row="0" /> <MediaElement x:Name=

Playing a sound in Silverlight with MediaElement and Caliburn Micro

谁说胖子不能爱 提交于 2019-12-06 08:12:51
问题 How can I play an MP3 in Silverlight using Caliburn Micro? The MediaElement's "play()" method needs to be executed based on a boolean variable in the ViewModel. Thanks in advance! 回答1: Use an IResult. sample code Edit: based on a Boolean value, if you describe the scenario of this I can alter the sample. View: <Grid> <MediaElement AutoPlay="False" Source="../Assests/Kalimba.mp3"></MediaElement> <Button x:Name="Play" Content="Play" Height="50" Width="150" /> </Grid> ViewModel: public class

WPF, how to determine when a MediaElement has finished playing the movie?

冷暖自知 提交于 2019-12-05 18:49:55
问题 I am showing a movie on my application, and i want the application to only play it once. And when its done playing i want to enable some buttons (play, rewind, watch again etc...) but is there any way i can get an event when the movie has finished - or anything that would accomplish this scenario? Cheers, 回答1: The MediaElement.MediaEnded event should help you 来源: https://stackoverflow.com/questions/1738967/wpf-how-to-determine-when-a-mediaelement-has-finished-playing-the-movie

remove createMediaElementSource

情到浓时终转凉″ 提交于 2019-12-05 17:58:26
I've google all over for this issue, but couldn't find anything. I am in a situation where I need to remove a source = createMediaElementSource so that I can create it again. I am using an audio analyzer which has to load each time you load a specified track using ajax. As soon as you go to another page, and then back, the analyzer is gone. Therefore I need to re-initialize it somehow. My code: var analyserElement = document.getElementById('analyzer'); var canvas, ctx, source, context, analyser, fbc_array, bars, bar_x, bar_width, bar_height; function analyzerSetElements() { var analyserElement

MediaElement.NaturalDuration throws exception when querying TimeSpan.TotalSeconds

橙三吉。 提交于 2019-12-05 15:01:17
I have a winforms form in which I use a MediaElement. Everything is working (more or less) perfectly. The only thing is, after loading a media file (mp3) accessing NaturalDuration.TimeSpan.TotalSeconds throws an exception InvalidOperatoinException: A TimeSpan property can not be returned for a duration value of automatic. (Translated from german by myself) How can I access the timespan property? There is no special setting used in all the examples I have found (ok, they seem to be WPF native...) I am using VisualStudio Express .Net 4, C# on Windows 7. Any hints? You need to wait for

Why does MediaElement sometimes silently fail and how can I correct it?

牧云@^-^@ 提交于 2019-12-05 09:22:17
In my WPF project I have created a view that includes several MediaElements playing videos. Sometimes, anywhere between one or all of the MediaElements will fail to play the video assigned to them, and will instead show a black rectangle, or not appear at all. The MediaFailed event does not occur when this happens. The MediaOpened event DOES get raised on all the MediaElements, even when they do not play the video. I have installed the latest drivers for my graphics card and that has had no effect on this issue. Is there a procedure I can use to ensure that every MediaElement consistently

WPF media formats

不想你离开。 提交于 2019-12-05 07:43:47
Does WPF have built-in support for any audio and video formats? I'm going to be using the MediaPlayer and MediaElement classes to build a little media player, and for now, I don't want to have to deal with codecs and formats that .NET doesn't have native support for. WPF supports the video formats WMV, MPEG and some AVI files by default, but since it has Windows Media Player running beneath, WPF can use all the codecs installed for it 来源: https://stackoverflow.com/questions/6158650/wpf-media-formats

Google Chrome does not want to play mp4 using mediaelement.js

可紊 提交于 2019-12-05 04:09:00
I'm using the latest mediaelement.js on my website to play html5 video. There is something strange in Google Chrome. He plays one video, but doesn't want to play the other video in mp4 format and doesn't fallback to webm. Both videos were converted with ffmpeg with this params: ffmpeg -i input.mov -acodec libfaac -ab 96k -vcodec libx264 -vpre slower -vpre main -level 21 -refs 2 -b 345k -bt 345k -threads 0 -s 640x360 output.mp4 Besides, the first video plays normally without using mediaelement.js library in mp4 format and the second one turns into webm format. Sample pages from http://random

Binding MediaElement to slider position in WPF

半世苍凉 提交于 2019-12-05 02:38:50
问题 Tried binding Maximum value of slider to media element's duration and binding slider's current value to the position of media element, but but for some reasons it doesn't. I want the slider to move it's thumb while the video is playing. <Slider x:Name="videoSlider" Value="{Binding ElementName=mp3MediaElement, Path=Position}" ValueChanged="videoSlider_ValueChanged" IsMoveToPointEnabled="True" Maximum="{Binding ElementName=mp3MediaElement, Path=NaturalDuration}" AllowDrop="True" DataContext="

WPF MediaElement stops playing if moved to other screen

巧了我就是萌 提交于 2019-12-05 01:34:09
I'm experiencing a very strange problem with MediaElement that seems to be related to multi screen environment: occasionally (I can't replicate the problem each time) MediaElement stops playing when I drag the window it's in from a screen to other. This strange behaivor happens also with a very basic code like: public MainWindow() { InitializeComponent(); } protected override void OnSourceInitialized(EventArgs e) { media.Play(); base.OnSourceInitialized(e); } and <Window x:Class="Test.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas