Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

How do I set YouTube's liveBroadcasts closedCaptionsType to 'Automatic captions' using the API?

$
0
0

I am trying to set the Captions source in a YouTube Live Stream that I create via Python API to the "Automatic captions (English only)" option that can be selected via drop-down from the YouTube Studio ..../livestreaming URL. I understand that 'enableClosedCaptions' is now deprecated in favor of 'closedCaptionsType'. Setting the 'closedCaptionsType' to the value 'closedCaptionsHttpPost' sets the drop-down in question to the 'POST captions to URL' selection. My goal is to use the automatic captioning that YouTube provides rather than using 3rd party service for closed-captions or an in-house captioning system, but I don't see any option to select that in the API definition below.


https://developers.google.com/youtube/v3/live/docs/liveBroadcasts#contentDetails.closedCaptionsType

contentDetails.closedCaptionsTypestring

Note: This property replaces the contentDetails.enableClosedCaptions property.

This property indicates whether closed captioning is enabled for your broadcast and, if so, what type of closed captions you are providing:

  • closedCaptionsDisabled: Closed captions are disabled for the live broadcast.
  • closedCaptionsHttpPost: You will send captions, via HTTP POST, to an ingestion URL associated with your live stream.
  • closedCaptionsEmbedded: Captions will be encoded in the video stream using EIA-608 and/or CEA-708 formats.

Here is my liveBroadcast insert command in Python that successfully creates the broadcast in my YouTube channel, but it sets the caption type to the POST URL. Watching the Javascript console in Chrome, I see these two values in the payload for setting the caption type from the UI: CAPTIONS_TYPE_ASR and CAPTIONS_TYPE_HTTP_POST, but I have been unsuccessful in guessing at an equivalent string value in my code below.

Thanks for any insights you might have!

broadcast_response = youtube.liveBroadcasts().insert(    part='snippet,status,contentDetails',    body={'snippet': {'title': stream_title,'description': stream_description,'scheduledStartTime': stream_schedStart,'categoryId': category_id,'defaultLanguage': 'en-US','defaultAudioLanguage': 'en-US'        },'status': {'privacyStatus': 'public','selfDeclaredMadeForKids': False        },'contentDetails': {'monitorStream': {'enableMonitorStream': True,'broadcastStreamDelayMs': 0            },'enableAutoStart': True,'enableAutoStop': False,'enableDvr': True,            # 'enableClosedCaptions': True,'closedCaptionsType': 'closedCaptionsHttpPost','enableEmbed': stream_embed,'enableLowLatency': False,'latencyPreference': 'normal','projection': 'rectangular','recordFromStart': True        }    }).execute()

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>