< All postsTwitterRSS GitHub

Jul 10 2018

Calling the world cup goals 5 seconds before they happen

It’s that time again where once every 4 years people get very hyped over kicking a ball around a grass pitch, however this time my own country is actually doing pretty well! At the time of writing we just beat Sweden and are now faced against Croatia!

This is the extent of my football knowledge and apparently this is a big deal.

Either way. I’ve been taken to sport this time because this is such fun to watch with friends and as a broadcast nerd i’ve been thinking: “How long is the delay between the stadium and broadcast?”

It turns out there is a delay forced into the broadcast for the use of betting companies and alike. The problem is that betting companies do not want people to rapidly place/cancel bets just after a goal or otherwise major events. The solution to this is to delay the broadcast by a few seconds and then another company called Running Ball (who got bought by Performa, who was a FTSE 250 company until they also got bought by Access Industries) comes into play. Running Ball provides a moderately detailed information feed about the state of the game. This feed is produced by people in the stadium annotating major events.

I found an UK betting site that exposed this information in full inside its HTML5 webapp. The API feed was impressively detailed on every event happening in a game.

Here is an example of the data the API provides: (In this example “away” is England, and “home” is Colombia)

{
  "away": {
    "attacks": 95,
    "corners": 7,
    "dangerous_attacks": 62,
    "goals": 4,
    "possession": 57,
    "shots_off_target": 10,
    "shots_on_target": 5,
    "substitutions": 4,
    "yellow_cards": 2
  },
  "home": {
    "attacks": 107,
    "corners": 2,
    "dangerous_attacks": 52,
    "goals": 5,
    "possession": 43,
    "shots_off_target": 7,
    "shots_on_target": 8,
    "substitutions": 4,
    "yellow_cards": 6
  },
  "last_incident": {
    "minute": 127,
    "period": "FINISHED",
    "side": "unknown",
    "type": "PERIOD_SCORE_CONFIRMED"
  },
  "minute": 127,
  "status": "FINISHED",
  "timeline": [
    {
      "minute": 6,
      "period": "1ST_HALF",
      "side": "away",
      "type": "corner"
    },
...
    {
      "minute": 53,
      "period": "2ND_HALF",
      "side": "away",
      "type": "corner"
    },
    {
      "description": "foul",
      "minute": 54,
      "period": "2ND_HALF",
      "player": "C. Sánchez",
      "side": "home",
      "type": "yellow_card"
    },
    {
      "description": "unsportsmanlike conduct",
      "minute": 56,
      "period": "2ND_HALF",
      "player": "J. Henderson",
      "side": "away",
      "type": "yellow_card"
    },
...
    {
      "description": "criticism",
      "minute": 63,
      "period": "2ND_HALF",
      "player": "R. Falcao",
      "side": "home",
      "type": "yellow_card"
    },
...
    {
      "minute": 81,
      "off": "D. Alli",
      "on": "E. Dier",
      "period": "2ND_HALF",
      "side": "away",
      "type": "substitution"
    },
...
    {
      "confirmed": true,
      "description": "penalty shootout",
      "minute": 127,
      "period": "PENALTY_SHOOTOUT",
      "player": "K. Trippier",
      "score": [
        4,
        4
      ],
      "side": "away",
      "type": "goal"
    },
    {
      "confirmed": true,
      "description": "penalty shootout",
      "minute": 128,
      "period": "PENALTY_SHOOTOUT",
      "player": "E. Dier",
      "score": [
        4,
        5
      ],
      "side": "away",
      "type": "goal"
    }
  ]
}

Full Version here

Since I had access to this API, I could poll it during the game and find out what the delay between the API and the freeview TV broadcast was.

This showed the feed to be at least 4 seconds ahead of the live TV broadcast, however it could even be up to 6 seconds ahead due to the fact that I was polling this API only once every 3 seconds to reduce possible overloading of the betting website backend and creating too much suspicion in logs.

The 4 seconds advantage is of course assuming the viewers are consuming a feed that is very close to real time (like live broadcast TV). If you are streaming online via a direct HLS stream, you may be up to 30 seconds late. If you are using a peer to peer stream to watch the game, you could be as much as a few minutes behind! It’s odd to know that online live streaming is rarely actually that live.

So the next time you watch a game, just remember that the goal you just saw on TV happened quite a while ago.