Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clairefro/docusaurus-youtube-localize-plugin
hosted script for localizing youtube player and subtitles for embedded videos in iframes
https://github.com/clairefro/docusaurus-youtube-localize-plugin
Last synced: 3 days ago
JSON representation
hosted script for localizing youtube player and subtitles for embedded videos in iframes
- Host: GitHub
- URL: https://github.com/clairefro/docusaurus-youtube-localize-plugin
- Owner: clairefro
- License: mit
- Created: 2021-01-25T04:10:28.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-25T04:38:03.000Z (almost 4 years ago)
- Last Synced: 2025-01-10T02:17:54.615Z (6 days ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docusaurus-youtube-localize-plugin
This is a super hacky (temporary) solution for getting iframe embedded Youtube players in Docusaurus docs to render player controls and [published] captions based on the language of a given page's ``## Usage
Create a `plugins` dir at your Docusaurus project root, and create a file named `youtube-localize-plugin.js` inside.Paste this code which references this repo's hosted `index.js`
```js
// plugins/youtube-localize-pluign.jsmodule.exports = function (_context, _options) {
return {
name: 'youtube-localize-plugin',
injectHtmlTags() {
return {
preBodyTags: [
{
tagName: 'script',
attributes: {
charset: 'utf-8',
src:
'https://clairefro.github.io/docusaurus-youtube-localize-plugin/index.js',
},
},
],
};
},
};
};```
Then simply configure this plugin in `docusaurus.config.js````js
// docusaurus.config.js
module.exports = {
//..
plugins: [path.resolve(__dirname, 'plugins', 'youtube-localize-plugin')],
};```
## Troubleshooting
**Why aren't captions showing up???**
Subtitles will only appear in any given language if the video owner has officially published subtitles in that language.
The params used in the plugin do not allow for forcing auto-generated or auto-translated captions (although users can still click to enable those). If you are the video owner, note that it is simple to officially publish auto-generated subtitles using the Youtubes in-house tool Youtube Studio.