}
ngOnInit () {
- const formGroupData = {
+ const formGroupData: any = {
instanceName: this.customConfigValidatorsService.INSTANCE_NAME,
instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION,
instanceDescription: null,
}
private updateForm () {
- const data = {
+ const data: any = {
instanceName: this.customConfig.instance.name,
instanceShortDescription: this.customConfig.instance.shortDescription,
instanceDescription: this.customConfig.instance.description,
videoQuotaOptions: { value: string, label: string }[] = []
videoQuotaDailyOptions: { value: string, label: string }[] = []
- roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
+ roles = Object.keys(USER_ROLE_LABELS).map((key: any) => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
protected abstract serverService: ServerService
protected abstract configService: ConfigService
{
label: this.i18n('Ban'),
handler: users => this.openBanUserModal(users),
- isDisplayed: users => users.every(u => u.blocked === false)
+ isDisplayed: users => users.every((u: any) => u.blocked === false)
},
{
label: this.i18n('Unban'),
handler: users => this.unbanUsers(users),
- isDisplayed: users => users.every(u => u.blocked === true)
+ isDisplayed: users => users.every((u: any) => u.blocked === true)
}
]
}
styleUrls: [ './my-account-video-channel-edit.component.scss' ]
})
export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelEdit implements OnInit, OnDestroy {
- @ViewChild('avatarfileInput') avatarfileInput
+ @ViewChild('avatarfileInput') avatarfileInput: any
error: string
}
isInSelectionMode () {
- return Object.keys(this.checkedVideos).some(k => this.checkedVideos[ k ] === true)
+ return Object.keys(this.checkedVideos).some((k: any) => this.checkedVideos[ k ] === true)
}
getVideosObservable (page: number) {
async deleteSelectedVideos () {
const toDeleteVideosIds = Object.keys(this.checkedVideos)
- .filter(k => this.checkedVideos[ k ] === true)
+ .filter((k: any) => this.checkedVideos[ k ] === true)
.map(k => parseInt(k, 10))
const res = await this.confirmService.confirm(
}
private spliceVideosById (id: number) {
- for (const key of Object.keys(this.loadedPages)) {
+ let key: any
+ for (key of Object.keys(this.loadedPages)) {
const videos = this.loadedPages[ key ]
- const index = videos.findIndex(v => v.id === id)
+ const index = videos.findIndex((v: any) => v.id === id)
if (index !== -1) {
videos.splice(index, 1)
.catch((_) => _) // Called when closing (cancel) the modal without validating, do nothing
}
- search (event) {
+ // TODO: typing
+ search (event: any) {
const query = event.query
this.userService.autocomplete(query)
.subscribe(
styleUrls: [ './actor-avatar-info.component.scss' ]
})
export class ActorAvatarInfoComponent {
- @ViewChild('avatarfileInput') avatarfileInput
+ @ViewChild('avatarfileInput') avatarfileInput: any
@Input() actor: VideoChannel | Account
providers: [
{
provide: TRANSLATIONS,
- useFactory: (locale) => {
+ useFactory: (locale: string) => {
// On dev mode, test localization
if (isOnDevLocale()) {
locale = buildFileLocale(getDevLocale())
}
refreshUserInformation () {
- const obj = {
+ const obj: any = {
access_token: this.user.getAccessToken(),
refresh_token: null,
token_type: this.user.getTokenType(),
.pipe(
switchMap(translations => {
return this.http.get(ServerService.BASE_VIDEO_URL + attributeName)
- .pipe(map(data => ({ data, translations })))
+ .pipe(map((data: any) => ({ data, translations })))
})
)
.subscribe(({ data, translations }) => {
export class ThemeService {
private theme = document.querySelector('body')
private darkTheme = false
- private previousTheme = {}
+ private previousTheme: { [ id: string ]: string } = {}
constructor () {
// initialise the alternative theme with dark theme colors
}
}
- private switchProperty (property, newValue?) {
+ private switchProperty (property: string, newValue?: string) {
const propertyOldvalue = window.getComputedStyle(this.theme).getPropertyValue('--' + property)
this.theme.style.setProperty('--' + property, (newValue) ? newValue : this.previousTheme[property])
this.previousTheme[property] = propertyOldvalue
userHasAdminAccess = false
helpVisible = false
- private routesPerRight = {
+ private routesPerRight: any = {
[UserRight.MANAGE_USERS]: '/admin/users',
[UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends',
[UserRight.MANAGE_VIDEO_ABUSES]: '/admin/moderation/video-abuses',
}
containsValues () {
- const obj = this.toUrlObject()
+ const obj: any = this.toUrlObject()
for (const k of Object.keys(obj)) {
if (k === 'sort') continue // Exception
size () {
let acc = 0
- const obj = this.toUrlObject()
+ const obj: any = this.toUrlObject()
for (const k of Object.keys(obj)) {
if (k === 'sort') continue // Exception
export type DropdownAction<T> = {
label?: string
- handler?: (T) => any
- linkBuilder?: (T) => (string | number)[]
- isDisplayed?: (T) => boolean
+ handler?: (T: any) => any
+ linkBuilder?: (T: any) => (string | number)[]
+ isDisplayed?: (T: any) => boolean
}
@Component({
export class ButtonComponent {
@Input() label = ''
- @Input() className = undefined
- @Input() icon = undefined
- @Input() title = undefined
+ @Input() className: any = undefined
+ @Input() icon: any = undefined
+ @Input() title: any = undefined
getTitle () {
return this.title || this.label
export class EditButtonComponent {
@Input() label: string
- @Input() routerLink = []
+ @Input() routerLink: any = []
}
}
private createMarkdownList (rules: string[]) {
- const rulesToText = {
+ const rulesToText: any = {
'emphasis': this.i18n('Emphasis'),
'link': this.i18n('Links'),
'newline': this.i18n('New lines'),
[key: string]: any
[index: number]: string
- getItem (key) {
+ getItem (key: any) {
const stringKey = String(key)
if (valuesMap.has(key)) {
return String(valuesMap.get(stringKey))
return null
}
- setItem (key, val) {
+ setItem (key: any, val: any) {
valuesMap.set(String(key), String(val))
}
- removeItem (key) {
+ removeItem (key: any) {
valuesMap.delete(key)
}
return fd
}
-function lineFeedToHtml (obj: object, keyToNormalize: string) {
+function lineFeedToHtml (obj: any, keyToNormalize: string) {
return immutableAssign(obj, {
[keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '<br />')
})
tag: string
videos: Video[]
}[]
+ [key: string]: any
}
return this.applyToResultListData(result, this.convertDateToHuman, [ fieldsToConvert ])
}
- convertDateToHuman (target: object, fieldsToConvert: string[]) {
+ convertDateToHuman (target: any, fieldsToConvert: string[]) {
fieldsToConvert.forEach(field => target[field] = dateToHuman(target[field]))
return target
errorMessage = err
}
- const errorObj = {
+ const errorObj: any = {
message: errorMessage,
status: undefined,
body: undefined
return newParams
}
- addObjectParams (params: HttpParams, object: object) {
+ addObjectParams (params: HttpParams, object: any) {
for (const name of Object.keys(object)) {
const value = object[name]
if (!value) continue
blocked: boolean
blockedReason?: string
+ [key: string]: any
constructor (hash: UserConstructorHash) {
this.id = hash.id
sort: VideoSortField = '-publishedAt'
categoryOneOf?: number
defaultSort: VideoSortField = '-publishedAt'
- syndicationItems = []
+ syndicationItems: any = []
loadOnInit = true
marginContent = true
private resizeSubscription: Subscription
abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}>
- abstract generateSyndicationList ()
+ abstract generateSyndicationList (): any
get user () {
return this.authService.getUser()
}
protected setNewRouteParams () {
- const paramsObject = this.buildRouteParams()
+ const paramsObject: any = this.buildRouteParams()
const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&')
this.location.replaceState(this.currentRoute, queryParams)
uuid?: string
id?: number
scheduleUpdate?: VideoScheduleUpdate
+ [key: string]: any
constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) {
if (video) {
}
}
- patch (values: Object) {
+ patch (values: any) {
Object.keys(values).forEach((key) => {
this[ key ] = values[ key ]
})
templateUrl: './video-feed.component.html'
})
export class VideoFeedComponent {
- @Input() syndicationItems
+ @Input() syndicationItems: any
}
return this.authHttp
.get(environment.apiUrl + descriptionPath)
.pipe(
- map(res => res[ 'description' ]),
+ map((res: any) => res[ 'description' ]),
catchError(err => this.restExtractor.handleError(err))
)
}
@ViewChild('modal') modal: ElementRef
- videoCaptionLanguages = []
+ videoCaptionLanguages: any = []
private openedModal: NgbModalRef
private closingModal = false
this.hide()
const languageId = this.form.value[ 'language' ]
- const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
+ const languageObject = this.videoCaptionLanguages.find((l: any) => l.id === languageId)
this.captionAdded.emit({
language: languageObject,
calendarTimezone: string
calendarDateFormat: string
- private schedulerInterval
+ private schedulerInterval: any
private firstPatchDone = false
private initialVideoCaptions: string[] = []
}
updateForm () {
- const defaultValues = {
+ const defaultValues: any = {
nsfw: 'false',
commentsEnabled: 'true',
waitTranscoding: 'true',
tags: []
}
- const obj = {
+ const obj: any = {
name: this.videoValidatorsService.VIDEO_NAME,
privacy: this.videoValidatorsService.VIDEO_PRIVACY,
channelId: this.videoValidatorsService.VIDEO_CHANNEL,
})
export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate {
@Output() firstStepDone = new EventEmitter<string>()
- @ViewChild('torrentfileInput') torrentfileInput
+ @ViewChild('torrentfileInput') torrentfileInput: any
videoFileName: string
magnetUri = ''
protected videoService: VideoService
protected videoCaptionService: VideoCaptionService
- abstract canDeactivate ()
+ abstract canDeactivate (): any
ngOnInit () {
this.buildForm({})
})
export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate {
@Output() firstStepDone = new EventEmitter<string>()
- @ViewChild('videofileInput') videofileInput
+ @ViewChild('videofileInput') videofileInput: any
// So that it can be accessed in the template
readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY
import { Injectable } from '@angular/core'
import { getAbsoluteAPIUrl } from '@app/shared/misc/utils'
-import * as linkify from 'linkifyjs'
-import * as linkifyHtml from 'linkifyjs/html'
+const linkify = require('linkifyjs')
+const linkifyHtml = require('linkifyjs/html')
@Injectable()
export class LinkifierService {
const TT_UNDERSCORE = TT.UNDERSCORE
const TT_DOT = TT.DOT
- function MENTION (value) {
+ function MENTION (value: any) {
this.v = value
}
this.formValidated()
}
- openVisitorModal (event) {
+ openVisitorModal (event: any) {
if (this.user === null) { // we only open it for visitors
// fixing ng-bootstrap ModalService and the "Expression Changed After It Has Been Checked" Error
event.srcElement.blur()
@Output() resetReply = new EventEmitter()
sanitizedCommentHTML = ''
- newParentComments = []
+ newParentComments: any = []
constructor (
private linkifierService: LinkifierService,
account: AccountInterface
totalReplies: number
by: string
- accountAvatarUrl
+ accountAvatarUrl: string
constructor (hash: VideoCommentServerModel) {
this.id = hash.id
return this.authHttp.post(url, normalizedComment)
.pipe(
- map(data => this.extractVideoComment(data['comment'])),
+ map((data: any) => this.extractVideoComment(data['comment'])),
catchError(err => this.restExtractor.handleError(err))
)
}
return this.authHttp.post(url, normalizedComment)
.pipe(
- map(data => this.extractVideoComment(data[ 'comment' ])),
+ map((data: any) => this.extractVideoComment(data[ 'comment' ])),
catchError(err => this.restExtractor.handleError(err))
)
}
threadComments: { [ id: number ]: VideoCommentThreadTree } = {}
threadLoading: { [ id: number ]: boolean } = {}
- syndicationItems = []
+ syndicationItems: any = []
private sub: Subscription
import { MetaService } from '@ngx-meta/core'
import { NotificationsService } from 'angular2-notifications'
import { forkJoin, Subscription } from 'rxjs'
-import * as videojs from 'video.js'
+const videojs = require('video.js')
import 'videojs-hotkeys'
import { Hotkey, HotkeysService } from 'angular2-hotkeys'
import * as WebTorrent from 'webtorrent'
@ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent
@ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent
- player: videojs.Player
+ player: any
playerElement: HTMLVideoElement
userRating: UserVideoRateType = null
video: VideoDetails = null
this.zone.runOutsideAngular(async () => {
videojs(this.playerElement, videojsOptions, function () {
self.player = this
- this.on('customError', (event, data) => self.handleError(data.err))
+ this.on('customError', (data: any) => self.handleError(data.err))
addContextMenu(self.player, self.video.embedUrl)
})
this.checkUserRating()
}
- private setRating (nextRating) {
+ private setRating (nextRating: string) {
let method
switch (nextRating) {
case 'like':
.subscribe(
() => {
// Update the video like attribute
- this.updateVideoRating(this.userRating, nextRating)
- this.userRating = nextRating
+ this.updateVideoRating(this.userRating, nextRating as VideoRateType)
+ this.userRating = nextRating as UserVideoRateType
},
- err => this.notificationsService.error(this.i18n('Error'), err.message)
+ (err: any) => this.notificationsService.error(this.i18n('Error'), err.message)
)
}
// If the store is full
private memoryChunks: { [ id: number ]: Buffer | true } = {}
private databaseName: string
- private putBulkTimeout
- private cleanerInterval
+ private putBulkTimeout: any
+ private cleanerInterval: any
private db: ChunkDatabase
private expirationDB: ExpirationDatabase
private readonly length: number
private readonly lastChunkLength: number
private readonly lastChunkIndex: number
- constructor (chunkLength: number, opts) {
+ constructor (chunkLength: number, opts: any) {
super()
this.databaseName = 'webtorrent-chunks-'
}, PeertubeChunkStore.BUFFERING_PUT_MS)
}
- get (index: number, opts, cb) {
+ get (index: number, opts: any, cb: any): any {
if (typeof opts === 'function') return this.get(index, null, opts)
// IndexDB could be slow, use our memory index first
const memoryChunk = this.memoryChunks[index]
if (memoryChunk === undefined) {
- const err = new Error('Chunk not found')
+ const err = new Error('Chunk not found') as any
err['notFound'] = true
return process.nextTick(() => cb(err))
})
}
- close (db) {
+ close (db: any) {
return this.destroy(db)
}
- async destroy (cb) {
+ async destroy (cb: any) {
try {
if (this.pendingPut) {
clearTimeout(this.putBulkTimeout)
}
}
- private nextTick (cb, err, val?) {
+ private nextTick (cb: any, err: Error, val?: any) {
process.nextTick(() => cb(err, val), undefined)
}
}
-import * as videojs from 'video.js'
import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
import { buildVideoLink } from './utils'
const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button')
class PeerTubeLinkButton extends Button {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
}
class PeerTubeLoadProgressBar extends Component {
- constructor (player, options) {
+ constructor (player: any, options: any) {
super(player, options)
this.partEls_ = []
this.on(player, 'progress', this.update)
enableVolumeScroll: false,
enableModifiersForNumbers: false,
- fullscreenKey: function (event) {
+ fullscreenKey: function (event: any) {
// fullscreen with the f key or Ctrl+Enter
return event.key === 'f' || (event.ctrlKey && event.key === 'Enter')
},
- seekStep: function (event) {
+ seekStep: function (event: any) {
// mimic VLC seek behavior, and default to 5 (original value is 5).
if (event.ctrlKey && event.altKey) {
return 5 * 60
customKeys: {
increasePlaybackRateKey: {
- key: function (event) {
+ key: function (event: any) {
return event.key === '>'
},
- handler: function (player) {
+ handler: function (player: any) {
player.playbackRate((player.playbackRate() + 0.1).toFixed(2))
}
},
decreasePlaybackRateKey: {
- key: function (event) {
+ key: function (event: any) {
return event.key === '<'
},
- handler: function (player) {
+ handler: function (player: any) {
player.playbackRate((player.playbackRate() - 0.1).toFixed(2))
}
},
frameByFrame: {
- key: function (event) {
+ key: function (event: any) {
return event.key === '.'
},
- handler: function (player, options, event) {
+ handler: function (player: any) {
player.pause()
// Calculate movement distance (assuming 30 fps)
const dist = 1 / 30
-import * as videojs from 'video.js'
+const videojs = require('video.js')
import * as WebTorrent from 'webtorrent'
import { VideoFile } from '../../../../shared/models/videos/video.model'
import { renderVideo } from './video-renderer'
import './settings-menu-button'
import { PeertubePluginOptions, UserWatching, VideoJSCaption, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
import { isMobile, timeToInt, videoFileMaxByResolution, videoFileMinByResolution } from './utils'
-import * as CacheChunkStore from 'cache-chunk-store'
+const CacheChunkStore = require('cache-chunk-store')
import { PeertubeChunkStore } from './peertube-chunk-store'
import {
getAverageBandwidthInStore,
private player: any
private currentVideoFile: VideoFile
- private torrent: WebTorrent.Torrent
+ private torrent: any
private videoCaptions: VideoJSCaption[]
- private renderer
- private fakeRenderer
+ private renderer: any
+ private fakeRenderer: any
private destoyingFakeRenderer = false
private autoResolution = true
private isAutoResolutionObservation = false
private playerRefusedP2P = false
- private videoViewInterval
- private torrentInfoInterval
- private autoQualityInterval
- private userWatchingVideoInterval
- private addTorrentDelay
- private qualityObservationTimer
- private runAutoQualitySchedulerTimer
+ private videoViewInterval: any
+ private torrentInfoInterval: any
+ private autoQualityInterval: any
+ private userWatchingVideoInterval: any
+ private addTorrentDelay: any
+ private qualityObservationTimer: any
+ private runAutoQualitySchedulerTimer: any
private downloadSpeeds: number[] = []
- constructor (player: videojs.Player, options: PeertubePluginOptions) {
+ constructor (player: any, options: PeertubePluginOptions) {
super(player, options)
// Disable auto play on iOS
const oldTorrent = this.torrent
const torrentOptions = {
- store: (chunkLength, storeOpts) => new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), {
+ store: (chunkLength: any, storeOpts: any) => new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), {
max: 100
})
}
if (err) return this.fallbackToHttp(options, done)
- return this.tryToPlay(err => {
+ return this.tryToPlay((err: Error) => {
if (err) return done(err)
if (options.seek) this.seek(options.seek)
}, options.delay || 0)
})
- this.torrent.on('error', err => console.error(err))
+ this.torrent.on('error', (err: any) => console.error(err))
this.torrent.on('warning', (err: any) => {
// We don't support HTTP tracker but we don't care -> we use the web socket tracker
const playPromise = this.player.play()
if (playPromise !== undefined) {
return playPromise.then(done)
- .catch(err => {
+ .catch((err: Error) => {
if (err.message.indexOf('The play() request was interrupted by a call to pause()') !== -1) {
return
}
this.player.options_.inactivityTimeout = saveInactivityTimeout
}
- const settingsDialog = this.player.children_.find(c => c.name_ === 'SettingsDialog')
+ const settingsDialog = this.player.children_.find((c: any) => c.name_ === 'SettingsDialog')
this.player.controlBar.on('mouseenter', () => disableInactivity())
settingsDialog.on('mouseenter', () => disableInactivity())
return this.videoFiles[Math.floor(this.videoFiles.length / 2)]
}
- private stopTorrent (torrent: WebTorrent.Torrent) {
+ private stopTorrent (torrent: any) {
torrent.pause()
// Pause does not remove actual peers (in particular the webseed peer)
torrent.removePeer(torrent[ 'ws' ])
const percent = time / this.player_.duration()
return percent >= 1 ? 1 : percent
}
- SeekBar.prototype.handleMouseMove = function handleMouseMove (event) {
+ SeekBar.prototype.handleMouseMove = function handleMouseMove (event: any) {
let newTime = this.calculateDistance(event) * this.player_.duration()
if (newTime === this.player_.duration()) {
newTime = newTime - 0.1
-import * as videojs from 'video.js'
+const videojs = require('video.js')
import { VideoFile } from '../../../../shared/models/videos/video.model'
import { PeerTubePlugin } from './peertube-videojs-plugin'
interface VideoJSComponentInterface {
_player: videojs.Player
- new (player: videojs.Player, options?: any)
+ new (player: videojs.Player, options?: any): any
- registerComponent (name: string, obj: any)
+ registerComponent (name: string, obj: any): any
}
type VideoJSCaption = {
-import * as videojs from 'video.js'
import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
import { ResolutionMenuItem } from './resolution-menu-item'
class ResolutionMenuButton extends MenuButton {
label: HTMLElement
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
this.player = player
-import * as videojs from 'video.js'
import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem')
class ResolutionMenuItem extends MenuItem {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
const currentResolutionId = player.peertube().getCurrentResolutionId()
options.selectable = true
options.selected = options.id === currentResolutionId
player.peertube().on('autoResolutionUpdate', () => this.updateSelection())
}
- handleClick (event) {
+ handleClick (event: any) {
if (this.id === -1 && this.player_.peertube().isAutoResolutionForbidden()) return
super.handleClick(event)
// Author: Yanko Shterev
// Thanks https://github.com/yshterev/videojs-settings-menu
-import * as videojs from 'video.js'
+const videojs = require('video.js')
import { SettingsMenuItem } from './settings-menu-item'
import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
import { toTitleCase } from './utils'
const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component')
class SettingsButton extends Button {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
this.playerComponent = player
}
}
- onDisposeSettingsItem (event, name: string) {
+ onDisposeSettingsItem (name: string) {
if (name === undefined) {
let children = this.menu.children()
}
}
- onAddSettingsItem (event, data) {
+ onAddSettingsItem (data: any) {
const [ entry, options ] = data
this.addMenuItem(entry, options)
this.resetChildren()
}
- getComponentSize (element) {
+ getComponentSize (element: any) {
let width: number = null
let height: number = null
this.panelChild.addChild(this.menu)
}
- addMenuItem (entry, options) {
+ addMenuItem (entry: any, options: any) {
const openSubMenu = function () {
if (videojsUntyped.dom.hasClass(this.el_, 'open')) {
videojsUntyped.dom.removeClass(this.el_, 'open')
}
class SettingsPanel extends Component {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
}
}
class SettingsPanelChild extends Component {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
}
}
class SettingsDialog extends Component {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
this.hide()
}
// Author: Yanko Shterev
// Thanks https://github.com/yshterev/videojs-settings-menu
-import * as videojs from 'video.js'
import { toTitleCase } from './utils'
import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
class SettingsMenuItem extends MenuItem {
- constructor (player: videojs.Player, options, entry: string, menuButton: VideoJSComponentInterface) {
+ constructor (player: any, options: any, entry: string, menuButton: VideoJSComponentInterface) {
super(player, options)
this.settingsButton = menuButton
this.transitionEndHandler = this.onTransitionEnd.bind(this)
}
- onSubmenuClick (event) {
+ onSubmenuClick (event: any) {
let target = null
if (event.type === 'tap') {
*
* @method PrefixedEvent
*/
- PrefixedEvent (element, type, callback, action = 'addEvent') {
+ PrefixedEvent (element: any, type: any, callback: any, action = 'addEvent') {
let prefix = ['webkit', 'moz', 'MS', 'o', '']
for (let p = 0; p < prefix.length; p++) {
}
}
- onTransitionEnd (event) {
+ onTransitionEnd (event: any) {
if (event.propertyName !== 'margin-right') {
return
}
)
}
- update (event?: Event) {
+ update (event?: any) {
let target = null
let subMenu = this.subMenu.name()
private static readonly THEATER_MODE_CLASS = 'vjs-theater-enabled'
- constructor (player, options) {
+ constructor (player: any, options: any) {
super(player, options)
const enabled = getStoredTheater()
{ max: 1073741824, type: 'MB' },
{ max: 1.0995116e12, type: 'GB' }
]
-function bytes (value) {
+function bytes (value: any) {
const format = dictionaryBytes.find(d => value < d.max) || dictionaryBytes[dictionaryBytes.length - 1]
const calc = Math.floor(value / (format.max / 1024)).toString()
// Thanks: https://github.com/feross/render-media
// TODO: use render-media once https://github.com/feross/render-media/issues/32 is fixed
-import * as MediaElementWrapper from 'mediasource'
+const MediaElementWrapper = require('mediasource')
import { extname } from 'path'
-import * as videostream from 'videostream'
+const videostream = require('videostream')
const VIDEOSTREAM_EXTS = [
'.m4a',
}
function renderVideo (
- file,
+ file: any,
elem: HTMLVideoElement,
opts: RenderMediaOptions,
callback: (err: Error, renderer: any) => void
return renderMedia(file, elem, opts, callback)
}
-function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) {
+function renderMedia (file: any, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) {
const extension = extname(file.name).toLowerCase()
- let preparedElem = undefined
+ let preparedElem: any = undefined
let currentTime = 0
- let renderer
+ let renderer: any
try {
if (VIDEOSTREAM_EXTS.indexOf(extension) >= 0) {
function useVideostream () {
prepareElem()
- preparedElem.addEventListener('error', function onError (err) {
+ preparedElem.addEventListener('error', function onError (err: Error) {
preparedElem.removeEventListener('error', onError)
return callback(err)
const codecs = getCodec(file.name, useVP9)
prepareElem()
- preparedElem.addEventListener('error', function onError (err) {
+ preparedElem.addEventListener('error', function onError (err: Error) {
preparedElem.removeEventListener('error', onError)
// Try with vp9 before returning an error
}
}
-function validateFile (file) {
+function validateFile (file: any) {
if (file == null) {
throw new Error('file cannot be null or undefined')
}
subDivHttp.appendChild(subDivHttpText)
div.appendChild(subDivHttp)
- this.player_.peertube().on('torrentInfo', (event, data) => {
+ this.player_.peertube().on('torrentInfo', (data: any) => {
// We are in HTTP fallback
if (!data) {
subDivHttp.className = 'vjs-peertube-displayed'
import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
import { buildFileLocale } from '../../shared'
-let providers = []
+let providers: any[] = []
if (environment.production) {
enableProdMode()
}
* BROWSER POLYFILLS
*/
-/** IE9, IE10 and IE11 requires all of the following polyfills. **/
+/**
+ * IE9, IE10 and IE11 requires all of the following polyfills.
+ */
// For Google Bot
-import 'core-js/es6/symbol';
-import 'core-js/es6/object';
-import 'core-js/es6/function';
-import 'core-js/es6/parse-int';
-import 'core-js/es6/parse-float';
-import 'core-js/es6/number';
-import 'core-js/es6/math';
-import 'core-js/es6/string';
-import 'core-js/es6/date';
-import 'core-js/es6/array';
-import 'core-js/es6/regexp';
-import 'core-js/es6/map';
-import 'core-js/es6/weak-map';
-import 'core-js/es6/set';
-import 'core-js/es7/object';
+import 'core-js/es6/symbol'
+import 'core-js/es6/object'
+import 'core-js/es6/function'
+import 'core-js/es6/parse-int'
+import 'core-js/es6/parse-float'
+import 'core-js/es6/number'
+import 'core-js/es6/math'
+import 'core-js/es6/string'
+import 'core-js/es6/date'
+import 'core-js/es6/array'
+import 'core-js/es6/regexp'
+import 'core-js/es6/map'
+import 'core-js/es6/weak-map'
+import 'core-js/es6/set'
+import 'core-js/es7/object'
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following for the Reflect API. */
// For Google Bot
-import 'core-js/es6/reflect';
+import 'core-js/es6/reflect'
-/** Evergreen browsers require these. **/
+/**
+ * Evergreen browsers require these.
+ */
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect'
-
/**
* Required to support Web Animations `@angular/platform-browser/animations`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
- **/
+ */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
*/
// (window as any).__Zone_enable_cross_context_check = true;
-
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone' // Included with Angular CLI.
-
/***************************************************************************************************
* APPLICATION IMPORTS
*/
// global/process polyfills
-;(window as any).global = window;
-;(window as any).process = require('process/');
-;(window as any).Buffer = require('buffer/').Buffer;
+;(window as any).global = window
+;(window as any).process = require('process/')
+;(window as any).Buffer = require('buffer/').Buffer
// Does nothing. Used to shim out node.js modules
// which are no-ops in the browser.
-export const NOOP = 0
\ No newline at end of file
+export const NOOP = 0
// For google bot that uses Chrome 41 and does not understand fetch
import 'whatwg-fetch'
-import * as vjs from 'video.js'
+const vjs = require('video.js')
import * as Channel from 'jschannel'
import { peertubeTranslate, ResultList, VideoDetails } from '../../../../shared'
this.playerOptions = videojsOptions
this.player = vjs(this.videoContainerId, videojsOptions, () => {
- this.player.on('customError', (event, data) => this.handleError(data.err))
+ this.player.on('customError', (data: any) => this.handleError(data.err))
window[ 'videojsPlayer' ] = this.player
updateRates()
})
- let updateResolutions = resolutions => {
+ let updateResolutions = ((resolutions: any) => {
let resolutionListEl = document.querySelector('#resolution-list')
resolutionListEl.innerHTML = ''
- resolutions.forEach(resolution => {
+ resolutions.forEach((resolution: any) => {
if (resolution.active) {
let itemEl = document.createElement('strong')
itemEl.innerText = `${resolution.label} (active)`
resolutionListEl.appendChild(itemEl)
}
})
- }
+ })
player.getResolutions().then(
resolutions => updateResolutions(resolutions))
declare var module: NodeModule;
interface NodeModule {
id: string;
+ [key: string]: any
}
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
- "noImplicitAny": false,
+ "noImplicitAny": true,
+ "suppressImplicitAnyIndexErrors":true,
"alwaysStrict": true,
"target": "es5",
"typeRoots": [
export const LOCALE_FILES = [ 'player', 'server' ]
-export const I18N_LOCALES = {
+export const I18N_LOCALES: any = {
'en-US': 'English',
'fr-FR': 'Français',
'eu-ES': 'Euskara',
'zh-Hans-CN': '简体中文(中国)'
}
-const I18N_LOCALE_ALIAS = {
+const I18N_LOCALE_ALIAS: any = {
'en': 'en-US',
'fr': 'fr-FR',
'eu': 'eu-ES',
tag: string
videos: Video[]
}[]
+ [key: string]: any
}
'480p': boolean
'720p': boolean
'1080p': boolean
+ [key: string]: boolean
}
}
blockedReason?: string
videoQuotaUsed?: number
+ [key: string]: any
}