Skip to content

Commit

Permalink
fix compatibility issue with videojs-record plugin (closes #46)
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Dec 13, 2017
1 parent 0faa6d6 commit 856b56b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
videojs-wavesurfer changelog
============================

2.1.2 - unreleased
------------------

- Fix compatibility issue with videojs-record plugin (#46)


2.1.1 - 2017/12/12
------------------

Expand Down
14 changes: 12 additions & 2 deletions src/js/tech.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,21 @@ class WavesurferTech extends Html5 {
}

/**
* Determine whether or not the player is trying use wavesurfer
* Determine whether or not the player is trying use the wavesurfer plugin
* @returns {boolean}
*/
playerIsUsingWavesurfer()
{
return this.activePlayer.activeWavesurferPlugin !== undefined;
let availablePlugins = videojs.getPlugins();
let usingWavesurferPlugin = 'wavesurfer' in availablePlugins;
let usingRecordPlugin = 'record' in availablePlugins;

return usingWavesurferPlugin && !usingRecordPlugin;
}

/**
* Start playback.
*/
play() {
if (!this.playerIsUsingWavesurfer()) {
// fall back to html5 tech functionality
Expand All @@ -63,6 +70,9 @@ class WavesurferTech extends Html5 {
return this.activePlayer.activeWavesurferPlugin.play();
}

/**
* Pause playback.
*/
pause() {
if (!this.playerIsUsingWavesurfer()) {
//fall back to html5 tech functionality
Expand Down

0 comments on commit 856b56b

Please sign in to comment.