How to mute and unmute sound in Angular2?

Images
Related searches

I have a sound in my Angular project, like this:

introInfo() {
   this.audio.src = '../assets/sound1.wav';
   this.audio.load();
   this.audio.play();
 }

 feedbackInfo() {
   this.audio.src = '../assets/sound1.wav';
   this.audio.load();
   // auto-start
   this.audio.play();
 }

And I would like to be able to mute all sounds. If I click the button in my template:

<img class="grow" id="mute" [src]='mute' (click)="muteF()"/>

How could I write my function muteF? I would like to mute if I click the button. If I click a second time, it must perform unmute.


This works for me

  muteF() {
    if (this.audio.volume !== 0) {
      this.audio.volume = 0;
    } else {
      this.audio.volume = 1;
    }
  }

Mute Video By Js, A substantial shift occurred in 2016 on the release of Angular 2 (and the dropping of the Muting/unmuting volume work independently from the volume control. How to mute and unmute sound in Angular2? Ask Question Asked 2 years, 6 months ago. Active 6 days ago. Viewed 1k times 5. 1. I have a sound in my Angular project


something like this probably (unless angular has audio-specific features, for example).

Component
import { ElementRef, Inject, Injectable, ViewChild } from '@angular/core';

@Injectable()
export class MyService {
  @ViewChild('audio') audio: ElementRef

  constructor(/* DOCUMENT would be an option too, from @angular/platform-browser - `@Inject(DOCUMENT) private document: any` */) {}
  introInfo() {
    this.audio.nativeElement.load()
    this.audio.nativeElement.play()
  }
//...
}

then in the template

template
<audio #audio></audio>

Mute and Unmute Yourself, Click the Mic or Phone icon at the very top of the toolbar. Your audio is currently connecting via Computer mode (mic and speakers). You are unmuted (and� Run the Sound Playback Troubleshooter at Settings > Update & Security > Troubleshoot. Go to Device Manager reached by right clicking the Start button, choose the Sound controller device, then Driver tab, choose Roll Back Driver if that's available, if not choose Uninstall button and restart PC to reinstall driver.


You can use muted property such as

this.audio.muted = true;

Works for video element as well.

Source: https://www.w3schools.com/tags/av_prop_muted.asp

Video muted attribute not working � Issue #23009 � angular/angular , I'm submitting a [ ] Regression (a behavior that used to work and stopped working in a new release) [x] Bug report [ ] Feature request� How to Mute or Unmute on Zoom. Zoom is a software you can use on Mac or Windows, as well as a mobile app for Android and iOS phones/tablets. This wikiHow will teach you how to mute or unmute yourself as well as how to set up and use the


howler, muted: Boolean optional True to mute and false to unmute. id: Number optional The sound ID. If none is passed, all sounds in group are stopped. To mute all participants, tap "Mute All" in the bottom right hand corner, then tap the blue "Mute All" button to confirm the change. You can check the option to allow participants to unmute


How to mute/unmute sound using pywin32?, My searches lead me to the Pywin32 which should be able to mute/unmute the sound and detect its state (on Windows 10, using Python 3+). I found a way using � That will mute all the audio/sound coming from the website active in the tab until you unmute it. Consequently, this will (indirectly) mute everyone in the Google Meet call.


Mute All / Unmute All: Mute or unmute all participants currently in the meeting. Mute participants on entry: Automatically mute participants as they join the meeting. Play enter/exit chime: Play a sound when participants join and leave the meeting; Lock meeting: Don't allow other participants to join the meeting in progress.