Closed Okazari closed 6 years ago
As i said, i found a weird way of doing what i want ... but i'm using all the thing i can hates to do so. I just trigger a click on the button after a timeout... which is really weird.
Hey @Okazari, what is the weird way of doing it? :-)
As i said, i used a $timeout and trigger a click (angular.element().click()) on the plangular play button. I finally made a custom solution instead of using plangular.
This seems to be working, haven't tested on mobile though and only for single songs.
if (src) {
resolve({ url: src, client_id: client_id }, function(err, res) {
if (err) { console.error(err); }
scope.$apply(function() {
scope.track = createSrc(res);
scope.play(scope.track.src);
if (Array.isArray(res)) {
scope.tracks = res.map(function(track) {
return createSrc(track);
});
} else if (res.tracks) {
scope.playlist = res;
scope.tracks = res.tracks.map(function(track) {
return createSrc(track);
});
}
});
});
}
under scope.track = createSrc(res);
I added scope.play(scope.track.src);
edit: for mobile, I did a simple mobile check
if (!isMobile) {
scope.play(scope.track.src);
}
Hi all, I just wanted to share to way I was able to implement autoplay, by using ng-init on a loading state wrapper.
<div plangular="https://soundcloud.com/jxnblk/plangular">
<div ng-if="track" ng-init="play()">
...
</div>
</div>
Hi !
Thanks for your angular way to use soundcloud api (i love your way of doing it !)
Anyway i'd like to automatically launch the player at the first load of my page (plangularPlayerService ? in the directive parameters "plangular-autoplay" ? "autoplay" ?).
I'll try to find a weird way to do so, but i'd really love to have a simple way to achieve that.
Thanks, Okazari