有时候我想使用videogular2播放视频时,出现以下错误: 错误无法读取未定义的属性'bufferDetected'和无法读取未定义的属性'play'。
我使用角度5和“ videogular2”:“ 6.0.1”。
我已经尝试过此https://github.com/videogular/videogular2/issues/560,但没有用,在进行这些更改后无法再播放视频,我还尝试将videogular2降级为5.4.11。
这是我的模板
<vg-player>
<vg-overlay-play></vg-overlay-play>
<vg-buffering></vg-buffering>
<vg-scrub-bar>
<vg-scrub-bar-current-time></vg-scrub-bar-current-time>
<vg-scrub-bar-buffering-time></vg-scrub-bar-buffering-time>
</vg-scrub-bar>
<vg-controls>
<vg-play-pause></vg-play-pause>
<vg-time-display vgProperty="current" vgFormat="mm:ss"></vg-time-display>
<vg-scrub-bar style="pointer-events: none;"></vg-scrub-bar>
<vg-time-display vgProperty="total" vgFormat="mm:ss"></vg-time-display>
<vg-mute></vg-mute>
<vg-volume></vg-volume>
<vg-fullscreen></vg-fullscreen>
</vg-controls>
<video [vgMedia]="media" #media id="singleVideo" preload="auto" [attr.data-asset-id]="id">
<source [src]="src" type="video/mp4">
</video>
</vg-player>
这是我的组件:
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
@Component({
selector: 'player',
templateUrl: './player.template.html',
})
export class PlayerComponent implements OnInit {
@Input() src: string;
@Input() id: string;
@ViewChild('media') media: ElementRef;
@Output('videoElement') videoElement = new EventEmitter<ElementRef>();
constructor() { }
ngOnInit() {
this.videoElement.emit(this.media);
}
}
这些是我收到的实际错误。
https://user-images.githubusercontent.com/22517445/60588402-8ba94d00-9d9f-11e9-8098-4154a49478b9.png