Click here to Skip to main content
15,902,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this app that captures the video from the integrated camera in the laptop, its working fine when I run it from within Visual Studio and I can see the video streaming in picturebox1 , but when i deploy the app (setup package or ClickOnce) and run it, the camera light is turned on but nothing is displayed in the picturebox1 . And no error messages. Any advice?

What I have tried:

Below is the code :

Public Sub callCam()

       PictureBox1.SizeMode = PictureBoxSizeMode.Zoom
        fiF = New FilterInfoCollection(FilterCategory.VideoInputDevice)
        finalVideo = New VideoCaptureDevice(fiF(0).MonikerString)
        finalVideo.VideoResolution = finalVideo.VideoCapabilities(0)
        
        AddHandler finalVideo.NewFrame, New NewFrameEventHandler(AddressOf Scapture)
        finalVideo.Start()
      End Sub

Private Sub Scapture(ByVal sender As Object, ByVal eventArgs As NewFrameEventArgs)


        If ButtonVIDEO.BackColor = Color.Black Then 'In case of Preview only (No recording)

            Try
                BMP = DirectCast(eventArgs.Frame.Clone(), Bitmap) 'Put the data in the bitmap
                PictureBox1.Image = DirectCast(eventArgs.Frame.Clone(), Bitmap) 'present it in the Picture Box

            Catch ex As Exception
                MsgBox(ex.Message)
            End Try


        Else ' In case of Recording
            Try
                BMP = DirectCast(eventArgs.Frame.Clone(), Bitmap) 'Put the data in the bitmap
                PictureBox1.Image = DirectCast(eventArgs.Frame.Clone(), Bitmap) 'present it in the Picture Box
                VFwriter.WriteVideoFrame(BMP) 'Save in Memory

            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End If
    End Sub
Posted
Updated 22-Aug-20 23:38pm
Comments
Sandeep Mewara 23-Aug-20 3:18am    
Sounds like security thing. Did you run the app in elevated mode as an admin?
Eyadox 23-Aug-20 5:28am    
Thanks you are correct, simply I disabled Kaspersky, and the problem solved.
Sandeep Mewara 23-Aug-20 5:38am    
Thats great! Added it as a solution for closure of question.

1 solution

For reference and closure of the query:
It looked like a security related issue.

Post elevation or right privileges (OP tried with turning antivirus off), it worked out.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900