Reading output audio data from Spotify Web Playback stream

拥有回忆 提交于 2020-01-21 09:21:12

问题


I am currently playing around with audio visualization and I am trying to work with Spotify's Web Playback SDK to stream and analyze songs directly on my site.

However, I am unsure what the limitations are when it comes to actually reading the streamed data. I've noticed that an iframe is generated for the Spotify player, and I've read that spotify uses the encrypted media extensions to stream the audio on chrome.

Is it even possible to read the music data from the Spotify api? Maybe, I can read the output audio from the browser?


回答1:


According to the web API documentation, you aren't able to play back full songs and get the audio data like you desire (for obvious reasons). Although, 30 second "song previews" are allowed through URL streaming, as well as full song playback on desktop browsers (excluding safari at the time of this post), with the Web Playback SDK.

However on the mobile API it is now possible to get the raw PCM data (Android or iOS). This will require you registering for a developers account and setting up the access tokens if you haven't already done so.

For quick reference, on Android it involves using the AudioController class.

EDIT : Thanks to @Leme for the Web Playback SDK link.



来源:https://stackoverflow.com/questions/51014022/reading-output-audio-data-from-spotify-web-playback-stream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!