Run videojs outside angular
authorChocobozzz <me@florianbigard.com>
Wed, 10 Jan 2018 16:36:35 +0000 (17:36 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 10 Jan 2018 16:36:35 +0000 (17:36 +0100)
client/src/app/videos/+video-watch/video-watch.component.ts
server/tests/api/server/handle-down.ts

index f02bae6304dd2887f0c75d95ede0409f2f717615..f6f043b9c183ad7ed462a008f088ae0be444324a 100644 (file)
@@ -1,4 +1,4 @@
-import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core'
+import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
 import { MetaService } from '@ngx-meta/core'
 import { NotificationsService } from 'angular2-notifications'
@@ -60,7 +60,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     private metaService: MetaService,
     private authService: AuthService,
     private notificationsService: NotificationsService,
-    private markdownService: MarkdownService
+    private markdownService: MarkdownService,
+    private zone: NgZone
   ) {}
 
   get user () {
@@ -338,10 +339,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
           this.videoPlayerLoaded = true
 
           const self = this
-          videojs(this.playerElement, videojsOptions, function () {
-            self.player = this
-            this.on('customError', (event, data) => {
-              self.handleError(data.err)
+          this.zone.runOutsideAngular(() => {
+            videojs(this.playerElement, videojsOptions, function () {
+              self.player = this
+              this.on('customError', (event, data) => {
+                self.handleError(data.err)
+              })
             })
           })
         } else {
index da134c09fd0dbc3e6f2aaa7aea50f8e4c0be68cd..f8ba8bd6648252ea911f3d4f097dc3f607a58a02 100644 (file)
@@ -133,7 +133,6 @@ describe('Test handle downs', function () {
     expect(videoServer2).not.to.be.undefined
 
     await completeVideoCheck(servers[1].url, videoServer2, checkAttributes)
-
   })
 
   after(async function () {