How to create an Activation process for playing videos - c#

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.

Related

Taking pictures and recording multimedia files from WPF-application

we are in need of a way to record videos with sound and taking pictures inside a WPF-application. It should be able to save locally to disk. Preferably it should be able to show the content once it is saved as well, but if no such component exists, we will use another component for the playback.
I've looked around and found no real good options to do this. Some options lack the sound recording in videos, and some are just too old to get working properly (WPF has had a long run so far...)
Does anyone here has any experience in this specific area?
Got Taking Pictures and Videos working with this little documentation https://www.codeproject.com/Articles/330177/Yet-another-Web-Camera-control
If you dont tell us what problems exactly you got, or which code you already got, we can't really help.

Play two sounds parallel in background agent

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

Playing video in a .NET application

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.

Making a video player training software

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.

How to use two controls for movie player?

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#)

Categories