I have a problem with web cams in Win8 metro.
I want to make an application that will draw on photo.source video from webcam.
Unfortunately, I found only this How to get camera feeds in Windows 8 Metro style app? and app opens only capture and I need show only the webcam. Thanks for answers.
You could use the CaptureElement to integrate the camera feed in your application. In XAML:
<CaptureElement x:Name="capElement" Width="400"></CaptureElement>
In code-behind, you need to activate the source:
MediaCapture captureMgr = new MediaCapture();
await captureMgr.InitializeAsync();
capElement.Source = captureMgr;
await captureMgr.StartPreviewAsync();
You mean something like this? windowsapps/CameraCaptureUI
Related
How do you make live tiles for Windows Phone 8.1 Apps?
It is the best kept secret on the internet!
I am trying to make a tile, which whenever the app is suspended, it updates the live tile with some text.
I have read/watched roughly a dozen "tutorials" on live tiles, and none of them are compatible with Windows Phone 8.1.
At a high level, what steps do I need to follow to accomplish this?
Note: I am well aware that Tile Templates exist...but the secret is what to do with them. All of the code out there not only does not compile for Windows Phone 8.1, but on top of that, the code assumes that people already know how to make the live tiles.
Below is how to create live tile in windows phone 8.1
//Generates an image tile
StringBuilder sb = new StringBuilder("<tile>");
sb.Append("<visual version=\"2\">");
sb.Append("<binding template=\"TileSquare150x150Image\" fallback=\"TileSquarePeekImage01\">");
sb.Append("<image id=\"1\" src=\"ms-appx:///Assets/Logo.scale-141.png\"/>");
sb.Append("</binding>");
sb.Append("</visual>");
sb.Append("</tile>");
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml(sb.ToString());
TileNotification tileNotification = new TileNotification(xmldoc);
TileUpdater tileUpdator = TileUpdateManager.CreateTileUpdaterForApplication();
tileUpdator.Update(tileNotification);
I am testing PhotoChooserTask in my 8.1 app and I do not see any available sample images that come with the emulator? Is there a way to get sample images?
void photoChooserTask_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
//MessageBox.Show(e.ChosenPhoto.Length.ToString());
//Code to display the photo on the page in an image control named myImage.
System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
bmp.SetSource(e.ChosenPhoto);
myImage.Source = bmp;
}
}
You don't need to download from the Internet. I found a great workaround for this.. In the new WP8.1 emulator you have the option to emulate a SD card. Its great. I have created a blog post and a YouTube video. Have a look. Hope it helps.
http://wpdevkvk.wordpress.com/2014/07/19/adding-your-own-photos-to-windows-phone-8-1-emulator/
In the Windows Phone 8.1 emulator there aren't any images available. Actually there are some images for selecting as the background for the start screen, but it is only available for start+theme app in settings page. You can't access them. But you have a workaround for that. Before you test your app you can open the camera app and take some photos. (Obviously it will take save some images of random squares but it will have to do) Then next time you run the app your PhotoChooserTask has some photos to select from.
Developing tools : Visual Studio 2012, target wp platform : wp8.
I am facing the above problem:
When my application is running on background and i am receiving a notification i vibrate the phone successful and i want to play a specific sound.
What i have tried so far:
Player = new MediaElement();
Player.AutoPlay = true;
Player.Volume = 5;
Player.Source = new Uri("/data/alert.mp3", UriKind.RelativeOrAbsolute);
Player.MediaOpened += (Object s, RoutedEventArgs args) =>
{
Player.Play();
};
I i am not getting any exception but no sound. Neither on foreground nor background .
Am i missing something?
I will appreciate any help.
You can't use the MediaElement API to play notification sounds when the app is in background. In order to launch a notification and play a custom sound, you need to use the ShellToast and use the Sound property via reflection.
Here is how play a custom notification sound from background (MSDN link) Using custom sounds in toasts on Windows Phone 8 Update 3
EDIT: When the app is running in foreground, you can use the same technique (ShellToast with Sound).
Even MediaPlayer class can help you play songs and media in the background when you are showing a toast or a small pop up dialog.
Check here : http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.mediaplayer.play.aspx
I've got two questions about how to access the camera on Windows Phone 8:
How can I access the front-facing camera to take pictures?
How can I access the flash/torch of main camera?
This article from MSDN has an example of both accessing the front and back cameras, as well as accessing the flash, assuming your using C# (since you didn't specify). Here's a snippet under the Creating the Capture Device heading:
System.Collections.Generic.IReadOnlyList<Windows.Foundation.Size> SupportedResolutions =
PhotoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Front);
Windows.Foundation.Size res = SupportedResolutions[0];
this.captureDevice = await PhotoCaptureDevice.OpenAsync(CameraSensorLocation.Front, res);
For accessing the flash of the camera, here is a snippet under the Specifying Camera Properties heading:
cam.SetProperty(KnownCameraPhotoProperties.FlashMode, FlashState.On);
cam.SetProperty(KnownCameraGeneralProperties.PlayShutterSoundOnCapture, true);
cam.SetProperty(KnownCameraGeneralProperties.AutoFocusRange, AutoFocusRange.Infinity);
Hope this helps!
I want to write a Windows Store App that can capture video (without any sound) and take pictures. Imagine a digital camera: you can preview the picture on the screen of your device before pushing the button which takes the pic.
The problem I'm facing now is the fact that the Windows.Media.Capture namespace has only classes for objects that capture video with sound (CameraCaptureUI, MediaCapture). I'm not troubled by the objects' capabilities, but by the fact that I will have to include in the manifest of the app the Microphone capability and it does not make sense for the app to use it. I need a class that uses only the Webcam capability.
Any ideas?
I found the answer and I thought I should share it. I'm sorry for answering my own question, but here goes:
One can specify in the settings of the MediaCapture object, when initializing it, that it will use only the Video part:
var mediaCaptureMgr = new MediaCapture();
var captureSettings = new MediaCaptureInitializationSettings();
captureSettings.StreamingCaptureMode = StreamingCaptureMode.Video;
await mediaCaptureMgr.InitializeAsync(captureSettings);
RTFM!