]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/video-watch/video-watch.component.ts
Fix page titles
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-watch / video-watch.component.ts
index 808e0eda983d12834d06105ad05b002701f9d430..12ddf3eef450f292e9c2cc1b9b98d73a35c74317 100644 (file)
@@ -3,8 +3,8 @@ import { ActivatedRoute, Router } from '@angular/router'
 import { Observable } from 'rxjs/Observable'
 import { Subscription } from 'rxjs/Subscription'
 
-import * as videojs from 'video.js'
-import { MetaService } from '@nglibs/meta'
+import videojs from 'video.js'
+import { MetaService } from '@ngx-meta/core'
 import { NotificationsService } from 'angular2-notifications'
 
 import { AuthService, ConfirmService } from '../../core'
@@ -74,7 +74,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 
     const videojsOptions = {
       controls: true,
-      autoplay: false
+      autoplay: true
     }
 
     const self = this
@@ -127,11 +127,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
       this.loading = false
 
       console.log('Added ' + this.video.magnetUri + '.')
-      torrent.files[0].renderTo(this.playerElement, { autoplay: true }, (err) => {
+      torrent.files[0].renderTo(this.playerElement, (err) => {
         if (err) {
           this.notificationsService.error('Error', 'Cannot append the file in the video element.')
           console.error(err)
         }
+
+        // Hack to "simulate" src link in video.js >= 6
+        // If no, we can't play the video after pausing it
+        // https://github.com/videojs/video.js/blob/master/src/js/player.js#L1633
+        (this.player as any).src = () => true
+
+        this.player.play()
       })
 
       this.runInProgress(torrent)
@@ -249,7 +256,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 
     this.videoService.getUserVideoRating(this.video.id)
                      .subscribe(
-                       (ratingObject: UserVideoRate) => {
+                       ratingObject => {
                          if (ratingObject) {
                            this.userRating = ratingObject.rating
                          }