我有一個與SoundCloud API集成的Web應用程序,用於搜索和播放曲目。我可以成功地通過使用SoundCloud oEmbed的API流軌道,像這樣:SoundCloud API:使用oEmbed指定播放曲目的開始和停止時間
scope.playTrack = function(track) {
SC.oEmbed(track.permalink_url, { auto_play: true })
.then(function(oEmbed) {
scope.soundCloudWidget = $sce.trustAsHtml(oEmbed.html);
scope.$apply();
});
};
綁定到該視圖的部件:
<div ng-bind-html="soundCloudWidget"></div >
這是按預期工作。我的問題是我想以這種方式流式播放曲目,但是使用指定的開始和結束時間。我做了一些研究,發現一個看似相關StackOverflow question/answer是提到一個可以:
追加#t=12s
聲音的URL在第12屆第二
構造URL就像當這工作啓動它:
https://soundcloud.com/griz/summer-97-ft-muzzy-bearr#t=54s
然而,對於start = '54s'
我願做這樣的事情
scope.playTrackSection = function(track, start) {
SC.oEmbed(track.permalink_url, { auto_play: true, t: start })
.then(function(oEmbed) {
scope.soundCloudWidget = $sce.trustAsHtml(oEmbed.html);
scope.$apply();
});
};
或
scope.playTrackSection = function(track, start) {
var url = track.permalink_url + "#t=" + start;
SC.oEmbed(track.permalink_url, { auto_play: true })
.then(function(oEmbed) {
scope.soundCloudWidget = $sce.trustAsHtml(oEmbed.html);
scope.$apply();
});
};
,但無濟於事。 是否有任何可能的方式來指定這種類型的上下文中的開始時間?
獎勵積分:還有什麼方法可以指定播放歌曲停止播放的時間或時間?