VLC player event catch - c#

In my C# application i need to trigger some events when a VLC player (preferably) starts playback (a play button is pressed in VLC for example).Tried Windows Media Player classic with Microsoft Spy++ and observed messages that are sent when playback starts\repeats but i don't know how i could "catch" those messages in my C# code.So my question: is there any way to hook up to event in VLC (or WMP) and get notified about playback status (play, stop, start of repeat).
My goal is to create a C# function that waits for start of playback event in player and then triggers some actions in my application (this should also happen when playback ends and starts repeating). What approach should i take here?
Just to clearify: I don't want to embedded a new instance of VLC in my app, but instead control/read the "real" full version of VLC, started seperatly by the user

The below linked article looks like it is old, but maybe you can glean some good info from it if not use the component outright.
.NET Interface to VLC

if you want to control the full one you'll probably have to use the telnet interface or the web interface

Related

Streaming audio from microphone in iPhone using Xamarin

Recording with AudioQueue and Monotouch static sound demonstrates how to get audio via an iPhone's microphone into an AudioQueue using Xamarin.iOS. My question is: how do I keep the microphone continuously recording? I basically want to keep the microphone on for as long as the app is open, and continuously capture the audio stream (note that I do not want to save the stream to file). Inside a long-running while-loop?
This should work: https://github.com/sami1971/SimplyMobile/blob/master/iOS/SimplyMobile.Media/Audio/AudioStream.cs
Initialize and use Start() on application start and then call Stop() when application closes (or goes background). Captured buffers are delivered through event handler OnBroadcast.
EDIT: Here is a quick WaveRecorder class. I have not had time to test it so if you find bugs in it, please push back changes or let me know what needs to be changed. https://github.com/sami1971/SimplyMobile/blob/master/Core/SimplyMobile.Media/Audio/WaveRecorder.cs

MediaPlayer vs BackgroundAudioPlayer

I'm developing an Windows Phone application, that plays/streams music in background.
To accomplish that, I tried to use both Microsoft.Phone.BackgroundAudio.BackgroundAudioPlayer and Microsoft.Xna.Framework.Media.MediaPlayer classes.
In both cases everything worked just fine, so I was wondering, what are advantages/disadvantages of these methods, because now I can't decide which one is better.
The only thing that I don't like in BackgroundAudioPlayer, is that I need to create separate project for audio agent, and worry about transferring track info via IsolatedStorage. But since I've done that already. It's not a problem.
So are there any other differences between those two classes?
It depends on your program. If you want to play your background music only while using your program, you should use MediaPlayer. Otherwise you have to take care of the BackgroundAudioPlayer in any situation. Also this will annoy users, who also want to listen to their own music while using your application.
Otherwise, if your background music is the main purpose of the program, the user would like to start your music and switch to other programs. Then it keeps playing and you can control the music in the volume bar. That's why you have to create a background task for BackgroundAudioPlayer. The main application will stop in both ways when switching to other programs.
In short: game background music should never play after leaving the game (use MediaPlayer) - but I never want to watch my music player counting the time, while listening to my music library (use BackgroundAudioPlayer).
I believe MediaPlayer requires the application to be in the foreground. BackgroundAudioPlayer will let the user start a track, exit your application, and the music will continue to play and the agent can respond to the UVC.
Make sure you use a Mutex when you communicate between the foreground app and the background audio agent.

How to listen to windows events in C#?

I'm developing an lyrics related application and I need to listen to Windows Media Player Events.
I watched windows events in "Accessible event watcher" and I found out that there's some events that WMP sends whenever it's state or current position changes.
I searched and found this article on MSDN a How to set a Windows hook in Visual C# .NET but I couldn't make it work.
How can I listen to that events from my C# application or any suggestions on using other methods to get current song and WMP playing status?\
Thank You
This article describes how to get the events using the AxWindowsMediaPlayer which is the underlying root of the windows media player system. You will see that the various state change events can be picked up normally.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd562388(v=vs.85).aspx
You should be able to get a running instance from the windows ROT (Running objects table)?
http://www.darinhiggins.com/the-running-instance-of-windows-media-player/
Edit:
This is another way...
http://www.darinhiggins.com/gaining-access-to-a-running-instance-of-windows-media-player-in-vb-net/
Does this help you? http://forums.msdn.microsoft.com/en-US/clr/thread/dbd43d7e-f3a6-4087-be06-df17e76b635d . There's also this post here Getting windows media player currently playing song that may answer your questions.

WPF media element gets blank and VLC and WMP goes in non responding mode

I have C# windows application in which one can play videos. I have used three options i.e WPF mediaelement, Windows media player activex component and vlc activex component. In my application. In this I plays video using one of the component at a time. And for that I use two instances of that particular component i.e. first video will play in first instance, then second video will play in second instance, then third will play in first and fourth will in second like this it will go on. the play duration is min 5 secs to some hrs. Now,
When I use WPF media element after some hours the form gets blank and application hangs (I have log4net to log and whenever it gets blank it stops logging) but in task manager instaed of showing not responding it shows running. Also, sometimes it takes lots of memeory.
When I use WMP or VLC activex com object after some hrs appliaction goes in non responding mode and task manager shows it correctly. In this there is no memory problem.
After seeing the above results I strated disposing the objects after its turn gets over. So for each video there is a new instance of the above mentioned components. But still I am getting same problem?
I'm working on a similar project to yours where I'm using VLC activex. I experienced the same problems you are describing. To solve this issue, I've added the VLC pluging in a a GroupBox and disabled the GroupBox by setting the Enabled property to false. Let me know if it works for you.

how to control media player using script or code

Is there a media player, where you can control its audio and video using script or code.for example lets say i want to pause the video after n secs, which player supports this? I am looking for free opensource solution which runs on desktop i.e windows 7.
I'm not the kind of giving the entire solution. But here's a good place to start. It shows how to embed Windows Media Player in a Windows Form.
http://msdn.microsoft.com/en-us/library/bb383953(v=vs.90).aspx
You'll have access to control like play, stop, etc.
VideoLan supports such use.
For instance, see here: http://www.videolan.org/doc/play-howto/en/ch04.html
From the link:
--extraintf allows you to select extra interface modules that will be launched in addition to the main one. This is mainly useful for special control interfaces, like HTTP, RC (Remote Control), ... (see below)
The RC interface is probably best from a pure code/script point-of-view.
The HTTP interface is oriented towards a human using a webpage, but could be controlled from code, too.

Categories

Resources