]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/+video-edit/shared/video-image.component.ts
Sort video captions
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-edit / shared / video-image.component.ts
index 25955baaaabd6a50443da67696479dd03840e6ef..a604cde90c13f80801022174c3dc83d8933f301a 100644 (file)
@@ -2,8 +2,6 @@ import { Component, forwardRef, Input } from '@angular/core'
 import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
 import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
 import { ServerService } from '@app/core'
-import { NotificationsService } from 'angular2-notifications'
-import { I18n } from '@ngx-translate/i18n-polyfill'
 
 @Component({
   selector: 'my-video-image',
@@ -25,36 +23,26 @@ export class VideoImageComponent implements ControlValueAccessor {
 
   imageSrc: SafeResourceUrl
 
-  private file: Blob
+  private file: File
 
   constructor (
     private sanitizer: DomSanitizer,
-    private serverService: ServerService,
-    private notificationsService: NotificationsService,
-    private i18n: I18n
+    private serverService: ServerService
   ) {}
 
   get videoImageExtensions () {
-    return this.serverService.getConfig().video.image.extensions.join(',')
+    return this.serverService.getConfig().video.image.extensions
   }
 
   get maxVideoImageSize () {
     return this.serverService.getConfig().video.image.size.max
   }
 
-  fileChange (event: any) {
-    if (event.target.files && event.target.files.length) {
-      const [ file ] = event.target.files
-
-      if (file.size > this.maxVideoImageSize) {
-        this.notificationsService.error(this.i18n('Error'), this.i18n('This image is too large.'))
-        return
-      }
+  onFileChanged (file: File) {
+    this.file = file
 
-      this.file = file
-      this.propagateChange(this.file)
-      this.updatePreview()
-    }
+    this.propagateChange(this.file)
+    this.updatePreview()
   }
 
   propagateChange = (_: any) => { /* empty */ }