12345678910 |
- /**
- * @copyright © 未来飞马 © 未来全栈 www.fmode.cn
- * 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
- * 保留所有权利 All Rights Reserved.
- * /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/video/fm-video/fm-video.component.mjs
- */
- import{CommonModule}from"@angular/common";import{Component,Input,ElementRef,ViewChild}from"@angular/core";import*as i0 from"@angular/core";export class FmVideoComponent{constructor(){this.url="",this.video=document.createElement("video"),this.canvasStyle={},this.video.crossOrigin="anonymous"}ngOnChanges(e){e.url&&e.url.currentValue&&this.play(this.url)}play(e){try{this.video.muted=!0,this.video.loop=!0,this.video.controls=!1,this.video.src=e,this.video.playsInline=!0,this.video.load(),this.video.play().then((()=>{})).catch((()=>{setTimeout((()=>{this.play(e)}),200)}))}catch(t){return void setTimeout((()=>{this.play(e)}),500)}this.ctx||(this.ctx=this.canvasRef.nativeElement.getContext("2d"),this.video.addEventListener("loadeddata",(()=>{this.canvasRef.nativeElement.width=this.video.videoWidth,this.canvasRef.nativeElement.height=this.video.videoHeight,this.drawFrame()})))}drawFrame(){this.video.paused||this.video.ended||(this.ctx.drawImage(this.video,0,0,this.canvasRef.nativeElement.width,this.canvasRef.nativeElement.height),requestAnimationFrame((()=>this.drawFrame())))}static{this.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:FmVideoComponent,deps:[],target:i0.ɵɵFactoryTarget.Component})}static{this.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"14.0.0",version:"17.3.12",type:FmVideoComponent,isStandalone:!0,selector:"fm-video",inputs:{url:"url",canvasStyle:"canvasStyle"},viewQueries:[{propertyName:"canvasRef",first:!0,predicate:["videoCanvas"],descendants:!0,static:!0}],usesOnChanges:!0,ngImport:i0,template:'<canvas #videoCanvas [style]="canvasStyle"></canvas>',styles:[":host{display:flex;justify-content:center;align-items:center;overflow:hidden}canvas{max-height:100%;width:auto;height:auto;background:transparent}\n"],dependencies:[{kind:"ngmodule",type:CommonModule}]})}}i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:FmVideoComponent,decorators:[{type:Component,args:[{selector:"fm-video",standalone:!0,imports:[CommonModule],template:'<canvas #videoCanvas [style]="canvasStyle"></canvas>',styles:[":host{display:flex;justify-content:center;align-items:center;overflow:hidden}canvas{max-height:100%;width:auto;height:auto;background:transparent}\n"]}]}],ctorParameters:()=>[],propDecorators:{url:[{type:Input}],canvasRef:[{type:ViewChild,args:["videoCanvas",{static:!0}]}],canvasStyle:[{type:Input}]}});
- var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi92aWRlby9mbS12aWRlby9mbS12aWRlby5jb21wb25lbnQubWpz`
-
|