UNPKG

ngx-soundmanager2

Version:
77 lines 1.92 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ export class MusicPlayerUtils { /** * * @param {?} track * @return {?} */ static IsTrackValid(track) { if (typeof track === 'undefined') { console.warn('invalid track data'); return false; } if (track.url.indexOf('soundcloud') > -1) { // if soundcloud url if (typeof track.url === 'undefined') { console.warn('invalid soundcloud track url'); return false; } } else { if (soundManager.canPlayURL(track.url) !== true) { console.warn('invalid song url'); return false; } } return true; } /** * getIndexByValue used by this service * @param {?} array * @param {?} value * @return {?} */ static GetIndexByValue(array, value) { for (let /** @type {?} */ i = 0; i < array.length; i++) { if (array[i] === value) { return i; } } return -1; } /** * To check if value is in array * @param {?} array * @param {?} value * @return {?} */ static IsInArray(array, value) { for (let /** @type {?} */ i = 0; i < array.length; i++) { if (array[i].id === value) { return i; } } return -1; } /** * asyncLoop * @param {?} o * @return {?} */ static AsyncLoop(o) { let /** @type {?} */ i = -1; const /** @type {?} */ loop = () => { i++; if (i === o.length) { o.callback(); return; } o.functionToLoop(loop, i); }; loop(); // init } } //# sourceMappingURL=music-player.utils.js.map