I would like to add a closed caption button to the YouTube player to enable/disable captions dynamically. Additionally, I want to allow users to select the available languages for captions.
I already have access to the available languages through an internal API, but I'm facing an issue with changing the caption language or enabling/disabling captions after the player is initialized.
Issue/Blocker:
It seems that changing the caption language or toggling captions is only possible through the IFramePlayerOptions, which can only be set during the player's initialization.
The library does not support reinitializing the player after it’s been created.
Destroying and recreating the player to apply new IFramePlayerOptions results in a glitchy experience.
Question: Is there a way to dynamically update the caption settings (enable/disable and change languages) without destroying and recreating the player? Or, is there a recommended solution to handle this more smoothly?
Any insights or workarounds would be greatly appreciated! Thank you.
Hi Pier,
I would like to add a closed caption button to the YouTube player to enable/disable captions dynamically. Additionally, I want to allow users to select the available languages for captions.
I already have access to the available languages through an internal API, but I'm facing an issue with changing the caption language or enabling/disabling captions after the player is initialized.
Issue/Blocker:
IFramePlayerOptions
, which can only be set during the player's initialization.IFramePlayerOptions
results in a glitchy experience.Question: Is there a way to dynamically update the caption settings (enable/disable and change languages) without destroying and recreating the player? Or, is there a recommended solution to handle this more smoothly?
Any insights or workarounds would be greatly appreciated! Thank you.