Spotify 00:00:01 The song begins before the whole track has arrived A commuter taps Play just before the train leaves the station. This illustrative Spotify-style music service separates permission to hear a track, the manifest that locates media, and the bytes that actually become sound. The app sends the track and its device. The gateway checks the signature of the token itself. Redis holds the list of pieces at four bitrates, with forty-five pieces for a three-minute, forty-two-second track. The example returns eligible media representations and a scoped delivery authorization. About 100 ms of the budget are spent. The player requests the first piece from the delivery edge selected for the session. The API's reply alone cannot guarantee uninterrupted audio. Measure initial playback, subsequent segment delivery and buffer level independently. An asynchronous listening event should not block the first audible notes. 00:00:54 Keep the chorus playing through the tunnel The train loses bandwidth while a song is already playing. The client has a few seconds of audio saved. Compare the next piece's estimated fetch time with that remaining buffer before changing quality. Nothing is in the buffer. A short piece at 96 makes sound quickly. Only two seconds are ready, so take the lowest rate: it arrives almost at once. Another 320 piece was asked for, and then the line dropped. It takes 10.7 seconds, and the buffer pays. With five and a half seconds buffered, the illustrative rule budgets seventy percent of a hundred fifty kilobits per second, or a hundred five, before choosing a representation. The measurement is still the old one: 96 for one more piece. The new measurement allows 320. A lower bitrate spends fewer bytes on the same time interval. Increase quality cautiously once conditions recover. A safety margin and smoothing help avoid oscillating on the strength of one fortunate measurement. 00:01:54 A weekly mix begins long before Monday A playlist recommendation has a different latency budget from pressing Play. An offline job can build candidates from listening behavior, then spend more work ranking and diversifying a shortlist for later retrieval. One group of time zones at a time, some days ahead. Each listener becomes numbers, for example 256, from who-plays-what, sound and text. An approximate nearest-neighbour index returns about a thousand tracks that similar listeners like. Filter ineligible tracks and recently heard material under the example's playlist policy. Not five songs of one artist, not thirty slow ones. The mix waits in a table. A notification goes out at a kind local hour. Apply eligibility and availability again where needed. The most similar track cannot be served if the listener has blocked it or the service lacks rights for that territory. 00:02:48 What does downloading for offline playback really store? The commuter wants the album tomorrow with no signal. A local copy of encrypted content and permission to decrypt it are different requirements. Check the plan, device and applicable playback rules before promising offline use. 47 tracks at 320 kbit/s, 9.6 MB each: 451 MB. The app checks space first. The license service checks the configured subscription and device conditions for this offline request. Keys for these tracks, bound to this device, for 30 days. Three at a time, most wanted first. The edge has these files already, for other people. Retain enough metadata to check freshness and renewal policies. A later connectivity failure should not make the player's behavior mysterious. Test both a valid offline license and one that has genuinely expired. 00:03:43 Move playback from headphones to a speaker Back home, the commuter transfers the song to a speaker. Audio bytes do not have to travel through the phone if the receiving device can establish its own authorized playback session. Each device holds a connection and a short lease. The phone plays, version 17. The listener picks the speaker. 17 is still current, so 18 is stored with the speaker as active. The speaker receives the track, position forty-five seconds, and version eighteen. It is already signed in, so it can fetch the next piece immediately. The phone is told, but nobody waits for it. Keep track identity, position and active device state coherent during handoff. If a notification is missed, recover from the authoritative session snapshot. Buffering, personalization and device coordination are three distinct paths through one music product.