Capture Images/Video from webcam
Visual Basic tutorials for UWP apps.
2 posts
Page 1 of 1
Capturing images or video from a webcam on Windows 8 has been made really simple and doesnt require any long complicated code to achieve.
This will allow you to capture an image or video from the devices webcam.
Capture an image:
You need to enable 'Webcam' in the app capabilities settings.
Capture a video:
You need to enable 'Webcam' and 'Microphone' in the app capabilities settings.
This will allow you to capture an image or video from the devices webcam.
Capture an image:
Code: Select all
Change "PicBox" to the control you wish to display the captured image inside. Dim CameraDialog = New CameraCaptureUI()
Dim AspectRatio = New Size(16, 9)
CameraDialog.PhotoSettings.CroppedAspectRatio = AspectRatio
Dim CapturedImage = Await CameraDialog.CaptureFileAsync(CameraCaptureUIMode.Photo)
Dim BitmapImage = New BitmapImage()
Dim Filestream As IRandomAccessStream = Await CapturedImage.OpenAsync(Windows.Storage.FileAccessMode.Read)
BitmapImage.SetSource(Filestream)
PicBox.Source = BitmapImage
You need to enable 'Webcam' in the app capabilities settings.
Capture a video:
Code: Select all
Change "VidBox" to the control you wish to display the captured video inside (Media Element).Dim CameraDialog = New CameraCaptureUI()
CameraDialog.VideoSettings.Format = CameraCaptureUIVideoFormat.Mp4
Dim CapturedVideo = Await CameraDialog.CaptureFileAsync(CameraCaptureUIMode.Video)
Dim Filestream As IRandomAccessStream = Await CapturedVideo.OpenAsync(Windows.Storage.FileAccessMode.Read)
VidBox.SetSource(Filestream, "video/mp4")
You need to enable 'Webcam' and 'Microphone' in the app capabilities settings.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Nice tutorial, but I'm looking for webcam streaming code for win 7 not 8 

LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

2 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023