mirror of https://github.com/Chocobozzz/PeerTube
Fix bug when quitting NSFW video
parent
a96aed1518
commit
efee3505f6
|
@ -36,7 +36,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
uploadSpeed: number
|
uploadSpeed: number
|
||||||
userRating: UserVideoRateType = null
|
userRating: UserVideoRateType = null
|
||||||
video: Video = null
|
video: Video = null
|
||||||
videoNotFound = false
|
videoPlayerLoaded = false
|
||||||
|
|
||||||
private paramsSub: Subscription
|
private paramsSub: Subscription
|
||||||
|
|
||||||
|
@ -58,17 +58,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
this.videoService.getVideo(uuid).subscribe(
|
this.videoService.getVideo(uuid).subscribe(
|
||||||
video => this.onVideoFetched(video),
|
video => this.onVideoFetched(video),
|
||||||
|
|
||||||
error => {
|
error => console.error(error)
|
||||||
console.error(error)
|
|
||||||
this.videoNotFound = true
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy () {
|
ngOnDestroy () {
|
||||||
// Remove player if it exists
|
// Remove player if it exists
|
||||||
if (this.videoNotFound === false) {
|
if (this.videoPlayerLoaded === true) {
|
||||||
videojs(this.playerElement).dispose()
|
videojs(this.playerElement).dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,6 +220,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
observable.subscribe(
|
observable.subscribe(
|
||||||
res => {
|
res => {
|
||||||
if (res === false) {
|
if (res === false) {
|
||||||
|
|
||||||
return this.router.navigate([ '/videos/list' ])
|
return this.router.navigate([ '/videos/list' ])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,6 +239,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.videoPlayerLoaded = true
|
||||||
|
|
||||||
const self = this
|
const self = this
|
||||||
videojs(this.playerElement, videojsOptions, function () {
|
videojs(this.playerElement, videojsOptions, function () {
|
||||||
self.player = this
|
self.player = this
|
||||||
|
|
Loading…
Reference in New Issue