So, if you're watching Game of Thrones or listening to Katy Perry you can tell your friends, and they can listen to a snippet of the song in their news feeds or see a link to the TV show's Facebook page.

Facebook has partnered with music streaming companies Spotify, Rdio and Deezer to develop a database of millions of songs that can be identified and matched in just a few seconds, Facebook product manager Aryeh Selekman told Business Insider when he demonstrated the new feature for us. Once the audio is identified it can be incorporated into a status update. Other users will be able to click through to either Spotify, Rdio or Deezer (depending on which app they use) if they want more.

The feature appears to be a threat to Shazam, the app that specializes in listening to ambient music and identifying the song for you, because it lets users identify songs that are playing in the same room simply by opening Facebook and tapping the "smiley face" that launches a new post. Users are much more likely to have Facebook open on their phones at any given time than Shazam.

In the test we witnessed at Facebook's New York office, Facebook's music matches occurred much faster than Shazam's. (Of course, we had the slight advantage of being inside a quiet office.) Each "listen" has a 15-second timeout — so the function takes less time than that to figure out which song you're listening to.

The new feature will also be closely watched at Twitter, which has positioned itself as the perfect accompaniment to TV-watching. By actively matching TV shows into a Facebook post — even live news and sports — Facebook has made it a lot easier and richer for users to chat and post about TV than it was before.

The new music and TV matching icon.Facebook

The feature was developed out of an existing function inside Facebook called feeling and activity sharing. When you begin a status update, the text box offers users a "smiley face" button to augment the post. Inside the smiley face, users get a bunch of stock choices and shortcuts for posts, such as "Reading," "Drinking" or "Listening to." Until now, those posts simply offered likely lists of popular stuff that other Facebook users had written about. People have used those shortcuts five billion times since the feature was launched in 2013.

Now, the Listening and Watching sections will actively detect what media you're consuming and provide a snippet to add to your status.

We're told the function works by translating the audio being played into a code, and then matching that code against the databases held by Spotify, Rdio and Deezer. Facebook is still building that database, so it will be a while before it's as comprehensive as Shazam's. And yes, the data generated by each match will become available as targeting information for advertisers, something that Facebook already does when you express interest in a band.

The new function will be rolled out periodically by geography.

Here's how to use it.

First, create a new status update. You'll get this menu (below). Hit the smiley face:

BI

Here's what it looks like when you're first given the option to switch it on. It's off by default:

Facebook

The animated blue bars on the right side show that Facebook is "listening" for a match to any music or TV you might be playing. (Matching is off on the right-hand phone.)

Facebook

If you incorporate a music or TV match into a status update, it will look like this (below). Your friends will be able to play a 30-second sample of the song on Spotify: