2018-10-21 19:00:10 -04:00
|
|
|
import { Component } from "@angular/core";
|
|
|
|
import { ActivatedRoute } from "@angular/router";
|
|
|
|
import * as spotifyUri from "spotify-uri";
|
|
|
|
import { DomSanitizer, SafeUrl } from "@angular/platform-browser";
|
|
|
|
|
|
|
|
@Component({
|
2021-09-01 19:29:24 -04:00
|
|
|
selector: "my-spotify-widget-wrapper",
|
2018-10-21 19:00:10 -04:00
|
|
|
templateUrl: "../fullpage-iframe/fullpage-iframe.component.html",
|
|
|
|
styleUrls: ["../fullpage-iframe/fullpage-iframe.component.scss"],
|
|
|
|
})
|
|
|
|
export class SpotifyWidgetWrapperComponent {
|
|
|
|
public embedUrl: SafeUrl = null;
|
|
|
|
|
|
|
|
constructor(activatedRoute: ActivatedRoute, sanitizer: DomSanitizer) {
|
2021-09-01 19:01:01 -04:00
|
|
|
const params: any = activatedRoute.snapshot.queryParams;
|
2018-10-21 19:00:10 -04:00
|
|
|
const spotifyUrl = spotifyUri.parse(params.uri);
|
|
|
|
const spotifyEmbedUrl = spotifyUri.formatEmbedURL(spotifyUrl);
|
|
|
|
this.embedUrl = sanitizer.bypassSecurityTrustResourceUrl(spotifyEmbedUrl);
|
|
|
|
}
|
|
|
|
}
|