colthreepv / colthreepv/angular-media-player
selectivePlay behaving unexpectedly
- Dominant language
- JavaScript
- Stars
- 228
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for creating this great plugin! I'm trying to make a page that allows users to play songs in an album. They have the option of either 'Playing All' or playing individual songs one at a time.
I've uncovered some unexpected behaviour:
1 I bind a playlist to the player in my template (using data-playlist) and load an album with 2 or more songs
2 I click the play all button which calls play(0, false) to signal the audio player to start on the first track (0) and play through all tracks (select play = false)
All songs play as expected
3 Click play next to the second song which calls play(1,true) to signal to the audio player to start at the indicated track (1) and only play that one track (select play = true)
Only the selected song plays, as expected
4 Now click Play All again which will again call play(0, false)
For some reason, the audio player now stops after playing the first track and no matter what I try I can't get it to 'Play All' again without reloading the page.
Any suggestions on how to get play(0, false) to always play through all items in the playlist? I've debugged and confirmed that the playlist isn't getting reset so I'm not sure what's causing the issue.
Any suggestions would be much appreciated, thanks!
Angular Controller:
```
.controller('albumsPublicDetailController', ['$scope', '$routeParams', 'albumsService',
function($scope, $routeParams, albumsService)
{
$scope.audioPlayer = {};
$scope.playlist = {};
// STUCK HERE - Need to find a way to get playAll to reset the playlist and playSong to play just the current song
$scope.playAll = function () {
debugger
$scope.audioPlayer.play(0, false);
};
$scope.playSelected = function (index) {
debugger
$scope.audioPlayer.play(index, true);
};
$scope.pauseSong = function () {
$scope.audioPlayer.pause();
};
$scope.playSong = function () {
$scope.audioPlayer.play();
};
albumsService.publicShow($routeParams.albumId)
.success(function(data) {
$scope.playlist = _.map(data.songs, function(song){ return {
src: song.file.fileUrl,
type: song.file.fileType,
name: song.title };
});
$scope.album = data;
});
}]);
```
HTML Template:
```
Title: {{album.title}}
Date: {{album.date}}
Description: {{album.description}}
Play All
Pause
Play
Songs
Play
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.