|
290 | 290 | // Prevent the repetition of events by clearing all previous occurrences, as repeated events tend to occur when the user plays multiple audio files. |
291 | 291 | $rootScope.activePlayerEvents.clear(); |
292 | 292 | } |
293 | | - $rootScope.activePlayerEvents = audioPlayer.onEvent(function (e) { |
| 293 | + $rootScope.activePlayerEvents = audioPlayer.onEvent(function (e) { |
294 | 294 | switch (e.event) { |
295 | 295 | case 'play': |
296 | 296 | NowPlaying.playing = true; |
|
413 | 413 | NowPlaying.currentTrack.title = media.data.title; |
414 | 414 | if ($rootScope.seekTime) NowPlaying.currentTrack.startAt = $rootScope.seekTime; |
415 | 415 |
|
416 | | - NowPlaying.currentTrack.backgroundImage = NowPlaying.currentTrack.backgroundImage ? NowPlaying.currentTrack.backgroundImage : './assets/images/now-playing.png'; |
| 416 | + NowPlaying.currentTrack.backgroundImage = NowPlaying.currentTrack.backgroundImage ? NowPlaying.cropImage(NowPlaying.currentTrack.backgroundImage) : './assets/images/now-playing.png'; |
417 | 417 | NowPlaying.currentTrack.backgroundImage = CSS.escape(NowPlaying.currentTrack.backgroundImage); |
418 | 418 | if (!$scope.$$phase) { |
419 | 419 | $scope.$digest(); |
|
435 | 435 | $scope.$digest(); |
436 | 436 | $scope.$apply(); |
437 | 437 | }); |
438 | | - |
| 438 | + |
439 | 439 | buildfire.services.media.audioPlayer.isPaused((err, isPaused) => { |
440 | 440 | if (err) return console.err(err); |
441 | | - |
| 441 | + |
442 | 442 | NowPlaying.playing = !isPaused; |
443 | | - }); |
| 443 | + }); |
444 | 444 | audioPlayer.getCurrentTrack((track) => { |
445 | 445 | if ( |
446 | 446 | track && |
|
856 | 856 | NowPlaying.closeMoreInfoOverlay = function () { |
857 | 857 | NowPlaying.openMoreInfo = false; |
858 | 858 | }; |
859 | | - |
| 859 | + NowPlaying.cropImage = function(url) { |
| 860 | + if (!url) return; |
| 861 | + return buildfire.imageLib.resizeImage(url, { size: "1080", aspect:'16:9' }) |
| 862 | + } |
860 | 863 | NowPlaying.addEvents = function (e, i, toggle, track) { |
861 | 864 | toggle ? track.swiped = true : track.swiped = false; |
862 | 865 | }; |
|
1103 | 1106 | $scope.$digest(); |
1104 | 1107 | } |
1105 | 1108 | }; |
1106 | | - |
1107 | | - |
| 1109 | + |
| 1110 | + |
1108 | 1111 | //! --------------------------- End : Playback options -------------------------------------- |
1109 | 1112 |
|
1110 | 1113 | /** |
1111 | 1114 | * progress bar style |
1112 | | - * @param {Number} value |
| 1115 | + * @param {Number} value |
1113 | 1116 | */ |
1114 | 1117 | NowPlaying.progressBarStyle = function (value) { |
1115 | 1118 | const percentage = NowPlaying.duration? Math.round(((value / NowPlaying.duration) * 100)) :value; |
1116 | | - |
| 1119 | + |
1117 | 1120 | if (percentage) { |
1118 | 1121 | document.documentElement.style.setProperty('--played-tracker-percentage', `${percentage}%`); |
1119 | 1122 | } |
|
1129 | 1132 | shufflePlaylist: false, |
1130 | 1133 | volume: 1, |
1131 | 1134 | }; |
1132 | | - |
| 1135 | + |
1133 | 1136 | // Compare each key in the settings object with the initialSettings |
1134 | 1137 | for (const key in settings) { |
1135 | 1138 | if ((settings.hasOwnProperty(key) && settings[key] === initialSettings[key])) { |
|
0 commit comments