import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
+import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component'
import { MetaService } from '@ngx-meta/core'
import { NotificationsService } from 'angular2-notifications'
import { Observable } from 'rxjs/Observable'
@ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent
@ViewChild('videoShareModal') videoShareModal: VideoShareComponent
@ViewChild('videoReportModal') videoReportModal: VideoReportComponent
+ @ViewChild('videoSupportModal') videoSupportModal: VideoSupportComponent
otherVideosDisplayed: Video[] = []
this.player.pause()
}
- let uuid = routeParams['uuid']
+ const uuid = routeParams['uuid']
+ // Video did not changed
+ if (this.video && this.video.uuid === uuid) return
+
this.videoService.getVideo(uuid).subscribe(
video => this.onVideoFetched(video),
this.videoReportModal.show()
}
+ showSupportModal () {
+ this.videoSupportModal.show()
+ }
+
showShareModal () {
this.videoShareModal.show()
}
return Account.GET_ACCOUNT_AVATAR_URL(this.video.account)
}
+ getVideoPoster () {
+ if (!this.video) return ''
+
+ return this.video.previewUrl
+ }
+
getVideoTags () {
if (!this.video || Array.isArray(this.video.tags) === false) return []
return
}
- this.videoHTMLDescription = this.markdownService.markdownToHTML(this.video.description)
+ this.videoHTMLDescription = this.markdownService.textMarkdownToHTML(this.video.description)
}
private setVideoLikesBarTooltipText () {
videoFiles: this.video.files,
playerElement: this.playerElement,
peerTubeLink: false,
- videoViewUrl: this.videoService.getVideoViewUrl(this.video.uuid)
+ videoViewUrl: this.videoService.getVideoViewUrl(this.video.uuid),
+ videoDuration: this.video.duration
},
hotkeys: {
enableVolumeScroll: false
})
})
} else {
- this.player.peertube().setVideoFiles(this.video.files, this.videoService.getVideoViewUrl(this.video.uuid))
+ const videoViewUrl = this.videoService.getVideoViewUrl(this.video.uuid)
+ this.player.peertube().setVideoFiles(this.video.files, videoViewUrl, this.video.duration)
}
this.setVideoDescriptionHTML()