Is it possible to add subtitles to Youtube
video using Google Youtube API v3
(important condition - for video's not owner)?
Task: add custom subtitles in selected language using the Google APIs Client Library for JavaScript
.
(Google maps API
allows add, custom Markers
(for example) to their maps, maybe there is a solution for subtitles
when we're talking about Youtube API
?)
The best way is to use the transcription option included below the video player: To do this, press the small dot icon below the video. Choose “open the transcription”. You can then copy and paste a complete transcript, in SRT format, of any video!
But YouTube does not allow you to add a caption file if you are not the video owner.
Google are calling them "captions" and API section is called YouTube API v2.0 – Captions.
Please note the following requirements for executing caption-related API operations:
- Captions are only available for API version 2.
- Captions for a video can only be created, retrieved, modified and deleted by the owner of that video. To perform these operations for a video, you must submit authenticated API requests for which the video's owner is the logged-in user. Accordingly, API requests for caption operations must contain a properly formatted Authorization header.
- Requests to create (POST), update (PUT) or delete (DELETE) captions must identify your developer key using either the X-GData-Key request header or the key request parameter.
That means, that you can add captions with API, but you need to have owner access to that video. It is strict policy, so that you won't show "wrong" captions on any video, for example, that show different translation of content in video, than there actually is.
You can only hack around this, by putting video inside container, and overlay your own text over video thus simulating captions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With