Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
import {AppGlobal} from "../../service/http.service";
declare let jwplayer: any;
@Component({
selector: 'videoi',
templateUrl: 'videoi.html'
})
export class VideoiComponent implements OnChanges {
@Input() inputValue;
url = AppGlobal.domain + "/wisdomgroup";
player;
videoUrl;
constructor() {
console.log('Hello VideoiComponent Component');
}
ngOnChanges(change: SimpleChanges) {
if (change['inputValue'] && change['inputValue'].currentValue.length > 0) {
this.videoUrl = change['inputValue'].currentValue;
console.dir(change['inputValue'].currentValue);
this.initVideo();
}
}
initVideo() {
this.player = jwplayer('video-play').setup({
flashplayer: "../../assets/jwplayer/jwplayer.flash.swf",//调用播放器
file: this.url + this.videoUrl,//调用视频文件
width: '100%',//播放器宽
aspectratio: "10:6",//自适应宽高比例,如果设置宽高比,可设置宽度100%,高度不用设置
image: "",//视频预览图片
controlbar: "over",//控制条位置
screencolor: "#fff",//播放器颜色
});
}
}