Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change the font size of captions ? #1114

Open
walancechu opened this issue Feb 26, 2024 · 0 comments
Open

How to change the font size of captions ? #1114

walancechu opened this issue Feb 26, 2024 · 0 comments
Labels

Comments

@walancechu
Copy link

Question

The following functions are mentioned in the youtube IFrame Player API official website(https://developers.google.com/youtube/iframe_api_reference):

onApiChange
This event is fired to indicate that the player has loaded (or unloaded) a module with exposed API methods. Your application can listen for this event and then poll the player to determine which options are exposed for the recently loaded module. Your application can then retrieve or update the existing settings for those options.

The following command retrieves an array of module names for which you can set player options:

player.getOptions();

Currently, the only module that you can set options for is the captions module, which handles closed captioning in the player. Upon receiving an onApiChange event, your application can use the following command to determine which options can be set for the captions module:

player.getOptions('captions');

By polling the player with this command, you can confirm that the options you want to access are, indeed, accessible. The following commands retrieve and update module options:

Retrieving an option:
player.getOption(module, option);

Setting an option
player.setOption(module, option, value);


My question is how to use your library to change the font size of captions,
for example: player.setOption('captions', 'fontSize', 3)
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant