mediaelement

Why doesn't MediaElement work in Silverlight?

流过昼夜 提交于 2019-12-04 16:56:10
When I run my Silverlight app, this code doesn't play a video at all: <MediaElement Source="winvideo-201DataGridPreview.wmv" AutoPlay="True" AudioStreamIndex="2" Margin="10" Height="200" Width="200"/> From all of the examples I can find of MediaElement, it seems to be the correct syntax, etc. Is there anything I'm forgetting? Edward, based on your XAML check: 1) that the WMV file is in the appropriate encoding format, 2) that the WMV file is located alongside where your XAP file is (I'd actually check this first). I had a similar problem. I added the wmv file as an existing object to my

How to use mouseDown and mouseUp on <button/> [duplicate]

拜拜、爱过 提交于 2019-12-04 15:55:00
This question already has answers here : WPF MouseLeftButtonUp Not Firing (3 answers) Closed 6 years ago . I have a button declared in XAML which has MouseDown and MouseUp attributes that both call a specified method... <Button x:Name="btnBackward" Content="Backward" MouseDown="btnBackward_MouseDown" MouseUp="btnBackward_MouseReleased" Width="50" Height="25" Margin="65,400,377,45"/> However, the method btnBackward_MouseReleased is never called. private void btnBackward_MouseReleased(object sender, System.Windows.Input.MouseEventArgs e) { Console.WriteLine("mousereleased"); this.isRewinding =

how to play dual audio movies in wpf c#

橙三吉。 提交于 2019-12-04 14:16:59
问题 The basic WPF media-element just play the MKV file but does't seek and provide facility to change audio. Is it possible to play this type of videos in Media-element. I have searched so many Que... on stackoverflow like extending media-element functionality etc. or using third party component but does't find any suitable SOLUTION. I does't mean you tell me a complete tutorial but just only gives me direction, what should I do or what can be the alternative? I don't want to use c++ because I

MediaElement.play() from within ViewModel

房东的猫 提交于 2019-12-04 13:26:48
问题 I'm struggling with the following issue: I am building a WP8 application using the MVVM patern. I have a media element on my view.xaml and the logic to control this media element (for example, play, stop, pause and volume) in my viewmodel.cs. How do I play a sound on this media element from my viewmodel using binding. Without destroying the purpose and structure of MvvM. (PS: i've seen the following post, but i'm not sure in how to implement it? Link to post) 回答1: You can bind Media Element

Use the MediaElement cause the error “The background audio resources are no longer available.”

纵饮孤独 提交于 2019-12-04 06:56:41
问题 In my app, I have to use an AudioPlaybackAgent (APA) and a mediaelement. I used the APA to play songs , and when I need to play video, I use the MediaElement When I navigate to a page use the MediaElement, I stop the BackgroundAudioPlayer: BackgroundAudioPlayer.Instance.Pause(); When I navigate back to a page which need to play music, I call the APA to start again, but now it return the exception "The background audio resources are no longer available." :( protected override void

How to stream Webcam in WPF?

谁说胖子不能爱 提交于 2019-12-04 04:40:37
Can I stream a live video in WPF application from my web cam? If yes, then How? You will have to use DirectX Capture or something (is not in WPF right know, so use DirectX API's directly). Look at: WPF Media Kit . It can grab the Vista Windows desktop manager DirectX Direct3D shared Surface, and use it as a visual brush in WPF. He does some nice things with it. Look at his blog where he explains it. I hope this helps you on your way... UPDATE 2009-11-06: The VideoRenderElement Codeplex project has an example on how to stream webcam content. This project looks like it would fit your requirment

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

穿精又带淫゛_ 提交于 2019-12-04 03:09:05
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, The MediaElement.MediaEnded event should help you 来源: https://stackoverflow.com/questions/1738967/wpf-how-to-determine-when-a-mediaelement-has-finished-playing-the-movie

MediaElement.play() from within ViewModel

雨燕双飞 提交于 2019-12-03 07:53:58
I'm struggling with the following issue: I am building a WP8 application using the MVVM patern. I have a media element on my view.xaml and the logic to control this media element (for example, play, stop, pause and volume) in my viewmodel.cs. How do I play a sound on this media element from my viewmodel using binding. Without destroying the purpose and structure of MvvM. (PS: i've seen the following post, but i'm not sure in how to implement it? Link to post ) You can bind Media Element directly from the view model in xaml: <ContentControl Content="{Binding MediaElementObject}"/> in ViewModel:

Data Binding WPF Property to Variable

喜你入骨 提交于 2019-12-02 20:52:49
问题 I have a project in WPF 4 and VB.net 2010. I want to bind the volume property of a mediaelement to a variable in another module. Mind you, the variable is in the correct data type, so no conversion is necessary. How do I do this? 回答1: First, make sure that your code behind implements INotifyPropertyChanged. Example here: http://www.codekeep.net/snippets/4c7ed2e5-7e3b-40b4-b976-d54b54d9bf5b.aspx All that is is a way to notify the UI that value for the Volume has changed and it needs to grab

Rendering not working with MediaElement windows RT

你说的曾经没有我的故事 提交于 2019-12-02 11:05:21
I need to take thumbnail from Video playing with MediaElement For this i learn there is RenderTargetBitmap in windows 8.1 API RenderTargetBitmap a = new RenderTargetBitmap(); await a.RenderAsync(myMedia); thumb.Source = a; and second way i got with help of WinRTXamlToolkit.Composition toolkit which do rendring with WriteableBitmapRenderExtensions class WriteableBitmap w = await WriteableBitmapRenderExtensions.Render(myMedia); thumb.Source = w; Both these methods are working with all UIElement but not with MediaElement only black screen is visible when source this to Image object. Can any one