首页 > 解决方案 > Mute attribute in "mat-video" npm module

问题描述

I'm using mat-video component (npm i mat-video) for playing a video in my angular app. Its pretty good.

       <mat-video style="min-height: 30%" quality="false" title="My Tutorial Title" loop="true" [autoplay]="true" [preload]="true" [fullscreen]="true" [download]="false" color="accent" spinner="spin" poster="assets/images/CICDBlog.png">
          <source matVideoSource src="assets/videos/samplevideo.mp4" type="video/mp4">
          <source src="tutorial.webm" type="video/webm">
          <track matVideoTrack src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
          <track src="subtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
        </mat-video>

Do we have such attribute(ex, muted="true") to mute the video after loading the page? I would like to set autoplay="true".

标签: angularnpm

解决方案


在您的文件中使用以下代码.ts

this.matVideo.muted = true;

推荐阅读