最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How does SoundCloud pause other tabs? - Stack Overflow

programmeradmin6浏览0评论

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?

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?

Share Improve this question asked Jan 30, 2014 at 1:08 ZackZack 6777 silver badges17 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 23

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.

发布评论

评论列表(0)

  1. 暂无评论