I am using embedded version of Windows media player 11+ using C# in a windows application. Is there any better alternative to play audio? I am looking to play audio and will not be playing videos at all.
Windows media player plays well but I am curious about other alternatives as well.
FMOD is a very nice free library that, while game-oriented, supports many formats and has a full-featured C# API.
It's extremely easy to use (for simple scenarios) and comes with lots of examples.
Related
I'm trying to find the way for getting image (only image, not video stream) from webcam in managed C#.
Usually people suggesting libraries, but they are old or commercial or under gpl.
How get image from webcam without third-party libraries?
upd.: thanks for Media Foundation, I shall use that.
Web cameras are supposed to deliver video feeds, not stills. So the native API you might be interested in is the one for video capture, which are DirectShow and Media Foundation.
The one you would most likely want is DirectShow, but it is not well suited to be interfaced from managed code, so you will need a DirectShow.NET which is open source wrapper. You typically start video streaming there and once you have a good image you stop the activity.
Or instead you might keep looking for a ready to use library which does the mentioned above for you.
One of DirectShow.NET samples does what you look for.
DxSnap – Use DirectShow to take snapshots from the Still pin of a
capture device. Note the MS encourages you to use WIA for this, but if
you want to do in with DirectShow and C#, here's how.
It mentions WIA, however WIA API is not available for all (or any in recent OSes?) web cameras, WIA more targets device like scanners.
Other APIs are perhaps less suitable.
VFW ("avicap32.dll") limits you to a subset of devices, is simple yet not well interfaced into managed code
Media Foundation is not well available in earlier OS versions
I wrote this many years ago
http://www.vbforums.com/showthread.php?344471-Vb.Net-WebCam-Class-(ICam)) in VB.net
You could easily port it to c#?
Is avicap32.dll out of the question?
Otherwise I think this is a simple and straightforward way:
http://www.creativecodedesign.com/node/66
http://www.c-sharpcorner.com/uploadfile/yougerthen/integrate-the-web-webcam-functionality-using-C-Sharp-net-and-com-part-viii/
Lately, I've been trying to setup a media center PC. I've played around with all the common media center applications like XBMC, Plex, Boxee, and WMC. But all of them have one issue or another. So I was thinking about writing my own application from scratch.
My problem is I have no experience with developing software that plays media such as videos or music. I'm also not interested in spending a huge amount of time trying to figure this out, considering all the different file formats and codecs out there. I'm really more interested in developing the database and library interface for my application and reusing someone else's control or code for actually playing the media.
One option I was thinking was to just control an existing media player externally. So for example you may browse for a video to play in my application, and then when you hit play it would fire up VideoLAN or some other popular video player.
However, I was wondering if there was an easy way to play video inside a .NET application. I'm looking for something that is capable of playing a wide variety of formats such as MKV files, and DVD ISOs. I'm more experience with WinForms, but was also thinking about using this project as an opportunity to learn WPF.
i've spent many years looking at playing video under wpf.
The short answer
There is no easy way to guarantee to be able to play a variety of formats under wpf ( mkv,dvd etc etc ) or under windows for that matter.
the long answer
If you are looking just to run this at home and not release it, install all the codecs you need and most of the formats will run via mediaelement in wpf.
Getting all the codecs to cooperate can sometimes be frustrating.
Now moving into slightly harder territory.
if you want to play DVD then you need to replace mediaelement with wpfmediakit
http://wpfmediakit.codeplex.com/
wpfmediakit gives a base library to get access to the low level directshow functionality.
There is already a code base for playing DVDs based on wpfmediakit.
Now moving onto the very hard territory.
if you want to distribute your application and have users be able to "just watch" most/all media formats means you need to be able to completely control their codecs, which generally means distributing the codecs with your package and building the directshow filter graph in code rather than let windows build it.
The easiest way is to use the existing .Net hooks to Microsoft's standard MediaPlayer:
http://msdn.microsoft.com/en-us/library/system.windows.media.mediaplayer.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd562851%28v=vs.85%29.aspx
was trying myself a while ago for something to play media in winforms, and found out there is vlc wrappers for .Net, dunno how good they are as i gave up, but you can try
here is one them:
http://vlcdotnet.codeplex.com/
Thanks for all the great answers. But just found out that VLC can actually be controlled through HTTP. So I think I'm just going to use that to point an instance of VLC running with the HTTP interface at whatever file I want to play.
Is there a way to rewind/fast forward (or at least start playing at a certain position of a track) a media that is being played (using XNA.Framework.Media.MediaPlayer static instance) from a Media Library integrated application on Windows Phone Mango?
BTW: I have created a feature request on wpdev user voice community, so if you are in need of the similar functionality, go ahead and make a vote: http://wpdev.uservoice.com/forums/110705-app-platform/suggestions/2459380-allow-setting-a-playback-start-position-within-the
In XNA 4.0 there is no real way of doing this using MediaPlayer unless there are undocumented hacks to get it to. But definitely there are no documented ways of doing this with the MediaPlayer class.
What is a sound library I can use to easily manipulate sound files (mp3, ogg, wav, etc.).
I'm doing this as a leasure project and as such I'm more than willing to read a bit because I want this to be a little learning experience.
Any help, SO? :D
If you need more than just .wav files, as it appears you do, and you're using .NET 3.0 or higher, have a look at:
MediaPlayer Class
It's basically a wrapper around Windows Media Player, and will let you do in code most (if not all) of what WMP can do.
If you're still in .NET 2.0, have a look at the Windows Media Player SDK, which is a significantly uglier wrapper around Windows Media Player. See this answer.
SoundPlayer class for wav. At the bottom of that documentation there is a link to a page explaining how to also play mp3 and wma.
I am looking to put a camera on top of a my lab in the process of being built and stream it to a website.
How can I be doing this with only c# ? How to get stream of video & send it live on server PC from there he can take instant photos?
Modern web cameras would supports WIA and DirectShow. WIA has a scripting interface which is more friendly to C#, however it is designed for cameras and scanners and is not that fast for streaming. But if you just need to push the image to a server, you don't need to write code, kist use Windows Media Encoder to push to a Windows Media Server's publishing point. You can then get image from the server's publishing point using DirectShow or Windows Media Format SDK. None of these are easy in C# though, you are better off using COM class libraries like ATL for extensive COM programming like this.
If you really want to write this in C#, I've had a lot of success with Egmu.
Capturing images is very straightforward - see this question. After that, it'd be FTP to the server as usual.
I'm curious about Sheng Jiang's Media Encoder solution though. Let me know how you get on.