UNPKG

ang-music-player

Version:

Angular Music/Audio Player component for web applications. Easy and HIGHLY customisable.

594 lines (579 loc) 35.6 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common')) : typeof define === 'function' && define.amd ? define('ang-music-player', ['exports', '@angular/core', 'rxjs', '@angular/common'], factory) : (global = global || self, factory(global['ang-music-player'] = {}, global.ng.core, global.rxjs, global.ng.common)); }(this, (function (exports, i0, rxjs, common) { 'use strict'; var AngMusicPlayerService = /** @class */ (function () { function AngMusicPlayerService() { } return AngMusicPlayerService; }()); AngMusicPlayerService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AngMusicPlayerService_Factory() { return new AngMusicPlayerService(); }, token: AngMusicPlayerService, providedIn: "root" }); AngMusicPlayerService.decorators = [ { type: i0.Injectable, args: [{ providedIn: 'root' },] } ]; AngMusicPlayerService.ctorParameters = function () { return []; }; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function () { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); }; } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function (o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } }); }) : (function (o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } ; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; } ; var __setModuleDefault = Object.create ? (function (o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function (o, v) { o["default"] = v; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } var AudioPlyerOptions = /** @class */ (function () { function AudioPlyerOptions() { this.currentAudioTime = 0; this.isAudioLoaded = false; this.isRepeat = false; this.audioVolume = 100; this.isAudioEnded = new rxjs.Subject; this.isMute = false; this.playEvent = new i0.EventEmitter(); this.pauseEvent = new i0.EventEmitter(); } //get audio player events AudioPlyerOptions.prototype.options = function () { var _this = this; //emit event when playing audio this.audioPlayer.nativeElement.addEventListener('playing', function () { }); //emit when intial loading of audio this.audioPlayer.nativeElement.addEventListener('loadeddata', function () { _this.isAudioLoaded = true; _this.getAudioLength(); }); //emit time on playing audio this.audioPlayer.nativeElement.addEventListener('timeupdate', function () { //get current audio time _this.currentAudioTime = Math.floor(_this.audioPlayer.nativeElement.currentTime); //check if audio is ended for next song and pass data to component if (_this.audioPlayer.nativeElement.ended) { _this.isAudioEnded.next(true); } }); this.audioPlayer.nativeElement.addEventListener('volumechange', function () { _this.audioVolume = Math.floor(_this.audioPlayer.nativeElement.volume * 100); if (_this.audioVolume == 0) { _this.isMute = true; } else { _this.isMute = false; } }); }; AudioPlyerOptions.prototype.play = function () { var _this = this; //toggle play-pause button this.isAudioPlaying = true; //play when user click play button setTimeout(function () { _this.audioPlayer.nativeElement.play(); _this.playEvent.emit(); }, 0); }; AudioPlyerOptions.prototype.pause = function () { var _this = this; //toggle play-pause button this.isAudioPlaying = false; //pause when user click pause button setTimeout(function () { _this.audioPlayer.nativeElement.pause(); _this.pauseEvent.emit(); }, 0); }; AudioPlyerOptions.prototype.getAudioLength = function () { this.totalAudioLength = Math.floor(this.audioPlayer.nativeElement.duration); }; return AudioPlyerOptions; }()); AudioPlyerOptions.decorators = [ { type: i0.Component, args: [{ template: '' },] } ]; AudioPlyerOptions.propDecorators = { playEvent: [{ type: i0.Output }], pauseEvent: [{ type: i0.Output }], audioPlayer: [{ type: i0.ViewChild, args: ['audioPlayer', { static: true },] }] }; var AngMusicPlayerComponent = /** @class */ (function (_super) { __extends(AngMusicPlayerComponent, _super); function AngMusicPlayerComponent() { var _this = _super.call(this) || this; _this.audioList = []; _this.next = true; _this.previous = true; _this.shuffle = true; _this.repeat = true; _this.scrollTitle = false; _this.playButtonColor = "rgb(76, 130, 175)"; _this.pauseButtonColor = "rgb(76, 130, 175)"; _this.nextButtonColor = "rgb(76, 130, 175)"; _this.previousButtonColor = "rgb(76, 130, 175)"; _this.repeatButtonColor = "rgb(76, 130, 175)"; _this.activeRepeatButtonColor = "rgb(76, 130, 175)"; _this.volumeButtonColor = "rgb(76, 130, 175)"; _this.muteButtonColor = "rgb(76, 130, 175)"; _this.nextEvent = new i0.EventEmitter(); _this.previousEvent = new i0.EventEmitter(); _this.repeatEvent = new i0.EventEmitter(); _this.shuffleEvent = new i0.EventEmitter(); _this.seekEvent = new i0.EventEmitter(); _this.currentAudioIndex = 0; _this.repeatActive = false; _this.isError = false; _this.isShuffle = false; return _this; } AngMusicPlayerComponent.prototype.ngOnInit = function () { var _this = this; this.options(); this.initiateAudioPlayer(); //check audio is ended for next song this.isAudioEnded.subscribe(function (data) { if (!_this.isRepeat && _this.audioList.length > 0) { _this.nextAudio(); } }); }; AngMusicPlayerComponent.prototype.nextAudio = function () { if (this.audioList.length - 1 != this.currentAudioIndex) { this.currentAudioIndex += 1; this.selectedAudio = this.audioList[this.currentAudioIndex]; this.getAudioLength(); if (this.isAudioPlaying) { this.play(); } this.nextEvent.emit(); } else { this.pause(); } }; AngMusicPlayerComponent.prototype.previousAudio = function () { if (this.currentAudioIndex != 0) { this.currentAudioIndex -= 1; this.selectedAudio = this.audioList[this.currentAudioIndex]; this.getAudioLength(); if (this.isAudioPlaying) { this.play(); } this.previousEvent.emit(); } }; AngMusicPlayerComponent.prototype.seekAudio = function (seekAudioValue) { if (this.audioVolume != 0) { this.isMute = false; } this.audioPlayer.nativeElement.currentTime = seekAudioValue.target.value; this.seekEvent.emit(); }; AngMusicPlayerComponent.prototype.repeatAudio = function () { this.isRepeat = !this.isRepeat; this.repeatActive = !this.repeatActive; this.audioPlayer.nativeElement.loop = this.isRepeat; this.repeatEvent.emit(); }; /* shuffleAudio() { this.isShuffle = !this.isShuffle; if (this.isShuffle) { let randomItem = Math.floor(Math.random() * this.audioList.length); console.log(randomItem); } this.shuffleEvent.emit(); } */ AngMusicPlayerComponent.prototype.volumeChange = function (volume) { this.audioPlayer.nativeElement.volume = volume.target.value / 100; }; AngMusicPlayerComponent.prototype.muteAudio = function () { if (this.isMute) { this.audioPlayer.nativeElement.volume = 0.5; this.isMute = false; } else { this.audioPlayer.nativeElement.volume = 0; this.isMute = true; } }; AngMusicPlayerComponent.prototype.initiateAudioPlayer = function () { if (this.audioList.length <= 0) { this.isError = true; } else { this.selectedAudio = this.audioList[this.currentAudioIndex]; } }; return AngMusicPlayerComponent; }(AudioPlyerOptions)); AngMusicPlayerComponent.decorators = [ { type: i0.Component, args: [{ selector: 'ang-music-player', template: "<audio controls #audioPlayer [src]=\"selectedAudio?.url\"> </audio>\r\n\r\n<div class=\"wrapper\" [ngStyle]=\"{ 'background-color': backgroundColor , 'width': width, 'height': height }\">\r\n\r\n <!-- loader and error -->\r\n <div class=\"loader\" *ngIf=\"!isAudioLoaded && !isError\"> Loading....</div>\r\n <div class=\"error\" *ngIf=\"isError\">No audio Found !</div>\r\n\r\n <div *ngIf=\"selectedAudio?.cover && isAudioLoaded\" class=\"cover\">\r\n <img [src]=\"selectedAudio?.cover\">\r\n </div>\r\n\r\n <div class=\"container\" *ngIf=\"isAudioLoaded\">\r\n <div class=\"details\">\r\n <div class=\"slidecontainer\">\r\n <input type=\"range\" max=\"{{totalAudioLength}}\" value=\"{{currentAudioTime}}\"\r\n [ngStyle]=\"{ 'background': timeSliderColor }\" (input)=\"seekAudio($event)\" class=\"slider\" id=\"myRange\">\r\n <div class=\"time-line\" [ngStyle]=\"{ 'color' : audioTimeColor }\">\r\n <div>{{ currentAudioTime | timeConversion}}</div>\r\n <div>{{ totalAudioLength | timeConversion}}</div>\r\n </div>\r\n </div>\r\n <marquee *ngIf=\"scrollTitle\" [ngStyle]=\"{ 'color' : audioTitleColor }\">\r\n <p class=\"title\"> {{selectedAudio?.title}}</p>\r\n </marquee>\r\n <p class=\"title\" [ngStyle]=\"{ 'color' : audioTitleColor }\" *ngIf=\"!scrollTitle\"> {{selectedAudio?.title}}</p>\r\n </div>\r\n <div class=\"controls\">\r\n\r\n <!-- repeat button starts -->\r\n <!-- not active -->\r\n <svg id=\"Layer_1\" *ngIf=\"repeat && !isRepeat\" (click)=\"repeatAudio()\" data-name=\"Layer 1\"\r\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\" [ngStyle]=\"{ 'fill' : repeatButtonColor }\">\r\n <title>repeat-on</title>\r\n <path class=\"cls-1\"\r\n d=\"M13.78,64a1.14,1.14,0,0,1-.8-.3L.26,51.3a1.07,1.07,0,0,1-.1-1.4l.1-.1L13,37.5a1.06,1.06,0,0,1,1.2-.2,1.2,1.2,0,0,1,.7,1v7.6H49.72a1.84,1.84,0,0,0,1.8-1.7V35.6a.91.91,0,0,1,.3-.7l8.51-8.3a1.06,1.06,0,0,1,1.2-.2,1.2,1.2,0,0,1,.7,1V46c0,6.7-3.6,10.2-10.51,10.2H14.88v6.7a1,1,0,0,1-.7,1A.6.6,0,0,1,13.78,64Z\"\r\n transform=\"translate(0.05 0)\" />\r\n <path class=\"cls-1\"\r\n d=\"M3,37.8a.6.6,0,0,1-.4-.1,1.09,1.09,0,0,1-.7-1V18C2,11.3,5.57,7.8,12.48,7.8H49.22V1.1a1.2,1.2,0,0,1,.7-1A.94.94,0,0,1,51,.3L63.64,12.7a1.07,1.07,0,0,1,.1,1.4l-.1.1L51,26.5a1.06,1.06,0,0,1-1.2.2,1.09,1.09,0,0,1-.7-1V18.1H14.38a1.69,1.69,0,0,0-1.7,1.7v8.6a1.14,1.14,0,0,1-.3.8L3.87,37.5A3.18,3.18,0,0,1,3,37.8Z\"\r\n transform=\"translate(0.05 0)\" />\r\n </svg>\r\n\r\n <!-- active -->\r\n <svg id=\"Layer_1\" *ngIf=\"repeat && isRepeat\" (click)=\"repeatAudio()\" data-name=\"Layer 1\"\r\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 63.98 64.03\" [ngStyle]=\"{ 'fill' : activeRepeatButtonColor }\">\r\n <style>\r\n .cls{\r\n fill: green\r\n }\r\n </style>\r\n <title>repeat-off</title>\r\n <path class=\"cls\"\r\n d=\"M13.78,64a1.13,1.13,0,0,1-.78-.31L.31,51.34a1,1,0,0,1-.07-1.41l.07-.07L13,37.49a1.09,1.09,0,0,1,1.19-.23,1,1,0,0,1,.66,1v7.63H49.64a1.73,1.73,0,0,0,1.75-1.69V35.59a1,1,0,0,1,.31-.74l8.49-8.28a1.12,1.12,0,0,1,1.18-.23,1.07,1.07,0,0,1,.67,1V46c0,6.68-3.63,10.21-10.51,10.21H14.86V63a1,1,0,0,1-.67,1A1,1,0,0,1,13.78,64Z\"\r\n transform=\"translate(0.02 0.03)\" />\r\n <path class=\"cls\"\r\n d=\"M3.05,37.75a1,1,0,0,1-.41-.09,1,1,0,0,1-.67-1V18C2,11.3,5.59,7.78,12.48,7.78H49.15V1.05a1.08,1.08,0,0,1,.67-1A1.1,1.1,0,0,1,51,.29L63.64,12.65a1,1,0,0,1,.07,1.41l-.07.07L51,26.49a1.08,1.08,0,0,1-1.18.23,1,1,0,0,1-.67-1v-7.6H14.36a1.71,1.71,0,0,0-1.72,1.69v8.61a1,1,0,0,1-.32.75l-8.5,8.26A1.06,1.06,0,0,1,3.05,37.75Z\"\r\n transform=\"translate(0.02 0.03)\" />\r\n </svg>\r\n <!-- repeat active ends -->\r\n\r\n <!-- previous button starts -->\r\n <svg id=\"Layer_1\" *ngIf=\"previous\" (click)=\"previousAudio()\" data-name=\"Layer 1\"\r\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 65 65.7\" [ngStyle]=\"{ 'fill' : previousButtonColor }\">\r\n <title>previous</title>\r\n <polygon class=\"cls-1\" points=\"64.5 0.85 7.05 32.85 64.5 64.85 64.5 0.85\" />\r\n <rect class=\"cls-1\" x=\"0.5\" y=\"0.85\" width=\"13.52\" height=\"64\" />\r\n </svg>\r\n <!-- previous button ends -->\r\n\r\n <!-- play button starts -->\r\n <svg id=\"Layer_1\" (click)=\"play()\" *ngIf=\"!isAudioPlaying\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 64 64\" [ngStyle]=\"{ 'fill' : playButtonColor }\">\r\n <title>play</title>\r\n <path class=\"cls-1\"\r\n d=\"M21.65,79.51A3.48,3.48,0,0,1,18,76.22V18.79a3.47,3.47,0,0,1,3.64-3.28L80.8,45s2.73,2.47,0,4.93S21.65,79.51,21.65,79.51Z\"\r\n transform=\"translate(-18.01 -15.51)\" />\r\n </svg>\r\n <!-- play button ends -->\r\n\r\n <!-- pause button starts -->\r\n <svg id=\"Layer_1\" (click)=\"pause()\" *ngIf=\"isAudioPlaying\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 64 64\" [ngStyle]=\"{ 'fill' : pauseButtonColor }\">\r\n <title>pause</title>\r\n <g id=\"pause\">\r\n <path class=\"cls-1\" d=\"M16,82H37.33V18H16ZM58.67,18V82H80V18Z\" transform=\"translate(-16 -18)\" />\r\n </g>\r\n </svg>\r\n <!-- pause button ends -->\r\n\r\n <!-- next button starts -->\r\n <svg id=\"Layer_1\" *ngIf=\"next\" (click)=\"nextAudio()\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 64 64\" [ngStyle]=\"{ 'fill' : nextButtonColor }\">\r\n <title>next</title>\r\n <polygon class=\"cls-1\" points=\"0 64 57.45 32 0 0 0 64\" />\r\n <rect class=\"cls-1\" x=\"50.48\" width=\"13.52\" height=\"64\" />\r\n </svg>\r\n <!-- next button ends -->\r\n\r\n <!-- <div class=\"shuffle\" *ngIf=\"shuffle\" [ngClass]=\"{'shuffle-active': isShuffle}\" (click)=\"shuffleAudio()\"></div> -->\r\n\r\n <!-- volume button starts -->\r\n <div class=\"volume-container\">\r\n <!-- with volume -->\r\n <svg id=\"volume\" *ngIf=\"!isMute\" (click)=\"muteAudio()\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 64 64\" [ngStyle]=\"{ 'fill' : pauseButtonColor }\">\r\n <defs>\r\n <style>\r\n .cls-2 {\r\n fill: none;\r\n }\r\n\r\n </style>\r\n </defs>\r\n <title>volume-high</title>\r\n <path class=\"cls-1\"\r\n d=\"M2.67,22.39V44.28H16.89L34.67,62.52V4.14L16.89,22.39Zm48,10.94a16.46,16.46,0,0,0-8.89-14.7V48A16.37,16.37,0,0,0,50.67,33.33Zm-8.89-32V8.85A25.49,25.49,0,0,1,59.56,33.33,25.5,25.5,0,0,1,41.78,57.82v7.51a32.65,32.65,0,0,0,24.89-32A32.66,32.66,0,0,0,41.78,1.33Z\"\r\n transform=\"translate(-2.67 -1.33)\" />\r\n <path class=\"cls-2\" d=\"M22.67,21.33h24v24h-24Z\" transform=\"translate(-2.67 -1.33)\" />\r\n </svg>\r\n\r\n <!-- mute -->\r\n <svg id=\"Capa_1\" *ngIf=\"isMute\" (click)=\"muteAudio()\" data-name=\"Capa 1\" xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 64 64\" [ngStyle]=\"{ 'fill' : muteButtonColor }\">\r\n <title>mute</title>\r\n <g id=\"volume-off\">\r\n <path class=\"cls-1\"\r\n d=\"M59,39.83a15.35,15.35,0,0,0-8.89-14.14v7.78L59,42.31Zm8.89,0A26.37,26.37,0,0,1,66.12,49l5.34,5.3A29.71,29.71,0,0,0,75,39.48,31.94,31.94,0,0,0,50.12,8.36v7.43C60.43,19.33,67.9,28.52,67.9,39.83ZM15.63,8,11,12.61,27.72,29.23H11V50.44H25.23L43,68.12V44.43L58.3,59.64a30,30,0,0,1-8.18,4.24V71.3a30.44,30.44,0,0,0,13.16-6.36L70.39,72,75,67.41,43,35.59ZM43,11.55,35.54,19,43,26.4Z\"\r\n transform=\"translate(-11.01 -8.01)\" />\r\n </g>\r\n </svg>\r\n\r\n <!-- volume button ends -->\r\n <div class=\"volume-control\">\r\n <input type=\"range\" max=\"100\" value=\"{{audioVolume}}\" (click)=\"$event.stopPropagation();\"\r\n (input)=\"volumeChange($event)\" [ngStyle]=\"{ 'background': volumeSliderColor }\" class=\"slider\"\r\n id=\"volumeRange\">\r\n </div>\r\n </div>\r\n\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["@import url(\"https://fonts.googleapis.com/css?family=Raleway&display=swap\");audio{display:none}.wrapper{align-items:center;background:#000;border-radius:15px;display:flex;font-family:Raleway,sans-serif;height:130px;width:500px}.wrapper .cover img{border-radius:50%;margin-left:10px;max-height:100px;max-width:100px}.wrapper .loader{color:#fff}.wrapper .error,.wrapper .loader{margin:0 auto;position:relative;text-align:center}.wrapper .error{color:#ff3737}.wrapper .container{padding:5px;width:100%}.wrapper .container .details{text-align:center}.wrapper .container .details .title{color:#4c82af;margin:7px 0 15px}.wrapper .container .controls{display:flex;flex-basis:auto;flex-direction:row;flex-wrap:wrap;justify-content:space-around;margin-top:8px}.wrapper .container .controls svg{cursor:pointer;height:25px;margin:0 20px;width:25px}.wrapper .container .volume-container{position:relative}.wrapper .container .volume-container .volume-control{display:none;height:32px;left:-9px;position:absolute;top:-62px;transform:rotate(270deg);width:90px;z-index:1000}.wrapper .container .volume-container:hover .volume-control{display:block}.slidecontainer{align-items:center;display:flex;flex-direction:column;width:100%}.slidecontainer .time-line{color:#4c82af;display:flex;justify-content:space-between;margin:7px 0 2px;width:87%}.slider{-webkit-appearance:none;background:#fff;border-radius:5px;height:2px;opacity:1;outline:none;transition:opacity .2s;width:87%;z-index:1000}.slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background:#4c82af;border-radius:50%;cursor:pointer;height:15px;width:15px}.slider::-moz-range-thumb{background:#4c82af;border-radius:50%;cursor:pointer;height:15px;width:15px}"] },] } ]; AngMusicPlayerComponent.ctorParameters = function () { return []; }; AngMusicPlayerComponent.propDecorators = { width: [{ type: i0.Input }], height: [{ type: i0.Input }], backgroundColor: [{ type: i0.Input }], audioTimeColor: [{ type: i0.Input }], audioTitleColor: [{ type: i0.Input }], volumeSliderColor: [{ type: i0.Input }], timeSliderColor: [{ type: i0.Input }], audioList: [{ type: i0.Input }], next: [{ type: i0.Input }], previous: [{ type: i0.Input }], shuffle: [{ type: i0.Input }], repeat: [{ type: i0.Input }], scrollTitle: [{ type: i0.Input }], playButtonColor: [{ type: i0.Input }], pauseButtonColor: [{ type: i0.Input }], nextButtonColor: [{ type: i0.Input }], previousButtonColor: [{ type: i0.Input }], repeatButtonColor: [{ type: i0.Input }], activeRepeatButtonColor: [{ type: i0.Input }], volumeButtonColor: [{ type: i0.Input }], muteButtonColor: [{ type: i0.Input }], nextEvent: [{ type: i0.Output }], previousEvent: [{ type: i0.Output }], repeatEvent: [{ type: i0.Output }], shuffleEvent: [{ type: i0.Output }], seekEvent: [{ type: i0.Output }] }; var TimeConversionPipe = /** @class */ (function () { function TimeConversionPipe() { } TimeConversionPipe.prototype.transform = function (audioTime) { var audioLengthMin = ("0" + Math.floor(audioTime / 60)).slice(-2); var audioLengthSec = ("0" + audioTime % 60).slice(-2); return audioLengthMin + ":" + audioLengthSec; }; return TimeConversionPipe; }()); TimeConversionPipe.decorators = [ { type: i0.Pipe, args: [{ name: 'timeConversion' },] } ]; var AngMusicPlayerModule = /** @class */ (function () { function AngMusicPlayerModule() { } return AngMusicPlayerModule; }()); AngMusicPlayerModule.decorators = [ { type: i0.NgModule, args: [{ declarations: [AngMusicPlayerComponent, TimeConversionPipe], imports: [ common.CommonModule ], exports: [AngMusicPlayerComponent] },] } ]; /* * Public API Surface of ang-music-player */ /** * Generated bundle index. Do not edit. */ exports.AngMusicPlayerComponent = AngMusicPlayerComponent; exports.AngMusicPlayerModule = AngMusicPlayerModule; exports.AngMusicPlayerService = AngMusicPlayerService; exports.ɵa = AudioPlyerOptions; exports.ɵb = TimeConversionPipe; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=ang-music-player.umd.js.map