0

In my Angular application, I'm opening a WAV file in browser and want to play it in the browser. The following code works in Chrome and Firefox, but in Edge v41 I get error on statement of this.audioElement.src = this.audioSrcURL;:

ERROR Error: Invalid argument. [object Error]: {description: "Invalid argument.", message: "Invalid argument.", ngDebugContext: Object, ngErrorLogger: function() { [native code] }, number: -2147024809...}

ERROR CONTEXT [object Object] [object Object]: {component: Object, componentRenderElement: Object, context: Object, elDef: Object, elOrCompView: Object...}

My code is:

  <audio #myAudio controls controlsList="nodownload">
     <source src="" type="audio/x-wav" />
  </audio>

  @ViewChild('myAudio', { static: true }) myAudio: any;
  audioElement: HTMLAudioElement;
  audioSrcURL: string;
  ngOnInit() {
    this.audioElement = this.myAudio.nativeElement;
  }

  createObjectURL(inputFile: File): void {
    if (window.URL && window.URL.createObjectURL) {
      this.audioSrcURL = window.URL.createObjectURL(inputFile);
      this.audioElement.src = this.audioSrcURL; // ---> ERROR HERE
    }
  }

Why do I get error "Invalid argument." ? What could be going wrong with this is Edge browser?

user5155835
  • 4,392
  • 4
  • 53
  • 97
  • MS Edge 41 is too old version. Current version is Edge 44. can you please try to test with latest version of Edge to see whether it helps to solve the issue or not? – Deepak-MSFT Dec 18 '19 at 13:34
  • @Deepak-MSFT Upgraded to Edge 44 but the audio is not being played. Please can you take a look at this question: https://stackoverflow.com/questions/60155376/play-wav-audio-file-in-edge-with-angular-javascript – user5155835 Feb 10 '20 at 17:28

0 Answers0