ss正文主要实现功能,在视频js的控制栏(controlBar )中添加定制的放大功能
1、主要使用到三个类菜单、菜单、菜单
constmenubutton=video js.get component (menu button ) ) constmenu=videojs.getcomponent ) menu ' ) const menuitem=video jj
2、组装
const items=['100% ',' 80% ',' 50% ',' auto ' ] const my menu=newmenu (this.player ) constmymenuitemlist=[ ] I ) my menuitem list.push (new menuitem (this.player,{ label: items[i] } ) ) mymenuitemlist[I].on ) click
this.player.my menu=my menu this.player.my menuitem list=mymenuitemlistconstmymenubutton=newmenubutton (this.playes ) this.player.my menu button=mymenubuttonthis.player.control bar.addchild (my menu button,{ } ) this.play ()//接收
setshowpercent($event,videoWidth ) { const percent=$event? $ event.target.innertext :视频width 1080? ' 80 % ' : ' auto ' this.show percent.width=percent this.player.my menu button.El (.attributes [0] . owner elect.innerhtml=percent this.player.my menuitem list.foreach (e={ e.toggle class (' vjs-selected ', e.options_.options play () this.player.src (src : this.$ getfilepreviewurl ) this.fileid ),type : this.src
Home | Video.js Documentation