如何使用Web Playback SDK从特定的分钟和第二秒开始播放曲目?

时间:2018-10-10 11:39:44

标签: javascript spotify

任何人都知道如何使用Web Playback SDK从特定的分钟和第二秒开始播放曲目?

  

示例:从00:44开始Spotify:track:20zCnBjK6aIgvvy66qZ7RV。

是否有将该信息添加到Spotify URI的方法? 这是代码,

play({
  spotify_uri: 'spotify:track:20zCnBjK6aIgvvy66qZ7RV',
  playerInstance: player,          
});

谢谢!

1 个答案:

答案 0 :(得分:0)

您只需要在您的uri末尾添加#0:44。从https://community.spotify.com/t5/Desktop-Windows/Playlist-with-quot-start-at-specific-time-quot-function/td-p/1547529

获得的信息
play({
  spotify_uri: 'spotify:track:20zCnBjK6aIgvvy66qZ7RV#0:44',
  playerInstance: player,          
});

如果这不起作用,请尝试:

play({
      spotify_uri: 'spotify:track:20zCnBjK6aIgvvy66qZ7RV',
      playerInstance: player,
      position_ms: 44000
    });

基于https://developer.spotify.com/documentation/web-api/reference/player/start-a-users-playback/