Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does SoundCloud pause other tabs?

If you have two browser tabs open to a Soundcloud page, or a page with a Soundcloud iFrame, with one tab playing, when you press play in the other tab it will pause the first. Howe exactly is this achieved?

like image 714
Zack Avatar asked Jan 30 '14 01:01

Zack


1 Answers

It uses local storage to achieve this. It stores JSON data of all the songs that have played or been paused in each of your tabs. As soon as you play another song, all of the other songs' playing statuses are set to paused inside local storage. Most likely, a localStorage event is triggered which checks which songs need to be paused and pauses them.

Soundcloud local storage viewed in Chrome

like image 64
danronmoon Avatar answered Sep 28 '22 04:09

danronmoon