Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff -urN a/angular-soundmanager2.js b/angular-soundmanager2.js
--- a/angular-soundmanager2.js 2020-05-26 21:48:08.087450000 +0800
+++ b/angular-soundmanager2.js 2020-05-26 21:43:44.671350400 +0800
@@ -6360,7 +6360,6 @@
multiShot: false, // let sounds "restart" or "chorus" when played multiple times..
multiShotEvents: false, // allow events (onfinish()) to fire for each shot, if supported.
onid3: null, // callback function for "ID3 data is added/available"
- onload: null, // callback function for "load finished"
onstop: null, // callback for "user stop"
onfailure: 'nextTrack', // callback function for when playing fails
onpause: null, // callback for "pause"
@@ -6409,6 +6408,19 @@
}
$rootScope.$broadcast('track:id', currentTrack);
}
+ },
+ onload: function(success) {
+ if(success == false) {
+ soundManager._writeDebug(this.id + " load failed, play next.");
+ //get your angular app
+ var elem = angular.element(document.querySelector('[ng-app]'));
+ //get the injector.
+ var injector = elem.injector();
+ //get the service.
+ var angularPlayer = injector.get('angularPlayer');
+ // repeat current track
+ angularPlayer.nextTrack();
+ }
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.