Skip to content

Commit

Permalink
Merge pull request #35 from izkmdz/ismendoza/fix-dispose-listener
Browse files Browse the repository at this point in the history
fix: Remove target availability event listener on dispose (#29)
  • Loading branch information
yokuze committed Feb 24, 2022
2 parents 63a3908 + ea0880d commit c83a600
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 783 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Expand Up @@ -6,7 +6,7 @@

var path = require('path'),
getCodeVersion = require('silvermine-serverless-utils/src/get-code-version'),
nodeSass = require('node-sass'),
sass = require('sass'),
join = path.join.bind(path);

module.exports = function(grunt) {
Expand Down Expand Up @@ -116,7 +116,7 @@ module.exports = function(grunt) {
},
options: {
sourceMap: DEBUG,
implementation: nodeSass,
implementation: sass,
indentWidth: 3,
outputStyle: DEBUG ? 'expanded' : 'compressed',
sourceComments: DEBUG,
Expand Down
48 changes: 48 additions & 0 deletions docs/demo/test-cases/remove-air-play-button.html
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>silvermine-videojs-airplay Demo</title>
<link href="https://unpkg.com/video.js@7.4.1/dist/video-js.css" rel="stylesheet">
<script src="https://unpkg.com/video.js@7.4.1/dist/video.js"></script>
<script src="../../../dist/silvermine-videojs-airplay.min.js"></script>
<link href="../../../dist/silvermine-videojs-airplay.css" rel="stylesheet">
</head>
<body>
<h1><a href="https://github.com/silvermine/videojs-airplay/issues/29">#29</a> Removing/disposing of the AirPlay button</h1>

<p>
When the AirPlay button is programmatically removed from the player, this plugin should remove the event listeners
that it registered outside of its own scope (e.g. on the player's media element). If this test case is failing, you
will see an error or warning in the console when you click the "Remove AirPlay Button" button.
</p>

<video id="video_1" class="video-js vjs-default-skin" controls preload="auto">
<source src="http://www.caminandes.com/download/03_caminandes_llamigos_1080p.mp4" type="video/mp4">
</video>

<button id="removeBtn" onclick="removeAirPlayButton()">Remove AirPlay Button</button>

<script>
var options;

options = {
fluid: true,
};

var player = videojs('video_1', options, function() {
player.airPlay();
});

removeAirPlayButton = function() {
var airPlayButton = player.controlBar.getChild('airPlayButton');

airPlayButton.dispose();
document.getElementById('removeBtn').disabled = true;

player.load();
};
</script>

</body>
</html>

0 comments on commit c83a600

Please sign in to comment.