Android get snapshot of the PTZ Camera Stream - java

I have few PTZ Camera, each with it's own RTSP url.I want to get snapshot from the Camera Stream using the streaming url.
I have used Glide library to extract the thumbnail from url, but I had no luck so far.it says failed to load resources error.
Glide.with(context)
.load(rtsp_url)
.asBitmap()
.override(50,50)
.into(imageView);

Related

How to upload and receive an image to an API in Android Studio

I'm trying to implement an Android app that uploads an image taken by the user to an API which removes the image's background, and sends it back to the Users device.
Here is the API for more info. I'm trying to send a jpeg image and receive the image as a jpeg aswell.
The API docs state that the POST request has to be multipart/form. I don't have any experience on making API calls using Volley and was wondering if any one could help me figure out how to do it. Thanks in advance.

Can you open gallery when camera app is open to get images in android studio?

I'm working on an native android application in Java. I have already implemented camera functionalities that upload images to firebase storage when captured, but I expected that you could also open your gallery from the camera and upload those images like facebook messenger. Until now I have only found tutorials that separate camera and gallery with a menu that appears by clicking an add button.
Where gallery should normally be located in the camera application
Facebook messenger is implementing their own gallery, reading files probably from MediaStore.
If you want to open the gallery from your app and pick a picture you should launch an intent:
private val pickImageFromGallery = registerForActivityResult(ActivityResultContracts.GetContent()) {
uri: Uri? ->
uri?.let {
// handle the data here
}
}
Then launch the intent from a button click or something else:
pickImageFromGallery.launch("image/*")

Android Glide: Failed to load resource of Firebase Storage

I'm trying to display the image in CircularImageView stored in Firebase Storage, but glide gives me this error:
W/Glide: Load failed for gs://project-2d8i4.appspot.com/pictures/3HnfQSeBladDsD9sPEcKrhxJ6CB2 with size [1200x1200]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
The picture is saved in Firestore as:
"gs://project-2d8i4.appspot.com/pictures/3HnfQSeBladDsD9sPEcKrhxJ6CB2"
Binding to image view (uri = "gs://project-2d8i4.appspot.com/pictures/3HnfQSeBladDsD9sPEcKrhxJ6CB2"):
fun CircularImageView.bindProfilePicture(uri: String?) {
Glide
.with(this)
.load(uri)
.into(this)
}
Dependencies for glide:
implementation 'com.github.bumptech.glide:glide:4.12.0'
No answers in any posts helped me whatsoever. I hope someone could help me. Thanks.
The following URL:
gs://project-2d8i4.appspot.com/pictures/3HnfQSeBladDsD9sPEcKrhxJ6CB
Is indeed a file that is stored in Cloud Storage. Unfortunately, this URL is not recognized by Glide, as it is not a valid URL. To solve the problem you need to get the "download URL" rather than an URL that starts with gs://....
To get the actual download URL, please see the official documentation for:
How to create a reference to a file
And my answer from the following post:
How to get the download url from Firebase Storage?
To avoid cache as mentioned in comments, you can use these two along with glide call.
diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
Check here to use the glide to download from firebase url.

Take external content Uri of an image storage in device's memory

I'm working for an App Android on platform Android Studio.
I want to obtain the external content Uri of an image, in form of:
content://media/external/images/media
The image is stored in mem device. I've only the resource's path, in form of:
file://data/data/com.example.appName/files/myimage.png**
There is a method or function for doing that?

How to download an image on Android wear?

I have an ArrayList of Serialization objects on my handheld.
I found a solution to send it to my wearable device.
Can I send custom objects to Android Wear?
In my Object I have the URL of an image and in my handheld I am using Picasso to download the image from the URL (es in a ImageView).
Can I download the image in the wearable? (I think no).
Should I download all the images of the ArrayList in the handheld and send it putting them as assets in a DataMap?
You can't download images directly from the Wear as there's no direct internet access.
However you're on the right path by downloading images on mobile (e.g. using Picasso), then transferring them to the Wear via an Asset.
There's a tutorial with all the code required on how to send an image using an Asset in the Android training section:
https://developer.android.com/training/wearables/data-layer/assets.html

Categories