Commit 3c29c23e authored by Ben Hayward's avatar Ben Hayward

Changed sentry logic and player autoplay.

1 merge request!712Plyr play error
Pipeline #107939163 running with stages
......@@ -75,9 +75,26 @@ import { UpgradesModule } from './modules/upgrades/upgrades.module';
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: 'https://3f786f8407e042db9053434a3ab527a2@sentry.io/1538008', // TODO: do not hardcard
dsn: 'https://2c055120c4384ee8a62f580bcec36e32@sentry.io/1875291',
release: environment.version,
environment: (<any>window.Minds).environment || 'development',
beforeSend(event) {
try {
if (
event.extra.__serialized__.stack === '[undefined]' || // this works, tested and it stops the error i can reproduce
event.extra.__serialized__stack === '[native code]' // this I'm basing off the stack trace only having [native code] on some issues.
) {
return null;
}
const stackFrames = event.exception.values['0'].stacktrace.frames;
if (stackFrames[stackFrames.length].filename.includes('plyr')) {
//crawled the object to get
return null;
}
} catch (e) {}
return event;
},
});
@Injectable()
......
......@@ -7,6 +7,7 @@ import {
Output,
EventEmitter,
ChangeDetectorRef,
AfterViewInit,
} from '@angular/core';
import { PLAYER_ANIMATIONS } from './player.animations';
import { VideoPlayerService, VideoSource } from './player.service';
......@@ -20,7 +21,8 @@ import { PlyrComponent } from 'ngx-plyr';
animations: PLAYER_ANIMATIONS,
providers: [VideoPlayerService],
})
export class MindsVideoPlayerComponent implements OnInit, OnDestroy {
export class MindsVideoPlayerComponent
implements OnInit, OnDestroy, AfterViewInit {
/**
* MH: dislike having to emit an event to open modal, but this is
* the quickest work around for now
......@@ -55,6 +57,8 @@ export class MindsVideoPlayerComponent implements OnInit, OnDestroy {
],
};
_autoplay;
constructor(
private service: VideoPlayerService,
private cd: ChangeDetectorRef
......@@ -67,6 +71,11 @@ export class MindsVideoPlayerComponent implements OnInit, OnDestroy {
});
}
ngAfterViewInit() {
// Set autoplay here to avoid having to use a timeout.
this.options.autoplay = this._autoplay;
}
ngOnDestroy(): void {}
@Input('guid')
......@@ -76,9 +85,7 @@ export class MindsVideoPlayerComponent implements OnInit, OnDestroy {
@Input('autoplay')
set autoplay(autoplay: boolean) {
setTimeout(() => {
this.options.autoplay = autoplay;
}, 0);
this._autoplay = autoplay;
}
@Input('isModal')
......
Please register or to comment