如何在 spotify api 上播放完整的歌曲?
Posted
技术标签:
【中文标题】如何在 spotify api 上播放完整的歌曲?【英文标题】:How to play full of songs on spotify api? 【发布时间】:2015-08-20 14:57:17 【问题描述】:我只播放预览(0:30),但我想播放完整的歌曲(3:10)。 我尝试了一些方法,但没有成功。它也在播放预览 怎么播放满的歌曲呢?
mediaplayer 是 MediaElement。
mediaplayer.Source = new Uri("https://api.spotify.com/v1/tracks/4pn0G7yHNfTgRYRWca8gYA",UriKind.RelativeOrAbsolute);
or
mediaplayer.Source = new Uri(Stream_url.preview_url.ToString(), UriKind.RelativeOrAbsolute);
"href" : "https://api.spotify.com/v1/tracks/4pn0G7yHNfTgRYRWca8gYA",
"href" : "https://api.spotify.com/v1/albums/60mvULtYiNSRmpVvoa3RE4/tracks?offset=0&limit=50",
"items" : [
"artists" : [
"external_urls" :
"spotify" : "https://open.spotify.com/artist/0TnOYISbd1XYRBk9myaseg"
,
"href" : "https://api.spotify.com/v1/artists/0TnOYISbd1XYRBk9myaseg",
"id" : "0TnOYISbd1XYRBk9myaseg",
"name" : "Pitbull",
"type" : "artist",
"uri" : "spotify:artist:0TnOYISbd1XYRBk9myaseg"
,
"external_urls" :
"spotify" : "https://open.spotify.com/artist/2DlGxzQSjYe5N6G9nkYghR"
,
"href" : "https://api.spotify.com/v1/artists/2DlGxzQSjYe5N6G9nkYghR",
"id" : "2DlGxzQSjYe5N6G9nkYghR",
"name" : "Jennifer Lopez",
"type" : "artist",
"uri" : "spotify:artist:2DlGxzQSjYe5N6G9nkYghR"
,
"external_urls" :
"spotify" : "https://open.spotify.com/artist/2OjoIDVPQKT9B7loZbPEfp"
,
"href" : "https://api.spotify.com/v1/artists/2OjoIDVPQKT9B7loZbPEfp",
"id" : "2OjoIDVPQKT9B7loZbPEfp",
"name" : "Claudia Leitte",
"type" : "artist",
"uri" : "spotify:artist:2OjoIDVPQKT9B7loZbPEfp"
],
"available_markets" : [ "AD", "AR", "AT", "AU", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "ES", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "MC", "MT", "MX", "MY", "NI", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ],
"disc_number" : 1,
"duration_ms" : 222466,
"explicit" : false,
"external_urls" :
"spotify" : "https://open.spotify.com/track/4pn0G7yHNfTgRYRWca8gYA"
,
"href" : "https://api.spotify.com/v1/tracks/4pn0G7yHNfTgRYRWca8gYA",
"id" : "4pn0G7yHNfTgRYRWca8gYA",
"name" : "We Are One (Ole Ola) [The Official 2014 FIFA World Cup Song]",
"preview_url" : "https://p.scdn.co/mp3-preview/4e6c03963fa6a6720648540282afc75f4df744c9",
"track_number" : 1,
"type" : "track",
"uri" : "spotify:track:4pn0G7yHNfTgRYRWca8gYA"
],
"limit" : 50,
"next" : null,
"offset" : 0,
"previous" : null,
"total" : 1
【问题讨论】:
目前看来不可能。 ***.com/questions/24705253/… 【参考方案1】:在提出这个问题的时候,还没有办法在网络上播放完整的曲目。对于那些在未来看到这个的人,您现在可以使用 Web Playback SDK!
https://beta.developer.spotify.com/documentation/web-playback-sdk/
Web Playback SDK 是客户端 javascript 库,可让您在 Spotify Connect 中创建新播放器,并通过加密媒体扩展在浏览器中播放来自 Spotify 的任何音轨。这与我们用来增强网络播放器体验的技术相同。
您可以使用 Web Playback SDK 做一些事情:
在 Spotify Connect 中创建新播放器 在支持的浏览器中流式传输音轨 获取当前曲目的元数据 获取有关用户收听会话的元数据 控制本地播放(暂停、恢复、音量等)黑客愉快!
【讨论】:
以上是关于如何在 spotify api 上播放完整的歌曲?的主要内容,如果未能解决你的问题,请参考以下文章
在 iPhone 上使用 API 无需登录即可Spotify 播放歌曲