Where is the documentation for Jam Cams?

Can’t find anything useful here? https://api-portal.tfl.gov.uk/docs

Would be great if there’s documentation you could provide, or even an endpoint + example URL to access a video feed for a random camera.

Thanks! Excited to build something useful!

1 Like

Hello

Check out this blog for information on accessing the Jam Cams:
https://blog.tfl.gov.uk/2015/11/18/unified-api-part-4-roads-data/

Here’s a static image from “Westminster Bridge/Waterloo Road”:

In addition to static images there’s also a short video clip available from some cameras:

Regards

Joe

This end point lists all the JamCams:

https://api.tfl.gov.uk/Place/Type/JamCam

1 Like

umaar,

Here’s my simple PHP class to do what you ask…

class RamdomJamcamTfl
{
const SOURCE = "https://api.tfl.gov.uk/Place/Type/JamCam";
private $objJamCams = [];

public function __construct()
{
    // json_decode(file_get_contents()) - takes the remote content and loasds it directly into an object. 

    $this->objJamCams = json_decode(file_get_contents(self::SOURCE));
}

public function viewRandomCamera()
{
    // Call me to get a picture.  

    echo html::img($this->pickRandomCameraURL());
}

  private function pickRandomCameraURL($strFindType = "imageUrl")
{
    $intRandom = rand(0, count($this->objJamCams) - 1);
    foreach ($this->objJamCams as $jamCam) {
        foreach ($jamCam->additionalProperties as $additionalProperty) {
            if ($intRandom == 0) {
                if ($additionalProperty->key == $strFindType) {
                    $strFoundURL = $additionalProperty->value;
                }
            }
        }
        $intRandom -= 1;
    }
    return $strFoundURL;
}


}

I’m calling it this way,

            $ramdomJamcamTfl = new RamdomJamcamTfl();
            $ramdomJamcamTfl->viewRandomCamera();

There are other ways to pick a random item. If you wanted several images it would be better to use a shuffle function.

Thanks so much everyone! I see it now. Was thinking to make a timelapse visualistion of some sort but I see we can only view segments of 9 seconds at fixed points every ~5 minutes?

Guess this is done to minimise storage costs, wonder if there’s a real time stream anywhere?

1 Like

Hi,

I think you will find that the jam-cams are of such vintage that they comprise a true closed-circuit television system. I would venture that the terrible resolution (CIF 352x288), the aspect ratio (4:3) would suggest that they are all being brought by a traditional (perhaps even analogue) CCTV system and then being round-robin sampled and then uploaded from the control centre to an S3 bucket on AWS.

It is very unlikely that the cameras are sitting on the (public) internet, much less they are connected in a way to also provide live feed to multiple users. This would mean using something like Live Streaming | AWS Solutions

Thanks for your insight, yeah sounds like you’re correct!

1 Like