Skip to content

Commit

Permalink
The volume button now is not shown on devices that have no access to …
Browse files Browse the repository at this point in the history
…volume API. Fix #5
  • Loading branch information
ferserc1 committed Sep 27, 2023
1 parent bccf06d commit 412c69d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dist/paella-basic-plugins.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/paella-basic-plugins.js.map

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "paella-basic-plugins",
"version": "1.41.0",
"version": "1.44.0",
"description": "Basic plugins for Paella Player",
"main": "src/index.js",
"module": "dist/paella-basic-plugins.js",
Expand Down Expand Up @@ -33,6 +33,6 @@
"webpack-dev-server": "^4.7.3"
},
"dependencies": {
"paella-core": "^1.41.0"
"paella-core": "^1.44.1"
}
}
13 changes: 12 additions & 1 deletion src/plugins/es.upv.paella.volumeButtonPlugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

import{ ButtonPlugin, createElementWithHtmlText, Events, bindEvent } from 'paella-core';
import{
ButtonPlugin,
createElementWithHtmlText,
Events,
bindEvent,
isVolumeApiAvailable
} from 'paella-core';
import BasicPluginsModule from './BasicPluginsModule';

import defaultVolumeHighIcon from '../icons/volume-high.svg';
Expand Down Expand Up @@ -76,6 +82,11 @@ export default class VolumePlugin extends ButtonPlugin {
return super.name || "es.upv.paella.volumeButtonPlugin";
}

async isEnabled() {
const e = await super.isEnabled();
return e && await isVolumeApiAvailable();
}

getAriaLabel() {
return "Volume";
}
Expand Down

0 comments on commit 412c69d

Please sign in to comment.