question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to load audio from video tag

See original GitHub issue

Hey, thank you for testing and contributing to wavesurfer.js!

Please make sure you can check all of these points below before opening an issue:

(You don’t have to post this section)

  • I have checked the FAQ and it doesn’t solve my problem.
  • I have checked the documentation and it doesn’t solve my problem
  • I have searched for already open issues which desribe my problem.
  • The issue I’m having is related to and caused by wavesurfer.js, not by other software (which maybe packages and uses wavesurfer incorrectly) – In that case you should open the issue on the respective project pages.

Please make sure you provide the following information (if applicable):

Wavesurfer.js version(s):

  • 3.0.0
  • 3.1.0

Browser and operating system version(s):

Chrome 77.0.3865.90 macOS Mojave 10.14.6

Code needed to reproduce the issue:

https://codepen.io/qbunt/pen/GRKVBrd

let wavesurfer = WaveSurfer.create({
          container: document.querySelector('#waveform'),
          waveColor: '#A8DBA8',
          progressColor: '#3B8686',
          backend: 'MediaElement'
})
let video = document.querySelector('video')
wavesurfer.load(video)

Use behaviour needed to reproduce the issue:

I originally encountered this in Vue, but have since validated that it shows up in all contexts and is not related to Vue at all. When attempting to start WaveSurfer with a MediaElement backend, and load a video element as the audio source, as shown in the docs, I get the following error consistently in every framework, and back to 3.0.0:

Uncaught Error: fetch url missing
    at Object.t.default (fetch.js:118)
    at t.value (wavesurfer.js:1448)
    at t.value (wavesurfer.js:1398)
    at t.value (wavesurfer.js:1322)
    at pen.js:11

Either this is something incorrect in the documentation, or something in Chrome changed and the URL isn’t landing in the fetch call due to an incorrect reference or similar.

Of course, if this is something obvious that I’m doing wrong, I’d be happy to update the docs if that is the issue. Thanks so much, great lib!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:15

github_iconTop GitHub Comments

5reactions
davegravycommented, Jan 3, 2020

@aburai Do you know off-hand if the spectrogram plugin will load video as an audio element properly? I have the waveform working, the spectrogram plugin is throwing an error because it would appear that the backend (of MediaElement type`) does not have a buffer attached to the instance.

wavesurfer.spectrogram.js?e59a:609 Uncaught TypeError: Cannot read property 'getChannelData' of null
    at SpectrogramPlugin.getFrequencies (wavesurfer.spectrogram.js?e59a:609)
    at SpectrogramPlugin.render (wavesurfer.spectrogram.js?e59a:574)
    at t.SpectrogramPlugin._onReady (wavesurfer.spectrogram.js?e59a:470)
    at n (wavesurfer.min.js?b9b7:6)
    at eval (wavesurfer.min.js?b9b7:6)
    at Array.forEach (<anonymous>)
    at t.value (wavesurfer.min.js?b9b7:6)
    at t.eval (wavesurfer.min.js?b9b7:6)
    at n (wavesurfer.min.js?b9b7:6)
    at eval (wavesurfer.min.js?b9b7:6)

Which leads to:

value: function getFrequencies(callback) {
      var fftSamples = this.fftSamples;
      var buffer = this.buffer = this.wavesurfer.backend.buffer;
      var channelOne = buffer.getChannelData(0);
      var bufferLength = buffer.length;
      var sampleRate = buffer.sampleRate;
      var frequencies = [];

After setting some breakpoints, it looks like buffer, this.buffer and this.wavesurfer.backend.buffer are all null.

I ran into this same issue

2reactions
purva15commented, Feb 23, 2022

@qbunt @aburai What can I do for this? let wavesurfer = WaveSurfer.create({ container: document.querySelector(‘#waveform’), waveColor: ‘#A8DBA8’, progressColor: ‘#3B8686’, backend: ‘MediaElement’ }) let video = document.querySelector(‘video’) wavesurfer.load(video)

When attempting to start WaveSurfer with a MediaElement backend, and load a video element as the audio source, as shown in the docs, I get the following error consistently in every framework:

Uncaught Error: fetch url missing at Object.t.default (fetch.js:118) at t.value (wavesurfer.js:1448) at t.value (wavesurfer.js:1398) at t.value (wavesurfer.js:1322) at pen.js:11

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't download html5 video/audio on IE and FireFox
I put mp3 and mp4 files on my website with audio/video html5 tags. I want this files can be download by users, and...
Read more >
Video and audio content - Learn web development | MDN
The <video> element allows you to embed a video very easily. ... Users must be able to control video and audio playback (it's...
Read more >
ngSrc doesn't work properly with HTML5 Video Source tag
In firefox, ngSrc directive on video elements' tag doesn't work at all, and results in unsupported video format error.
Read more >
Fast playback with audio and video preload - web.dev
In this article I'll explore techniques you can use to accelerate your audio and video playback by actively preloading resources depending ...
Read more >
HTML Audio/Video DOM error Event - W3Schools
HTML Audio/Video DOM error Event ... Alert that an error occured while loading the video: var vid = document. ... Supported HTML tags:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found