I am trying to play some WMV/MPG files using the MediaElement control and for some reason, the video files jump and skip while they are playing.
I have played them on their own, outside of the WPF application and they seem to play ok, so why might this be?
I do scale them so that they are smaller, could that be an issue?
Also, if you think that its a codec issue, can I download an application to see what type on encoding it has? I do have 1 (and only one) video file that plays perfectly, so I would want to mimic that one if possible.
EDIT: I just tried to use one of the Vista videos that sit in the "Sample Videos" folder and it is also jumpy... I have no idea why. Its a WMV file.
For some reason, I can get one video file to play ok, which is a MPG file (actually it only skips once, and its hard to notice), curious that its an MPG file thouh..
Thanks a lot!
Mark
I dont know the full reason why this might be happening, but I do have a suggestion to help you troubleshoot:
If you are looking for in depth information about a media file, I would recommend downloading VLC - I've found it to have very good metadata viewable relatively easily. Hope this helps.
Ok, so in a flurry of external libraries and articles I came across this codeplex library:
http://www.codeplex.com/WPFMediaKit
Which has a control the is a replacement for the MediaElement control, called MediaUriElement, I hot-swapped the WPF MediaElement control with this one and all the media issues went away! It even has a Loop flag so you dont have to reset the media Position property when the media ends!
Its only early days of testing, but so far so good :)
Related
I've develop an html5 video player with dash.js that plays streaming mpeg dash content. It works great.
Now I have a requirement to run the same on WPF. using an webbrowser to run my already developed html5 sounds very dirty but I can't figure what I can use to make streaming work.
any tips?
There exists no DASH player library for WPF that I am aware of.
#Sander is right, there doesn't appear to be a WPF or C# Dash implementation at this point.
Microsoft's documentation on building a player suggests using dash.js
I'm also not an expert with WPF and have no experience playing video of any kind within WPF. That said I assume you should be able to do something similar to the way dash.js works with the HTML5 Video element. This would require you to do a number of different tasks like parse the MPD file format, and download the required segment(s).
The simplest implementation of this would be simply parsing the MPD and finding one specific bitrate / resolution BaseURL and passing those values to a WPF element that can handle playing mp4 files. However to really get the benefits of DASH you would need to fully parse the MPD file and implement logic around bitrate switching, etc.
I was doing a wpf music player, use the system.windows.media namespace mediaPlayer control. In my opinion, it can play music files on the machine can also play online with other online music. When it is playing online music, download it first and then buffer some, play some. Finally, I think this music sounds good, want to download. My question is, since it has been played, then this file is not already been downloaded to the local out? If so, how can I get to it?
I dont think this is supported because of digital right management concerns. Its possible that who ever is owning the content the user is playing only wants it to be streamed. Internally though, MediaPlayer most likely keeps a buffer for seeking through content, but its probbly not saved to disk.
That said, if you have an uri, you could use that to download the content localy and then play it, but im unsure how that would work with streaming (starting to download content, and meanwhile asking mediaplayer to play the uri to that local file)
Im building a WPF 4.0 application and I want to include the ability to have a web-cam beside the PC running the app and I want to be able to record a video message. I cannot find any articles on this, and it seems like it might be a bit tricky...
Has anyone had any experience with this or know where to start?
lots of good stuff out there, eg:
http://easywebcam.codeplex.com/
http://khason.net/blog/webcam-control-with-wpf-or-how-to-create-high-framerate-player-with-directshow-by-using-interopbitmap-in-wpf-application/
http://blogs.msdn.com/b/cmarchal/archive/2006/08/25/724224.aspx
EDIT: for recording:
http://blogs.msdn.com/b/uberdemo/archive/2008/03/27/capturing-a-webcam-stream-to-a-wmv-file-from-within-a-wpf-application.aspx
http://videorendererelement.codeplex.com/
We are capturing some video from a webcam in Silverlight, and I'm looking forward for a solution to encode the video real-time before it is getting saved, so that the file size is not bloated up too much. Is there an already available solution, or whether we've to write some custom codecs?
from a codec point, I found a open source project. http://silverlightencoder.codeplex.com/.
Please verify.
I am trying to play a movie (wmv,avi,mpg,etc.) in a winforms application. I would like the user to be able to start, stop and pause.
I'm not looking for a full answer ... I just need pointed in the right direction. I've already did some searching on google but could not find anything useful. I can continue searching but I know the stackoverflow community rocks.
So, please point me in the right direction!
Thanks.
I think this is probably the path of least resistance:
http://msdn.microsoft.com/en-us/library/bb383953.aspx
You could use Windows Media Player ActiveX control.
You could also embed a WPF control that contains a MediaElement control.
Another alternative is to use the VLC library instead of Windows Media Player. The VLC Forums have a number of wrappers that can be used in C#.
I have not done a comparison of VLC versus Windows Media Player, but it is alot less resource intensive then the WPF media elements.
If I remember correctly VLC also has built in support for alot of video formats, potentially making it a better choice I guess.
One possibility is to use the Forms.WebBrowser class. This will give you an embedded web browser so you can install what ever player and plugins you need.
It depends on how complicated you want to get, but I've had luck implementing DirectShow before. It's definitely more complicated than a drop on control, but it's really flexible for different formats and loading codecs.