The API can be used in a variety of different contexts. The classic is usually to help control playback of video or audio, although it can be used with other APIs such as the Battery API, to prevent content being displayed at all if power levels are too low.
Let's take a moment to delve into some practical examples, so we can see how easy it is to implement the API.
One of the most common uses of the API is to control playback of audio or media such as videos. In our first example, we're going to use the API to play or pause a video when switching between tabs. Let's delve in and take a look.
For this demo, we'll use a couple of additional items – the Dynamic Favicons library this is available ...