I wrote a WinForm application that will be remotely accessed via RDP. I am having issues with the sound being transmitted to the client.
I am using the following to trigger a Beep. It is working as expected when I launch the app from my development box. However, when I access it via RDP, It is not beeping.
Console.Beep();
I am wondering if there is a better alternative or anybody aware of a workaround.
The solution was to directly play an audio file. I tried Console.Beepand System.Media.SystemSounds.Beep.Play with no luck!
Console.Beep(); // It didn't work.
System.Media.SystemSounds.Beep.Play(); // IT didn't work either
// Playing directly a wave file produced audio.
using (var soundPlayer = new SoundPlayer(#"c:\Windows\Media\ding.wav"))
{
soundPlayer.Play(); // can also use soundPlayer.PlaySync()
}
Related
I am trying to integrate a live feed in my WPF application using DirectShow device. Both audio and video is working fine in VLC.
I have integrated VideoCapturePlayer from the WPF-MediaKit in a simple application and i am able to see live video feed from the device, but i am unable to get the audio. I am not 100% sure that it is possible to capture both audio and video using the VideoCapturePlayer.
Any help in getting the audio to work will be appreciated.
Probably there's no Audio renderer set up in VideoCapturePlayer. Try to pull up the MediaUriBase.InsertAudioRenderer into the MediaPlayerBase and use it for the VideoCapturePlayer. If you succeed, open a new PR with your code.
I'm working on a WPF project that need to use Media Foundation to capture video from webcam.
Now I can get IMFsample from webcam everytime I want, I had used SLimDX to get IMFMediaBuffer (get it from IMFSample) to IDirect3DSurface9 pointer and set it to back buffer of D3DImage. It's work great on PC but windows Tablet.
This is the error message I got when run on Tablet:
The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action.
So Do you know another way to present IMFSample to UI.
Thanks.
I tried to attach the same Video Source Device (the WEB CAM) to two different CaptureSource objects but it looks like that want work.
The system throws an exception: A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)
I think the web cam is locked on first CaptureSource.
Does anybody has an idea how to display two images from the same Device but from different capture source? I wanted to use a simple CaptureSource on one side and MediaStremSource with some filtering on the other side to see differences between original and filtered video source.
I wanted to use the plain CaptureSource because it's performance is better than MediaStreamSource. MediaStreamSource loses time when raises OnSample Event which is not happening with CaptureSource.
I know this exception, When you work on debug mode silverlight fails.
Run project by Ctrl+F5. (Release mode)
In addition use ask for permission methods this will display permission window for camera.
It is very capable, just did it myself. However, in experimenting with different cameras and different inputs.... 2 MS LifeCams connected to USB3 = same error. Connecting to USB2 hub to USB2 MB works like a charm. Also, if I run something like ActiveCam and it crashes, may need a reboot. Oh, you will need to use 2 capture sources.... but can still ask permission once.
Also remember not to use DefaultCaptureDevice but:
var dev1 = CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices()[0];
var dev2 = CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices()[1];
With perhaps better naming conventions and logic to check if devices exist etc...
I'm running into problems on the WP7 with MediaElement downloading a 128kbps mp3 stream from a web service for a music player app that i'm working on. The file downloads correctly when the wp7 is on a wifi connection, but downloading sometimes stops when off of wifi. The problem is that i'm not getting any errors or exceptions when the downloading fails and the MediaElement state is "playing". MediaElement runs right past the downloaded portion of the stream and acts like it is playing, but there is nothing to play since the download stopped. I can somewhat replicate this issue based upon my location and using the 3g instead of wifi, so i believe it is due to a low connection. I don't believe any code needs to be shown in this instance, but i try to post something. I want to know if I have any control over this? Are there any other events I could use to detect when the download has failed? Is there another way I could download a mp3 stream that is more reliable and play it? Is there another player/component I should try?
Thanks in advance
You could always use MediaStreamSource to try to handle the download and implement streaming, to some extent. It is a more "painful" way of doing this since you will have to work with an extra media layer, but it pays off by improving playback stability.
Here is a starter example by Tim Heuer. Take a look specifically at how he takes advantage of a custom implementation of MediaStreamSource. Here is a more complex sample.
If streaming is not a requirement, you could download the file (and store it in the Isolated Storage) and then play from there.
Update: We are still using XP at work and I got my solution working, but now knowing that Vista and beyond have the isolated session I am going to implement a WCF IPC...
I have a windows service that needs to notify the user of an event of some type occurring. I decided that something similar to email notification messages would make sense. It also makes sense to do such a simple UI using WPF. This would allow me to learn some basics.
I run a thread:
Thread thread = new Thread(new ThreadStart(RunUserNotificationOnIndependantThread));
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
Then I set up the object and call the method that calls DoubleAnimation.BeginAnimation
private void RunUserNotificationOnIndependantThread()
{
UserNotificationWithImage test = new UserNotificationWithImage();
test.Title = _title;
test.Url = _url;
test.Message = _message;
test.LoadUserNotification();
}
public void LoadUserNotification()
{
Rect workAreaRectangle = System.Windows.SystemParameters.WorkArea;
Left = workAreaRectangle.Right - Width - BorderThickness.Right;
Top = workAreaRectangle.Bottom - Height - BorderThickness.Bottom;
_fadeInAnimation.Completed += new EventHandler(_fadeInAnimation_Completed);
// Start the fade in animation
BeginAnimation(UserNotificationBase.OpacityProperty, _fadeInAnimation);
}
The debugger reaches BeginAnimation(...) and no window appears. Is this even possible or what am I doing wrong in attempting this???
The UserNotification code is based on a blog by Nicke Andersson: WPF Desktop Alert blog
Thanks for any help!!
On XP a service that interact with the desktop has two serious problems to overcome - what to do when no users are logged in and what to do when several user are logged in (fast user switching and terminal services are the two most common ways to log in more then one user).
On Vista, for security reasons, services run on their own isolated desktop so any UI you show will go on that special desktop that no user can ever access.
You should write a small Gui program that runs on the user's desktop and communicate with the service using some type of IPC (Remoting, Soap, Rest, named pipes, files, whatever you like).
Generally speaking I would not recommend a Windows Service to interact with the user's desktop directly at all. As a simple example, problems arise because the service may start before any user is logged on. My suggestion would be to create a small app that start-up with the user session and communicated to the Windows Service via IPC (Interprocess Communication) such as WCF.
But if you do want to try to get it running, my hint would be switch on "Allow interaction with desktop" for the service and I seem to remember that this switch doesn't work at all under Vista, but someone else should confirm that.
HTH
alex