Is it possible to get Nest camera live stream via getPublicShareUrl? What about LastEvent Information


#1

I’m working on an integration project with Nest camera using android SDK, the platform needs nest camera live stream and LastEvent information. Web_url and App_url are not good choices for us.
I noticed that in Camera.java from SDK. There is a getPublicShareUrl (which needs to be enabled) and LastEvent class( which needs to has Nest Aware).
First question: Is it possible to get live stream through getPublicShareUrl when enabled.
Second question: How can I access the LastEvent information after I have a Nest Aware


#2

Please check out the camera guide.

https://developers.nest.com/documentation/cloud/camera-guide

LastEvent will appear for cameras with Nest Aware subscription enabled, including during the initial trial period.

public_share_url provides the same link as when a user makes their video public.


#3

Thank you for your response.
But when I’m trying obtain information from camera LastEvent. I can’t. Because the static nested class LastEvent in Camera.java is not public. I cannot access it outside the SDK package.
I’m asking if there is a way to access the LastEvent nested class. Because I’m trying to implement notification through Nest camera.


#4

This test class has examples of the LastEvent API. It imports the camera class and gets the LastEvent from it.

import com.nestlabs.sdk.models.Camera;

Camera.LastEvent lastEvent = camera.getLastEvent();

lastEvent.getHasSound()
lastEvent.getHasMotion()
lastEvent.getStartTime()
lastEvent.getEndTime()
lastEvent.getUrlsExpireTime()
lastEvent.getWebUrl()
lastEvent.getAppUrl()
lastEvent.getImageUrl()
lastEvent.getAnimatedImageUrl()
lastEvent.getActivityZoneIds()


#5

I’m trying to access it through my app, which is another package. And I can’t access the LastEvent class since it’s not public.

I’m wondering if you guys can fix it. Sorry for the late response.


#6

Hi, can you paste some of your code here (or message us) and we can see if we can provide any suggestions using the Camera class to access the LastEvent class.


#10

Yes, thank you.

In my code, I directly use

**package com.nestlabs.sdk.sample;**

as my package, and import

**import com.nestlabs.sdk.models.Camera;**

and I’m trying to use Camera.LastEvent in order to get person, audio information

private void updateVideoRange() {

      if (current_camera == null) {
              Toast.makeText(getApplicationContext(), “No Camera available”, Toast.LENGTH_SHORT).show();
                return;
     }

     Camera.LastEvent lastEvent = current_camera.getLastEvent();

     if(current_camera.isStreaming() && camera_changed == true) {

         cameraRealTimeVideo.setVideoURI(Uri.parse(current_camera.getPublicShareUrl()));
         cameraRealTimeVideo.setMediaController(cameraController);
         cameraController.setMediaPlayer(cameraRealTimeVideo);

         camera_changed = false;
     }
}

But I can’t, because I’m not in the com.nestlabs.sdk.models package. And I got an error:

**error: LastEvent is not public in Camera; cannot be accessed from outside package**

Could you guys change the LastEvent class to public in android SDK? If not, how can I access the lastevent information?


#11

Sorry about that, I see what you mean. Can you please see if you can change it on your local version and then submit a pull request for this for the SDK? Thank you!


#12

Wanted to follow up with this to let you know it’s been updated on github, and you shouldn’t get this error when you get the latest version. Thanks again for reporting it, and please let us know if you run into any further issues.