javascriptyoutubeyoutube-apiswfobject

Youtube API - how to use custom controls to turn captions on/off, change language?


I have a youtube player with custom HTML controls and would like to add a button to turn on/off closed caption and to toggle the language. Anyone have experience with using either the JS or iframe API to do this? I know that appending cc_load_policy=1 to the url will force the captions to display, but I am using custom controls and would like to add a toggle button. I tried using the loadVideoByUrl method and appending the cc parameter, but that doesn't work doesn't seem to work.

I was also only able to get the player to show captions in the user's default language with the iframe method, not the swf object method. Swf object always defaults to English. If anyone has any insights to this as well, please let me know!


Solution

  • Unfortunately, we don't have full API support over captions right now. You can add yourself to this external feature request to be notified when this changes: https://code.google.com/p/gdata-issues/issues/detail?id=444

    (Despite the age of that feature request, there are people actively looking on adding support.)