Skip to content

Commit

Permalink
Merge 124abfc into f6cace1
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Jul 10, 2019
2 parents f6cace1 + 124abfc commit d77d6fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
@@ -1,6 +1,13 @@
videojs-wavesurfer changelog
============================

2.9.0 - unreleased
------------------

- Replace usage of `WaveSurfer.util.ajax()` with `WaveSurfer.util.fetchFile()`
- Bump required wavesurfer.js version to 3.0.0


2.8.0 - 2019/03/18
------------------

Expand Down
14 changes: 7 additions & 7 deletions src/js/videojs.wavesurfer.js
Expand Up @@ -300,23 +300,23 @@ class Wavesurfer extends Plugin {
this.surfer.load(url, peaks);
} else {
// load peak data from file
let ajaxOptions = {
let requestOptions = {
url: peaks,
responseType: 'json'
};
// supply xhr options, if any
if (this.player.options_.plugins.wavesurfer.xhr !== undefined) {
ajaxOptions.xhr = this.player.options_.plugins.wavesurfer.xhr;
requestOptions.xhr = this.player.options_.plugins.wavesurfer.xhr;
}
let ajax = WaveSurfer.util.ajax(ajaxOptions);
let request = WaveSurfer.util.fetchFile(requestOptions);

ajax.on('success', (data, e) => {
request.once('success', data => {
this.log('Loaded Peak Data URL: ' + peaks);
this.surfer.load(url, data.data);
this.surfer.load(url, data);
});
ajax.on('error', (e) => {
request.on('error', e => {
this.log('Unable to retrieve peak data from ' + peaks +
'. Status code: ' + e.target.status, 'warn');
'. Status code: ' + request.response.status, 'warn');
this.log('Loading URL: ' + url);
this.surfer.load(url);
});
Expand Down

0 comments on commit d77d6fa

Please sign in to comment.