I am currently making a software that can be used to playback training packages. The features I want to add are:
Ability to read the time of videos
Ability to play and pause videos of various codecs (as bundled in Klite Codec Pack)
Ability to create a custom playlist file and continue from the last stop/pause of the playlist when opened
Generate a report of how the playlist was completed
I know very well how I am going to handle the last two parts but I need help on the first two. The current one simply has to launch the files using an external player on the system, and monitor the launched process for exit... but this is not quite what I want.
If WPF is an option you can use the <MediaElement/> for hosting the video in an application. Specifically you can use the Position property for getting and setting the current time.
As the <MediaElement/> is a wrapper for Windows Media Player, all videos playable in WMP should be playable in the <MediaElement/> (after you installed necessary codecs).
You can use VLC with the .Net Interface to VLC. It supports lots of codecs out of the box and seems to be really easy to use.
Related
I am producing course videos for my students and for some reason I have to prevent them to share these videos with one another. I need to create some Activation process in which they can only play videos if they get activation code from me. I have seen something like this before in which video files exist but cannot be played and after activation process they can be played with some custom video player. Do I need to write a custom player? I am .Net developer and wonder if there is any c# solution for this purpose or any other solution.
I have a mp3 file. I have a background sound file like rain sound or some fire sound. I want to play these two files parallel in the app as well as in background. So that it looks like a single music is playing a story with a background. Please provide any guidance to achieve this.
AFAIK there are four ways to play audio in WP: BackgroundAudioPlayer, MediaElement, SoundEffect, Microsoft Media Foundation. As for your question:
BackgroundAudioPlayer - it won't work, as there is only one Instance of BAP on the phone. So to play a different file, you have to change Track's Source, so it won't handle two at the same time.
MediaElement - it's also a bad idea (it won't also run with BAP simultanously), because as MSDN says:
When a MediaElement control plays audio or video content, any background sounds or media already playing are halted. The app launches the playback experience when the user taps the control. Only one MediaElement control can operate at a time.
you can try to play many sounds using SoundEffect (thougt as Documentation says it can be only a wave file), I won't post code here, because there are already many examples: one, two, three
as for Microsoft Media Foundation: Walkthrough, Programming Guide, Supported file formats
I have a C# windows form application in which I am playing videos one by one using WMP activex object and WPF MediaElement (I have included it using element host into windows forms). When application starts user selects either WMP or Media Element to play the videos. Then application starts the playing videos one by one from predefined local directory.
The video formats are almost all the leading formats like wmv, avi, mpg, mpeg, mp4, mkv, flv, mov, vob, 3gp. I am using K-lite codecs full pack so that all these formats can play in the player.
Now, the problem is that after installing the k-lite and my application everything works perfectly (All videos plays perfectly). But after sometime some videos stops playing in both the components. At that time I checked whether it plays in actual (native) windows media player or not but it does not play in it also. Then if I uninstalls the K-lite and installs it again, video starts playing both in my application as well as native WM Player. This behavior happens again after some time.
The time after it happens can be anything between hours to days and every time it happens with different video formats. Also I checked it with different hardware and the behavior is same. What could be this problem? Is it a components (WMP activex and Media element) problem? Is it really that codecs crashing issue? or is this issue of codecs conflict with graphics driver?
Also, I have disabled the hardware acceleration in registry.
Also, one thing I forgot to tell is that this screen
Apart from the K-lite codecs this is also a case. I don't understand why my WMP settings are getting lost and it asking me to do it again and again although I have kept windows updates off.
Thanks.
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.
I have created a movie player. I'm using the default windows control for Media Player. However I just saw that some movies do not work under it(some FLV files). However those files do work under Media Player Classic. So I was thinking about using the Media Player Classic control.
However
I want this movie player to be as portable as possible. So what I would like to do is to use Media Player Classic control when its available in system, but if its NOT than use Media Player control.
Is that even possible or do I need to create two applications that share the same code?
I would recommend using libvlc. VLC is really good about playing almost anything you give it. It is a C API but one could possibly DllImport their way to success and write code in C#.
Here are some good resources to get you started:
http://wiki.videolan.org/Libvlc
http://www.helyar.net/2009/libvlc-media-player-in-c/ (Shows how to DllImport and call the C code from C#)