Skip to content

Commit

Permalink
add exportImage method
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Sep 16, 2016
1 parent 4a1f99e commit b0283c4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
videojs-wavesurfer changelog
============================

1.2.4 (unreleased)
------------------

- add `exportImage` to save an image of the waveform
- bump required wavesurfer.js version to 1.2.0 for `exportImage` method


1.2.3 (2016/08/27)
------------------

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ player.waveform.destroy();
| `setVolume(level)` | Set the volume level. |
| `play` | Start playback. |
| `pause` | Pause playback. |
| `exportImage(format, quality)` | Save waveform image as data URI. Default format is 'image/png'. |

Other wavesurfer.js methods
---------------------------
Expand Down
17 changes: 17 additions & 0 deletions videojs.wavesurfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,23 @@
}
},

/**
* Save waveform image as data URI.
*
* The default format is 'image/png'. Other supported types are
* 'image/jpeg' and 'image/webp'.
*
* @param {String} format String indicating the image format. The
* default type is image/png.
* @param {Number} quality Number between 0 and 1 indicating image
* quality if the requested type is image/jpeg or
* image/webp. The default is 1.
*/
exportImage: function(format, quality)
{
return this.surfer.exportImage(format, quality);
},

/**
* Updates the player's element displaying the current time.
*
Expand Down

0 comments on commit b0283c4

Please sign in to comment.