I am using LiveKit Cloud in my project. I have a w...
# ask-ai
s
I am using LiveKit Cloud in my project. I have a web application that only supports voice calls. All participants are located in India. I noticed that in the LiveKit Cloud dashboard, participant locations are sometimes marked as “unknown,” so the region is set to US West or US East. Can we specify the “location” value when creating a room?
t
Thanks for reaching out, Osman. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Just a heads-up: when you're creating a room in LiveKit Cloud, you can't specify the "location" value. The room creation options include things like name, empty_timeout, departure_timeout, max_participants, metadata, and egress, but "location" isn't one of them. If you're running into issues with participant locations or the "unknown" location problem, feel free to reach out—I'm here to help and can guide you through it!
s
Yes, I am experiencing an “unknown” problem related to the location of participants. How can I fix this?
t
Hey there! To help you sort out the "unknown" participant location issue in LiveKit Cloud, here are some friendly steps you can follow: 1. Enable Location Services: Make sure your participants have allowed geolocation permissions in their browser settings. Without this, we just can’t get their location. 2. Implement Geolocation in Your Application: Use the Geolocation API to ask for the participant's location. Here’s a simple example to get you started:
Copy code
navigator.geolocation.getCurrentPosition(
    (position) => {
        console.log("Latitude:", position.coords.latitude);
        console.log("Longitude:", position.coords.longitude);
    },
    (error) => {
        switch (error.code) {
            case error.PERMISSION_DENIED:
                console.log("User denied location request.");
                break;
            case error.POSITION_UNAVAILABLE:
                console.log("Location information is unavailable.");
                break;
            case error.TIMEOUT:
                console.log("The request to get user location timed out.");
                break;
            case error.UNKNOWN_ERROR:
                console.log("An unknown error occurred.");
                break;
        }
    },
    { enableHighAccuracy: true, timeout: 5000 }
);
1. Handle Geolocation Errors: It’s a good idea to give clear feedback if something goes wrong, like if permission is denied or the request times out. You might also want to try again automatically. 2. Use High Accuracy: Turning on high accuracy in your geolocation requests can really help get more precise location info. 3. Check Browser Support: Double-check that the browser your participants are using supports the Geolocation API and that it’s switched on. Give these a try, and hopefully, the "unknown" location issue will be a thing of the past. If you hit any snags or want a hand with any of this, just let me know—I’m here to help!