mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-23 15:30:34 -04:00
Fixing trailers
This commit is contained in:
parent
46a5b53af0
commit
2bb34c20b1
@ -1,3 +1,2 @@
|
||||
<iframe *ngIf="this.getYtTrailer()" id="ytplayer" type="text/html" height="100%" width="100%"
|
||||
[src]="this.getYtTrailer()"
|
||||
<iframe id="frame" height="100%" width="100%"
|
||||
frameborder="0" allowfullscreen allow="autoplay"></iframe>
|
@ -1,4 +1,4 @@
|
||||
.panel .mat-dialog-container
|
||||
::ng-deep .panel .mat-dialog-container
|
||||
{
|
||||
overflow-y: hidden;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { Component, Inject } from "@angular/core";
|
||||
import { AfterViewInit, Component, Inject } from "@angular/core";
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
|
||||
import { DomSanitizer, SafeUrl } from "@angular/platform-browser";
|
||||
|
||||
@ -7,19 +7,24 @@ import { DomSanitizer, SafeUrl } from "@angular/platform-browser";
|
||||
templateUrl: "./trailer-dialog.component.html",
|
||||
styleUrls: ["./trailer-dialog.component.scss"]
|
||||
})
|
||||
export class TrailerDialogComponent
|
||||
export class TrailerDialogComponent implements AfterViewInit
|
||||
{
|
||||
constructor(public dialogRef: MatDialogRef<TrailerDialogComponent>,
|
||||
public sanitizer: DomSanitizer,
|
||||
@Inject(MAT_DIALOG_DATA) public trailer: string)
|
||||
{}
|
||||
|
||||
getYtTrailer(): SafeUrl
|
||||
getYtTrailer(): string
|
||||
{
|
||||
if (!this.trailer.includes("youtube.com"))
|
||||
return null;
|
||||
const ytID: string = this.trailer.substring(this.trailer.indexOf("watch?v=") + 8);
|
||||
const uri: string = `https://www.youtube.com/embed/${ytID}?autoplay=1`;
|
||||
return this.sanitizer.bypassSecurityTrustResourceUrl(uri);
|
||||
return `https://www.youtube.com/embed/${ytID}?autoplay=1`;
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void
|
||||
{
|
||||
const frame = <HTMLIFrameElement>document.getElementById("frame")
|
||||
frame.src = this.getYtTrailer();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user