diff --git a/Kyoo/ClientApp/src/app/browse/browse.component.ts b/Kyoo/ClientApp/src/app/browse/browse.component.ts index b1527060..40507218 100644 --- a/Kyoo/ClientApp/src/app/browse/browse.component.ts +++ b/Kyoo/ClientApp/src/app/browse/browse.component.ts @@ -30,7 +30,7 @@ export class BrowseComponent implements OnInit getThumb(slug: string) { - return this.sanitizer.bypassSecurityTrustStyle("url(/thumb/" + slug + ")"); + return this.sanitizer.bypassSecurityTrustStyle("url(/poster/" + slug + ")"); } sort(type: string, order: boolean) diff --git a/Kyoo/ClientApp/src/app/player/player.component.html b/Kyoo/ClientApp/src/app/player/player.component.html index 31b77e19..b3345136 100644 --- a/Kyoo/ClientApp/src/app/player/player.component.html +++ b/Kyoo/ClientApp/src/app/player/player.component.html @@ -35,13 +35,13 @@
diff --git a/Kyoo/ClientApp/src/app/player/player.component.scss b/Kyoo/ClientApp/src/app/player/player.component.scss index 2d5cb8b2..c8f0a84d 100644 --- a/Kyoo/ClientApp/src/app/player/player.component.scss +++ b/Kyoo/ClientApp/src/app/player/player.component.scss @@ -120,6 +120,15 @@ margin-right: .3rem; outline: none; } + + > a + { + margin-left: .3rem; + margin-right: .3rem; + outline: none; + color: inherit; + text-decoration: inherit; + } } } } diff --git a/Kyoo/ClientApp/src/app/player/player.component.ts b/Kyoo/ClientApp/src/app/player/player.component.ts index 227ed1d4..a3d48c3f 100644 --- a/Kyoo/ClientApp/src/app/player/player.component.ts +++ b/Kyoo/ClientApp/src/app/player/player.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; import { WatchItem, Track } from "../../models/watch-item"; -import { ActivatedRoute } from "@angular/router"; +import { ActivatedRoute, Router } from "@angular/router"; import { DomSanitizer, Title } from "@angular/platform-browser"; import { Location } from "@angular/common"; import { MatSliderChange } from "@angular/material/slider"; @@ -39,7 +39,7 @@ export class PlayerComponent implements OnInit private progress: HTMLElement; private buffered: HTMLElement; - constructor(private route: ActivatedRoute, private sanitizer: DomSanitizer, private location: Location, private title: Title) { } + constructor(private route: ActivatedRoute, private sanitizer: DomSanitizer, private location: Location, private title: Title, private router: Router) { } ngOnInit() { @@ -192,6 +192,16 @@ export class PlayerComponent implements OnInit } }); + //Load sub selected from the url. + let sub: string = this.route.snapshot.queryParams["sub"]; + if (sub != null) + { + let languageCode: string = sub.substring(0, 3); + let forced: boolean = sub.length > 3 && sub.substring(4) == "for"; + + this.selectSubtitle(this.item.subtitles.find(x => x.language == languageCode && x.isForced == forced), false); + } + $('[data-toggle="tooltip"]').tooltip({ trigger: "hover" }); } @@ -228,11 +238,6 @@ export class PlayerComponent implements OnInit $('[data-toggle="tooltip"]').hide(); } - back() - { - this.location.back(); - } - tooglePlayback() { if (this.player.paused) @@ -293,37 +298,37 @@ export class PlayerComponent implements OnInit } } - selectSubtitle(subtitle: Track) + selectSubtitle(subtitle: Track, changeUrl: boolean = true) { + if (changeUrl) + { + let subSlug: string; + if (subtitle != null) + { + subSlug = subtitle.language; + if (subtitle.isForced) + subSlug += "-for"; + } + + this.router.navigate([], { relativeTo: this.route, queryParams: { sub: subSlug }, replaceUrl: true, queryParamsHandling: "merge" }); + } + this.selectedSubtitle = subtitle; if (subtitle == null) { + console.log("Removing subtitle"); SubtitleManager.remove(this.player); } else { + console.log("Loading subtitle: " + subtitle.displayName); + if (subtitle.codec == "ass") - SubtitleManager.add(this.player, this.getSubtitleLink(subtitle), true); + SubtitleManager.add(this.player, subtitle.link, true); } } - getSubtitleLink(subtitle: Track): string - { - let link: string = "/api/subtitle/" + this.item.link + "." + subtitle.language; - - if (subtitle.isForced) - link += "-forced"; - - //The extension is not necesarry but we add this because it allow the user to quickly download the file in the good format if he wants. - if (subtitle.codec == "ass") - link += ".ass"; - else if (subtitle.codec == "subrip") - link += ".srt" - - return link; - } - getThumb(url: string) { return this.sanitizer.bypassSecurityTrustStyle("url(" + url + ")"); diff --git a/Kyoo/ClientApp/src/app/show-details/show-details.component.html b/Kyoo/ClientApp/src/app/show-details/show-details.component.html index 2e503cef..7fb8ff37 100644 --- a/Kyoo/ClientApp/src/app/show-details/show-details.component.html +++ b/Kyoo/ClientApp/src/app/show-details/show-details.component.html @@ -4,7 +4,7 @@