MAP user stream

Hi Aron
How to make a map with stream users? :slight_smile:

Your content delivery network will have to give you either the IP of watchers or the location information you want. Google does this in insights, but they might not have this available in realtime.

One other way is using Twitch Extensions, like this one:

It works by looking up the user’s location based on IP and sending that over the chat network to calculate the total.

Both of these solutions work on geoip technology which is not always accurate.

The way I do it is ask people to type the name of the city they’re in! Low tech hack. Then I run that through the google maps geocoder to find the location to drop the pin on the map.

This still needs some work to make it easier to set up, but the code is all public!

1 Like

Thank YOU ! :grinning: :grinning: :grinning: :grinning: :grinning: :grinning: :grinning: :grinning: :grinning: :grinning: :grinning:

Hey Aaron. I saw on GitHub that you welcomed more instructions to get the chat world map running. I spent about 4 hours and I got 99% done and I have documented it all. BUT the last 1% is actually showing the pin on the map.
Ran into tons of issues with php, compose, billing on maps api , but I got all solved, but the last piece. Just putting the pin on the map, that doesn’t work. I see the yt and google map apis getting the queries, some of the maps api request shows errors, and some don’t. clear request. but the pin never gets placed on the map. Any idea how I can troubleshoot this? if I get this figured out I can submit my install doc to GitHub

Thanks! That’s super weird that you’re getting that error if you’ve come this far already.

One thing comes to mind to double check… it expects to be able to write a file, so make sure the web server user has permissions to write to at least the log folder in the project. I’m guessing if that throws an error it might make everything else fail.

Do you see any helpful information in the javascript console? If there’s an error message there I might be able to dig further.

I have a live today, I will give it a try. Maybe it’s something to do with the maps api? I don’t even know if I chose the correct one. it seems to have a cost to it…
I didn’t see anything on the js console either.
I will try again later today and report back. I will share my instructions too in case you want to adapt and post somewhere?

so I uninstalled everything and started fresh. I notice I get a bunch of php dependencies errors when I run composer install. which is strange (and I don’t know jack about php), is that it says it needs ^7.1 version but mine is 8.1.5…
here is an example of the error, I get like 20 of these after running composer install

  • doctrine/instantiator is locked to version 1.3.0 and an update of this package was not requested.
    • doctrine/instantiator 1.3.0 requires php ^7.1 → your php version (8.1.6) does not satisfy that requirement.

oh gosh, yeah I probably need to do some fixes to make it work in PHP 8.1. Sorry for the trouble!

Yeah maybe. I renamed the composer.lock and I was able to install it. but still no success.
It’s close but I don’t know what else to try :slight_smile: I checked the permissions too. Nothing shows up on the log folder.
I see the hit count increasing with every city that is typed in the chat, but nothing comes back to the webpage. And I noticed too, when I enter the URL on the php webpage, it accepts the live url, but the box to enter the url never goes away. so maybe something else is funky with the set-active-video.php

But hey nothing for you to apologize for, it has been fun trying to get this going and learning a little bit about oauth, api key and php , albeit I probably just learnt 0.1% :slight_smile:

If you ever need a tester for a new version or something please let me know, it think this map is one of the coolest things I have ever seen. right up with h2r stuff.