import { Component, ElementRef, Input, ViewChild } from '@angular/core'
-import { Notifier } from '@app/core'
import { VideoDetails } from '../../../shared/video/video-details.model'
import { buildVideoEmbed, buildVideoLink } from '../../../../assets/player/utils'
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { NgbModal, NgbTabChangeEvent } from '@ng-bootstrap/ng-bootstrap'
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { VideoCaption } from '@shared/models'
+import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model'
type Customizations = {
startAtCheckbox: boolean
@Input() video: VideoDetails = null
@Input() videoCaptions: VideoCaption[] = []
+ @Input() playlist: VideoPlaylist = null
- activeId: 'url' | 'qrcode' | 'embed'
+ activeId: 'url' | 'qrcode' | 'embed' = 'url'
customizations: Customizations
isAdvancedCustomizationCollapsed = true
+ includeVideoInPlaylist = false
private currentVideoTimestamp: number
- constructor (
- private modalService: NgbModal,
- private notifier: Notifier,
- private i18n: I18n
- ) { }
+ constructor (private modalService: NgbModal) { }
show (currentVideoTimestamp?: number) {
this.currentVideoTimestamp = currentVideoTimestamp
controls: true
}
- this.modalService.open(this.modal)
+ this.modalService.open(this.modal, { centered: true })
}
getVideoIframeCode () {
}
getVideoUrl () {
- const options = this.getOptions()
+ const baseUrl = window.location.origin + '/videos/watch/' + this.video.uuid
+ const options = this.getOptions(baseUrl)
return buildVideoLink(options)
}
- notSecure () {
- return window.location.protocol === 'http:'
- }
+ getPlaylistUrl () {
+ const base = window.location.origin + '/videos/watch/playlist/' + this.playlist.uuid
+
+ if (!this.includeVideoInPlaylist) return base
- activateCopiedMessage () {
- this.notifier.success(this.i18n('Copied'))
+ return base + '?videoId=' + this.video.uuid
}
- onTabChange (event: NgbTabChangeEvent) {
- this.activeId = event.nextId as any
+ notSecure () {
+ return window.location.protocol === 'http:'
}
isInEmbedTab () {
return this.activeId === 'embed'
}
+ hasPlaylist () {
+ return !!this.playlist
+ }
+
private getOptions (baseUrl?: string) {
return {
baseUrl,