1

I'm working on windows form to get a website that content camera video, and then catch the image on this site
I'm using

webbrowser1.DrawToBitMap(bitmap, bitmapRect)

but the image shows all white. Then I try to catch image from another site (ex: google.com), the method work perfectly. So I think this could be because that this method could not catch video. So my question is do we have any ways to catch the video within a website through web browser control?
this the code that I embed the camera video

    <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="704" height="592" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
    <param name="src" value="empty.mov">
    <param name="autoplay" value="true">
    <param name="controller" value="false">
    <param name="qtsrc" value="rtsp://<link>">
    <embed src="empty.mov" width="704" height="592" qtsrc="rtsp://<link>" autoplay="true" controller="false" target="myself" pluginspage="http://www.apple.com/quicktime/download/">
</object>
noseratio
  • 59,932
  • 34
  • 208
  • 486
Kien Dang Ngoc
  • 1,079
  • 5
  • 15
  • 25

2 Answers2

0

This is happening because the video box inside the page is not rendered by the web-browser but by the quick-time plugin. hence the web-browser has no information of the graphics content on that region. it would draw blank box.

Now the one person who knows everything about all the graphics content on the screen is the Screen itself. so you can try Graphics.CopyFromScreen method. It has some drawbacks though. for once, it would capture everything on screen including task bar and title bar. second it will capture only the visible part of the page. if the page needs scrolling, or you need full-page screenshot then we have a problem.

we could have workarounds though. the taskbar/titlebar can be cropped off by carefully calculating the rectangle area out of the whole screen. similarly the page can be programatically scrolled, recaptured and images joined to full-page view.

as for the actual implementation, i am fairly optimistic about capturing perfectly sized rectangle out of the screen. i can help with code if you ask. try first (tip) . as for the second part of scroll-capture-join, it would be quite tedious i am sure, but achievable.

Community
  • 1
  • 1
inquisitive
  • 3,549
  • 2
  • 21
  • 47
  • if he mix both he should be good. use `Screen` to grab the real visible thing then the browser shot. match the pixel to align everything and keep only the browser visible box. there is some piece of code that find match between 2 pictures and can align them on top of each other and it works also good if one of the image is not same scale. i used it in the past. Also there is PHP graphic library that can do that. Image magic or something like that. – Franck Nov 06 '13 at 12:10
  • by using CopyFromScreen, I can manage to capture the fullscreen; however, the camera that I mentioned above is in another form, I've tried to capture only that form, but I couldn't, this is the code to get fullscreen
    – Kien Dang Ngoc Nov 08 '13 at 08:18
  • int screenX = Screen.PrimaryScreen.Bounds.X; int screenY = Screen.PrimaryScreen.Bounds.Y; Bitmap bmpScreenShot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb); Graphics gfxScreenShot = Graphics.FromImage(bmpScreenShot); gfxScreenShot = Graphics.FromImage(bmpScreenShot); gfxScreenShot.CopyFromScreen(screenX, screenY, 0, 0,Screen.PrimaryScreen.Bounds.Size,CopyPixelOperation.SourceCopy); bmpScreenShot.Save(name + ".png"); – Kien Dang Ngoc Nov 08 '13 at 08:20
0

This page uses Apple's Quick Time ActiveX control for video playback. Most likely, the control uses DirectX and doesn't respond to WM_PRINT message (used by WebBrowser.DrawToBitMap internally). Although I believe the chances of success are low, you could try a couple of other things, specific to WebBrowser (i.e., outside the full screen capture context):

Community
  • 1
  • 1
noseratio
  • 59,932
  • 34
  • 208
  • 486