@silvermine/videojs-chromecast
Advanced tools
Comparing version 1.3.4 to 1.4.0
{ | ||
"name": "@silvermine/videojs-chromecast", | ||
"version": "1.3.4", | ||
"version": "1.4.0", | ||
"description": "video.js plugin for casting to chromecast", | ||
@@ -40,4 +40,4 @@ "main": "src/js/index.js", | ||
"devDependencies": { | ||
"@babel/core": "7.13.16", | ||
"@babel/preset-env": "7.13.15", | ||
"@babel/core": "7.20.7", | ||
"@babel/preset-env": "7.20.2", | ||
"@commitlint/cli": "8.3.5", | ||
@@ -44,0 +44,0 @@ "@commitlint/travis-cli": "8.3.5", |
@@ -165,2 +165,5 @@ # Silvermine VideoJS Chromecast Plugin | ||
of the control bar are visible. | ||
* **`plugins.chromecast.addCastLabelToButton`** (default: `false`) - by default, the Chromecast | ||
button component will display only an icon. Setting `addCastLabelToButton` to `true` will | ||
display a label titled `"Cast"` alongside the default icon. | ||
@@ -234,11 +237,14 @@ ##### Chromecast Tech configuration | ||
The `ChromecastButton` component has one translated string: "Open Chromecast menu". The | ||
"Open Chromecast menu" string appears in both of the standard places for Button component | ||
accessibility text: inside the `.vjs-control-text` span and as the `<button>` element's | ||
`title` attribute. | ||
The `ChromecastButton` component has two translated strings: "Open Chromecast menu" and "Cast". | ||
To localize the Chromecast button text, follow the steps in the | ||
[Video.js Languages tutorial][videojs-translation] to add an `"Open Chromecast menu"` key | ||
to the map of translation strings. | ||
* The "Open Chromecast menu" string appears in both of the standard places for Button | ||
component accessibility text: inside the `.vjs-control-text` span and as the `<button>` | ||
element's `title` attribute. | ||
* The "Cast" string appears in an optional label within the Button component: inside the | ||
`.vjs-chromecast-button-label` span. | ||
To localize the Chromecast button strings, follow the steps in the | ||
[Video.js Languages tutorial][videojs-translation] to add `"Open Chromecast menu"` | ||
and `"Cast"` keys to the map of translation strings. | ||
### Using the npm module | ||
@@ -245,0 +251,0 @@ |
@@ -28,3 +28,3 @@ /** | ||
*/ | ||
constructor: function(player) { | ||
constructor: function(player, options) { | ||
this.constructor.super_.apply(this, arguments); | ||
@@ -37,4 +37,2 @@ | ||
this.controlText('Open Chromecast menu'); | ||
// Use the initial state of `hasAvailableDevices` to call the corresponding event | ||
@@ -48,2 +46,14 @@ // handlers because the corresponding events may have already been emitted before | ||
} | ||
if (options.addCastLabelToButton) { | ||
this.el().classList.add('vjs-chromecast-button-lg'); | ||
this._labelEl = document.createElement('span'); | ||
this._labelEl.classList.add('vjs-chromecast-button-label'); | ||
this._updateCastLabelText(); | ||
this.el().appendChild(this._labelEl); | ||
} else { | ||
this.controlText('Open Chromecast menu'); | ||
} | ||
}, | ||
@@ -58,3 +68,5 @@ | ||
buildCSSClass: function() { | ||
return 'vjs-chromecast-button ' + (this._isChromecastConnected ? 'vjs-chromecast-casting-state ' : '') + | ||
return 'vjs-chromecast-button ' + | ||
(this._isChromecastConnected ? 'vjs-chromecast-casting-state ' : '') + | ||
(this.options_.addCastLabelToButton ? 'vjs-chromecast-button-lg ' : '') + | ||
this.constructor.super_.prototype.buildCSSClass(); | ||
@@ -84,2 +96,3 @@ }, | ||
this._reloadCSSClasses(); | ||
this._updateCastLabelText(); | ||
}, | ||
@@ -95,2 +108,3 @@ | ||
this._reloadCSSClasses(); | ||
this._updateCastLabelText(); | ||
}, | ||
@@ -128,2 +142,15 @@ | ||
}, | ||
/** | ||
* Updates the optional cast label text based on whether the chromecast is connected | ||
* or disconnected. | ||
* | ||
* @private | ||
*/ | ||
_updateCastLabelText: function() { | ||
if (!this._labelEl) { | ||
return; | ||
} | ||
this._labelEl.textContent = this._isChromecastConnected ? this.localize('Disconnect Cast') : this.localize('Cast'); | ||
}, | ||
}; | ||
@@ -130,0 +157,0 @@ |
@@ -157,2 +157,3 @@ var ChromecastSessionManager = require('../chromecast/ChromecastSessionManager'), | ||
subtitle = this._requestSubtitle(source), | ||
poster = this.poster(), | ||
customData = this._requestCustomData(source), | ||
@@ -172,2 +173,5 @@ request; | ||
if (poster) { | ||
mediaInfo.metadata.images = [ { url: poster } ]; | ||
} | ||
if (customData) { | ||
@@ -174,0 +178,0 @@ mediaInfo.customData = customData; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
479674
42
10555
345