Web サイトの音楽ページ内で、SoundCloud API から取得したお気に入りの曲を再生する音楽コンポーネントがあります。
{{soundcloud-player favorite=currentFavorite sound=currentFavoriteObject position=currentFavoritePosition isPlaying=isPlaying isBuffering=isBuffering}}
問題は、曲を再生してウェブサイトのページ(ルート)を変更すると、曲が再生され続けるため 、ページisPlaying
false
の音楽を変更するたびに設定する必要がroute
あることです。
それを達成するにはさまざまな方法があることがわかりますが、私の場合はわかりません
ミが試みる
別のコントローラーから
needs:'player',
desactivateIsplaying: function(){
var controller = this.get('controllers.player');
controller.set('isPlaying', false);
}
または別のルートから
desactivateIsPlaying: function(){
var controller = this.controllerFor('player');
controller.set('isPlaying', false);
}
設定できない 2 つの関数のいずれかでisPlaying
false
、ルート アクションについても言及されていwillTransition
ますが、どのように使用できますか? それを行うより良い方法はありますか?必要に応じて、シナリオをよりよく再現するためにひねりを加えることができます