rvi / ONVIFCamera

Pod and example on how to connect to an ONVIF camera
MIT License
88 stars 18 forks source link

can not get streamURI #5

Closed fukemy closed 4 years ago

fukemy commented 6 years ago

Hello. Im using OnVif to get local camera stream uri First sorry for my silly question. but i dont know why I can not get streamUri for profile. First i got 3 profile like below:

[ONVIFCamera.ONVIFCamera.Profile(name: "MediaProfile_Channel1_MainStream", token: "MediaProfile000"), ONVIFCamera.ONVIFCamera.Profile(name: "MediaProfile_Channel1_SubStream1", token: "MediaProfile001"), ONVIFCamera.ONVIFCamera.Profile(name: "mcMediaProfile", token: "mcMediaProfile")]

But none of these can used to get streamUri, here is the log:

getStreamURI: ["Body": {
    Fault =     {
        Code =         {
            Value = "s:Sender";
        };
        Reason =         {
            Text = "Unknown Error";
        };
    };
}]

Then here is code to get streamURI:

let params = ["Protocol": "RTSP", "ProfileToken": token]

    performRequest(request: CameraRequest.getStreamURI(params: params), response: { (result) in
        print("getStreamURI: \(result)")
      guard let body = result["Body"] as? [String: Any],
        let response = body["GetStreamUriResponse"]  as? [String: Any],
        let mediaReceived = response["MediaUri"] as? [String: Any],
        let uriReceived = mediaReceived["Uri"] as? String else {
            uri(nil)
            return
        }

      self.streamURI = self.appendCredentialsToStreamURI(uri: uriReceived)
      self.state = .ReadyToPlay
      uri(uriReceived)
    })
rvi commented 6 years ago

Good question.. All the others services works as expected? Maybe you can set a breakpoint in the performRequest method to debug, you may have more informations.. Are you sure your camera is up to date?

fukemy commented 6 years ago

hello. i tested perform request from getservices -> Got the service "http://www.onvif.org/ver10/device/wsdl" -> get profile -> got 3 profile -> But 3 profile still can not get streamURI

the camera is

screen shot 2018-10-22 at 17 33 02

That is all informations that i have

rvi commented 6 years ago

You can try with this maybe, I noticed some differences depending on the camera: "http://www.onvif.org/ver20/device/wsdl"

fukemy commented 6 years ago

tks, i tested with onvif device management (C# window), it work normally. Can i ask a question: i saw onvif provide 7 camera profiles, so the function getCameraServices is for get all of 7 profiles? As u can see here: https://www.onvif.org/wp-content/uploads/2018/09/ONVIF_Profile_T_Specification_v1-0.pdf

fukemy commented 6 years ago

another, i am using https://github.com/mavris/MMLanScan to get all local network ip address, then based on mac address vendor i find ip camera. But it not work more in IOS >11. so sad :(

I saw the onvif device management (C#) can get all ip camera in local network, can u provide me some way to got it in IOS?

Thanks

rvi commented 4 years ago

Hi, you can probably find your answer online or on stackoverflow.