PierfrancescoSoffritti / android-youtube-player

YouTube Player library for Android and Chromecast, stable and customizable.
https://pierfrancescosoffritti.github.io/android-youtube-player/
MIT License
3.44k stars 765 forks source link

How to change the font size of captions ? #1114

Open walancechu opened 8 months ago

walancechu commented 8 months ago

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.