从Spotify Web播放流读取输出音频数据 [英] Reading output audio data from Spotify Web Playback stream

查看:87
本文介绍了从Spotify Web播放流读取输出音频数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用音频可视化,并且正在尝试使用Spotify的Web Playback SDK来直接在我的网站上流式播放和分析歌曲.

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.

但是,我不确定实际读取流式数据时的局限性.我注意到为Spotify播放器生成了一个iframe,并且我读到Spotify使用加密的媒体扩展名在chrome上流式传输音频.

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.

是否甚至可以从Spotify api中读取音乐数据?也许我可以从浏览器中读取输出的音频?

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

推荐答案

根据 webAPI文档,您将无法播放完整的歌曲并无法获得所需的音频数据(出于明显的原因).尽管通过URL流以及在台式机浏览器中播放完整的歌曲(本文发布时的野生动物园除外)允许30秒的歌曲预览",但使用

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.

但是,现在可以在移动API上获取原始PCM数据( Android iOS ).这将要求您注册开发者帐户并设置访问令牌(如果尚未这样做的话).

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.

为了快速参考,在Android上,它涉及使用 AudioController 类.

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

编辑:感谢@Leme提供的网络播放SDK 链接.

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

这篇关于从Spotify Web播放流读取输出音频数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆