How to enable audio when using VideoCapturePlayer? - wpf

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.

Related

Chromium Embedded Framework cannot access system audio with getDisplayMedia

Is it possible to capture system screen & audio with chromium embedded framework using getUserMedia or getDisplayMedia? I've managed to get a video only stream of the system so far, but i cannot get audio capture to work.
In standard Chrome you can get the system audio by using:
navigator.mediaDevices.getDisplayMedia({ video: true, audio: true })
This results in a popup where you can tick a checkbox to enable audio capture. The stream has an audio track labeled as "System Audio".
In cef this popup-dialog does not exist (but can be skipped using a launch-config flag). When calling getDisplayMedia in the web-application, you get an audio track aswell, but the track is labeled as "Fake audio". It seems that this track is actually the sound of a microphone and not the system audio.
Any idea why this does not work? Is it actually implemented in the Cef core? I wasn't able to find any info on this. Thanks in advance!
This is supported with the Chrome runtime.
Run your app with the key --enable-chrome-runtime or set chrome_runtime CEF setting to true (1).

Present IMFSample

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.

C# WinForm RemoteApps

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()
}

how to take video and audio from a stream and output to a video file as well as images

I am currently trying to make a program that will take a stream coming in, like a webcam and a microphone, and I am trying to save both the video and audio into an AVI file and be able to save out the information out to images. I've tried to do this with DirectShow and OpenCV, but I've had some trouble since I have audio that I would like to include in the AVI file, but cannot see a way to use OpenCV to save Audio information.
I've also looked into FFMPEG, but I don't see much online about working with streams coming in from Windows.
Any information or documentation would be great.
I am trying to develop this on a Windows compatible machine.
Thanks
We have a cross platform vision system framework that may solve your needs:
http://www.simplecv.org
Here is how you do it in our code:
from SimpleCV import *
import time
cam = Camera()
visstream = VideoStream("foo.avi")
while(True):
image = cam.getImage()
image.save("c:/blah.png")
image.save(visstream)
time.sleep(0.05)

WP7 MediaElement download problems

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.

Resources