Skip to content
videoi.ts 1.27 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
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",//播放器颜色
        });
    }


}