Skip to content

Commit 6395bd1

Browse files
committed
Implement spotify options
1 parent 549ebf5 commit 6395bd1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ng-embed.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@
281281
download : false //Show/Hide download buttons
282282
},
283283
spotifyEmbed : true,
284+
spotifyOptions : {
285+
width: "100%",
286+
height: 80
287+
},
284288
codepenEmbed : true,
285289
codepenHeight : 300,
286290
jsfiddleEmbed : true,
@@ -562,13 +566,13 @@
562566
return str;
563567
},
564568

565-
spotifyEmbed: function (str) {
569+
spotifyEmbed: function (str, opts) {
566570
var spotifyRegex = /spotify.com\/track\/[a-zA-Z0-9_]+/gi;
567571
var matches = str.match(spotifyRegex) ? str.match(spotifyRegex).getUnique() : null;
568572
if (matches) {
569573
var i = 0;
570574
while (i < matches.length) {
571-
var frame = $sce.trustAsHtml('<iframe src="https://embed.spotify.com/?uri=spotify:track:' + matches[i].split('/')[2] + '" height="80"></iframe>');
575+
var frame = $sce.trustAsHtml('<iframe src="https://embed.spotify.com/?uri=spotify:track:' + matches[i].split('/')[2] + '" width="' + opts.spotifyOptions.width + '" height="' + opts.spotifyOptions.height + '"></iframe>');
572576
scope.audioServices.push(frame);
573577
i++;
574578
}
@@ -804,7 +808,7 @@
804808
x = options.dotsubEmbed ? videoProcess.dotsubEmbed(x, options) : x;
805809
x = options.liveleakEmbed ? videoProcess.liveleakEmbed(x, options) : x;
806810
x = options.soundCloudEmbed ? audioProcess.soundcloudEmbed(x, options) : x;
807-
x = options.spotifyEmbed ? audioProcess.spotifyEmbed(x) : x;
811+
x = options.spotifyEmbed ? audioProcess.spotifyEmbed(x, options) : x;
808812
x = options.codepenEmbed ? codeEmbedProcess.codepenEmbed(x, options) : x;
809813
x = options.jsfiddleEmbed ? codeEmbedProcess.jsfiddleEmbed(x, options) : x;
810814
x = options.jsbinEmbed ? codeEmbedProcess.jsbinEmbed(x, options) : x;

0 commit comments

Comments
 (0)