gcue Posted August 8, 2013 Share Posted August 8, 2013 hello world! hopefully someone has a workaround for this... i would like to use ienavigate to browse to a camera feed http://192.168.0.1/-wvhttp-01-/video.cgi?v=jpg when I use this address in chrome, it shows me the video feed i want. when i use IE 7 it prompts me to download video.cgi and I never get the video feed. i think the ie udf uses ie 7 because i get the same behavior when using ienavigate any help is greatly appreciated! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 8, 2013 Moderators Share Posted August 8, 2013 Can't test obviously, but what happens if you simply use the address in an _IECreate rather than _IENavigate - same behavior? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
FireFox Posted August 8, 2013 Share Posted August 8, 2013 (edited) Hi, The download prompt shows that IE does not support the stream in the way it's sent. Try to upgrade your IE version. Why do you need this for? You can directly display the stream in your GUI with some TCP and GDIPlus functions (take a look at the IP Camera link in my signature). Edit: @JLogan3o13 Again you?? Get the f**k out of here ! Br, FireFox. Edited August 8, 2013 by FireFox Link to comment Share on other sites More sharing options...
gcue Posted August 8, 2013 Author Share Posted August 8, 2013 yea same behavior =/ Link to comment Share on other sites More sharing options...
FireFox Posted August 8, 2013 Share Posted August 8, 2013 Yes it will work It's not a UDF, just an example. If you don't have a HTTP authentication then remove the lines where it authenticates. Br, FireFox. Link to comment Share on other sites More sharing options...
gcue Posted August 8, 2013 Author Share Posted August 8, 2013 still cant get a feed using this TCPSend($iSocket, _ "GET /-wvhttp-01-/video.cgi?v=jpg:320x240::10000 HTTP/1.1" & @CRLF & _ "Host: " & $iIPAddress & ":" & $iPort & @CRLF & _ "Connection: keep-alive" & @CRLF) the camera doesnt use a port and it seems its a required field for tcpconnect Link to comment Share on other sites More sharing options...
FireFox Posted August 8, 2013 Share Posted August 8, 2013 (edited) The default HTTP port is 80.Edit: The double CRLF is required at the end of your header request ! Edited August 8, 2013 by FireFox Link to comment Share on other sites More sharing options...
gcue Posted August 8, 2013 Author Share Posted August 8, 2013 that worked!!! thank you!!! Link to comment Share on other sites More sharing options...
FireFox Posted August 8, 2013 Share Posted August 8, 2013 You are welcome Link to comment Share on other sites More sharing options...
gcue Posted August 8, 2013 Author Share Posted August 8, 2013 (edited) i am trying to strip out the recording part of it as i only need the viewer.. so many variables to go through - my eyes hurt! id like just a bare viewer Edited August 8, 2013 by gcue Link to comment Share on other sites More sharing options...
FireFox Posted August 8, 2013 Share Posted August 8, 2013 (edited) Not hard to do, here you go (not tested) :expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> #include <GDIPlus.au3> #include <Memory.au3> #region Global Vars Global Const $sProgramTitle = "IP Camera stream" ;HERE YOU GO: Global Const $iIPAddress = "192.168.1.99", $iPort = 80 Global Const $STM_SETIMAGE = 0x0172 Global $blGUIMinimized = False Global $bRecvtmp = Binary(""), $bStream = $bRecvtmp Global $iImgLen = 0, $iStreamLen = 0, $iWritten = 0, $iEOH = 0, $iContLenPos = 0, $pBuffer = 0 Global Const $iContLengthLen = StringLen("Content-Length: ") Global $sStream = "", $sTrim2ContLen = "" Global $hBMP = 0, $hHBITMAP2 = 0 #endregion Global Vars TCPStartup() Global $iSocket = TCPConnect($iIPAddress, $iPort) If @error Then MsgBox(16, $sProgramTitle, "Could not connect !") Exit -1 EndIf TCPSend($iSocket, _ "GET /videostream.cgi HTTP/1.1" & @CRLF & _ "Host: " & $iIPAddress & ":" & $iPort & @CRLF & _ "Connection: keep-alive" & @CRLF & @CRLF) #region GUI Global $hGUI = 0, $pPic = 0, $hPic = 0 $hGUI = GUICreate($sProgramTitle, 640, 525) $pPic = GUICtrlCreatePic("", 0, 0, 640, 480, $SS_BITMAP) GUICtrlSetState($pPic, $GUI_DISABLE) $hPic = GUICtrlGetHandle($pPic) GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") GUISetState(@SW_SHOW, $hGUI) #endregion GUI _GDIPlus_Startup() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch $bRecvtmp = TCPRecv($iSocket, 4096, 1) ;4kb If @error Then ExitLoop If Not BinaryLen($bRecvtmp) Then ContinueLoop $bStream &= $bRecvtmp If $iImgLen = 0 Then $sStream = BinaryToString($bStream) $iContLenPos = StringInStr($sStream, "Content-Length: ", 2) $iEOH = StringInStr($sStream, @CRLF & @CRLF, 2, 1, $iContLenPos) If $iEOH = 0 Or $iContLenPos = 0 Then ContinueLoop $sTrim2ContLen = StringTrimLeft($sStream, $iContLenPos + $iContLengthLen - 1) $iImgLen = Number(StringLeft($sTrim2ContLen, StringInStr($sTrim2ContLen, @CR, 2) - 1)) $bStream = BinaryMid($bStream, $iEOH + 4) EndIf If $iImgLen = 0 Then ContinueLoop $iStreamLen = BinaryLen($bStream) If $iStreamLen < $iImgLen Then ContinueLoop If Not $blGUIMinimized Then $hBMP = Load_BMP_From_Mem($bStream) $hHBITMAP2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP) _WinAPI_DeleteObject(_SendMessage($hPic, $STM_SETIMAGE, 0, $hHBITMAP2)) _GDIPlus_ImageDispose($hBMP) _WinAPI_DeleteObject($hHBITMAP2) EndIf $iImgLen = 0 WEnd _GDIPlus_Shutdown() TCPCloseSocket($iSocket) TCPShutdown() Func WM_SYSCOMMAND($hWnd, $iMsg, $wParam, $lParam) Local Const $SC_MINIMIZE = 0xF020, $SC_RESTORE = 0xF120 Switch BitAND($wParam, 0xFFF0) Case $SC_MINIMIZE, $SC_RESTORE $blGUIMinimized = Not $blGUIMinimized EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_SYSCOMMAND Func Load_BMP_From_Mem($mem_image) ;author: UEZ ;Additional Code: thanks to progandy for the MemGlobalAlloc and tVARIANT lines If Not IsBinary($mem_image) Then Return SetError(1, 0, 0) Local Const $memBitmap = Binary($mem_image) Local Const $len = BinaryLen($memBitmap) Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) Local Const $pData = _MemGlobalLock($hData) Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) DllStructSetData($tMem, 1, $memBitmap) _MemGlobalUnlock($hData) Local $hStream = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) $hStream = $hStream[3] Local $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) $hBitmap = $hBitmap[2] Local Const $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _ "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) $tMem = 0 Return $hBitmap EndFunc ;==>Load_BMP_From_MemBr, FireFox. Edited August 8, 2013 by FireFox Link to comment Share on other sites More sharing options...
gcue Posted August 8, 2013 Author Share Posted August 8, 2013 works great! thank you again!!! Link to comment Share on other sites More sharing options...
FireFox Posted August 8, 2013 Share Posted August 8, 2013 Glad to be of service Link to comment Share on other sites More sharing options...
gcue Posted August 9, 2013 Author Share Posted August 9, 2013 (edited) if the camera does require authentication.. how do i pass username and password.. i see your example only passes 1 variable $sauth "Authorization: Basic " & $shtauth & @CRLF & @CRLF) i tried $shtauth = "user:pass" but that didn't work Edited August 9, 2013 by gcue Link to comment Share on other sites More sharing options...
FireFox Posted August 9, 2013 Share Posted August 9, 2013 You need to base64 encode the "user:pass". Link to comment Share on other sites More sharing options...
gcue Posted August 9, 2013 Author Share Posted August 9, 2013 strange - i tried it but didnt work - is there an error i can capture? used this encoder '?do=embed' frameborder='0' data-embedContent>> Link to comment Share on other sites More sharing options...
FireFox Posted August 9, 2013 Share Posted August 9, 2013 Base64 is not related to AutoIt, so you don't have to use an UDF for it. http://www.motobit.com/util/base64-decoder-encoder.asp Link to comment Share on other sites More sharing options...
gcue Posted August 9, 2013 Author Share Posted August 9, 2013 i know. but the one i sent you a link for works - i checked it against another online tool. i just liked the autoitscript so i can keep it for future use. =) Link to comment Share on other sites More sharing options...
FireFox Posted August 9, 2013 Share Posted August 9, 2013 If you encode "user:pass" you will have :$shtauth = "dXNlcjpwYXNz"In case you have == at the end, don't strip it.If it does not work, capture the request sent by Chrome under the network tab of the developer tools.Br, FireFox. Link to comment Share on other sites More sharing options...
gcue Posted August 9, 2013 Author Share Posted August 9, 2013 yes i am sending the credentials correctly. If it does not work, capture the request sent by Chrome under the network tab of the developer tools. not sure what you mean Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now