I have added and mediaplayer control to my c# application, and I can make it play a .wma song. My problem is that i want to see if the player is playing. Is there an event that I can use? Or is it a way I can see for how many seconds a song has been playing?
Yes, you can check the PlayState property or handle the PlayStateChange event.
Related
I develop an application that use VLCdotNET to create media player. Need to make an action that allow to click on video, the video can play or pause like a video on Youtube. Anybody has any solution? I tried to make event click on VLC but it's not working.
The sample application included with the library contains an example of how to accomplish what you are looking for: https://github.com/ZeBobo5/Vlc.DotNet/blob/master/src/Samples/Vlc.DotNet.Forms.Samples/Sample.cs
When you stop your music which is playing in the music player, it doesn't really stop it. It just pauses it, as you are still able to see the music controls after you lock the screen. I want to remove the volume controls (rewind,play,forward) buttons which appear on the locked screen using the code behind. This has already been achieved by an existing app on the marketplace Stop the Music!. I have gone through this page, but still I am not able to understand how they are able to do so.
Is there anyway to achieve this??
Nice question, after some trial&error testing I've actually found out, how to remove the Music player from volume controls:
You need to add into your app empty file with .wma extension and set the build action as "Content", for instance "empty.wma" into the app root folder.
To stop the media playback and remove the media player just create dummy Song object and try to play it like this:
Song s = Song.FromUri("empty", new Uri("empty.wma", UriKind.Relative));
MediaPlayer.Play(s);
And that's all, because the file is invalid music file, nothing is playing and even the previous Music player has been removed.
Note I've tested this on Windows Phone 8 device with GDR3 update. Not sure, if it works as well on Windows Phone 7.5.
You don't need to do that now. Windows Phone 7.8 now have the music control as a popup when pressed volumn button on devices.
I'm trying to get one .wav file to play as ambient music though when another sound is played, it halts the ambient music and I've tried doing play-loop and tried the various sync, async , load.
I think I'm missing something here. Thank you in advance.
Check this question on SO and the suggestions made there. The basic problem is that SoundPlayer can only play one sound stream at a time - if you want to play multiple sounds concurrently you need a different solution.
It is possible to use Windows Media Player for the ambient sound, and play another sound with SoundPlayer at the same time:
// example begin
WMPLib.WindowsMediaPlayer mediaPlayer = new WMPLib.WindowsMediaPlayer();
mediaPlayer.URL = "<theAudioFile>";
mediaPlayer.settings.setMode("loop", true);
mediaPlayer.controls.play();
// example end
A reference to Windows Media Player assembly needs to be added to the solution as well.
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
I am developing an application in C# that has a form with Windows Media Player embedded inside. There are several links to some online content in my app. and I want user to change the content from one to another with a button click. Since WMP spent some time while buffering for the next content, I want to continue playing the current content. There is an event called "Buffering" in AXWindowsMediaPlayer class that signals when media player finishes buffering the content. But I could not achieve this with a single AXWindowsMediaPlayer object. Whatever I did, I could not continue to play the first content while buffering the second. :(
Any ideas?
Thanks in advance.
I suggest two instances of the Player control that you swap out as needed.
Alternatively, if the connection is fast enough cache each item on the local system and play from there.