Skip to content

Commit 29fcc13

Browse files
authored
Merge pull request #249 from BuildFire/add-bg-to-cdn
fix(bg-image):use resize function to add image to cdn
2 parents 272fcc7 + 6cdeabb commit 29fcc13

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

widget/controllers/widget.nowplaying.controller.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
// Prevent the repetition of events by clearing all previous occurrences, as repeated events tend to occur when the user plays multiple audio files.
291291
$rootScope.activePlayerEvents.clear();
292292
}
293-
$rootScope.activePlayerEvents = audioPlayer.onEvent(function (e) {
293+
$rootScope.activePlayerEvents = audioPlayer.onEvent(function (e) {
294294
switch (e.event) {
295295
case 'play':
296296
NowPlaying.playing = true;
@@ -413,7 +413,7 @@
413413
NowPlaying.currentTrack.title = media.data.title;
414414
if ($rootScope.seekTime) NowPlaying.currentTrack.startAt = $rootScope.seekTime;
415415

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';
417417
NowPlaying.currentTrack.backgroundImage = CSS.escape(NowPlaying.currentTrack.backgroundImage);
418418
if (!$scope.$$phase) {
419419
$scope.$digest();
@@ -435,12 +435,12 @@
435435
$scope.$digest();
436436
$scope.$apply();
437437
});
438-
438+
439439
buildfire.services.media.audioPlayer.isPaused((err, isPaused) => {
440440
if (err) return console.err(err);
441-
441+
442442
NowPlaying.playing = !isPaused;
443-
});
443+
});
444444
audioPlayer.getCurrentTrack((track) => {
445445
if (
446446
track &&
@@ -856,7 +856,10 @@
856856
NowPlaying.closeMoreInfoOverlay = function () {
857857
NowPlaying.openMoreInfo = false;
858858
};
859-
859+
NowPlaying.cropImage = function(url) {
860+
if (!url) return;
861+
return buildfire.imageLib.resizeImage(url, { size: "1080", aspect:'16:9' })
862+
}
860863
NowPlaying.addEvents = function (e, i, toggle, track) {
861864
toggle ? track.swiped = true : track.swiped = false;
862865
};
@@ -1103,17 +1106,17 @@
11031106
$scope.$digest();
11041107
}
11051108
};
1106-
1107-
1109+
1110+
11081111
//! --------------------------- End : Playback options --------------------------------------
11091112

11101113
/**
11111114
* progress bar style
1112-
* @param {Number} value
1115+
* @param {Number} value
11131116
*/
11141117
NowPlaying.progressBarStyle = function (value) {
11151118
const percentage = NowPlaying.duration? Math.round(((value / NowPlaying.duration) * 100)) :value;
1116-
1119+
11171120
if (percentage) {
11181121
document.documentElement.style.setProperty('--played-tracker-percentage', `${percentage}%`);
11191122
}
@@ -1129,7 +1132,7 @@
11291132
shufflePlaylist: false,
11301133
volume: 1,
11311134
};
1132-
1135+
11331136
// Compare each key in the settings object with the initialSettings
11341137
for (const key in settings) {
11351138
if ((settings.hasOwnProperty(key) && settings[key] === initialSettings[key])) {

widget/templates/layouts/now-playing.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,4 @@ <h4 class="margin-zero ellipsis whiteTheme">{{NowPlaying.currentTrack.title}}</h
259259
</div>
260260
</div>
261261
</div>
262-
</div>
262+
</div>

0 commit comments

Comments
 (0)