Reputation: 21
I've created an embed preset and set it as the default preset for all videos I upload on Vimeo. This preset removes everything but the play button. I have embedded the video that is the basis for the preset and it works correctly.
However, when I embed new videos uploaded with this preset as default, the CC button appears as well. This means that for these videos, the embedded player has the play button and CC button and nothing else.
Interestingly, I can't even manually remove the CC button for these videos under "https://vimeo.com/manage/videos/{video_id}/customize". All options are already turned off for that area, as I would expect because of the default preset, but the CC button is still there.
I am progammatically uploading these new videos using the Python client:
client.upload(file_name, data={
'name': title})
I have a Pro account. What am I missing?
Upvotes: 2
Views: 1345
Reputation: 24952
FIRST - correcting already added captions (in API its call: texttracks
)
Documentation: https://developer.vimeo.com/api/upload/texttracks#uploading-a-text-track-step-1
Python example
You need to have two items:
video
JSON object (to get uri
to the video: video['uri']
) - or directly change video['uri']
in this example to uri you haveauth_token
)How final function will look:
video = {"uri": "/videos/0000000"}
set_video_texttracks_inactive(video)
Get active texttracks for video:
def get_texttracks_uris(video):
texttracks_uris = []
video_url_tt = f"https://api.vimeo.com/{video['uri']}/texttracks"
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {auth_token}'
}
response = requests.request("GET", video_url_tt, headers=headers)
data = json.loads(response.text)
for textrack in data['data']:
if textrack['active']:
texttracks_uris.append(textrack['uri'])
print(f"Found: {len(texttracks_uris)} texttracks for video {video['uri']}")
return texttracks_uris
Disable all texttracks example function:
def set_video_texttracks_inactive(video):
texttrack_uris = get_texttracks_uris(video)
if not texttrack_uris:
print(f"No TEXTTRACKS uris found for video {video['uri']}")
else:
for texttrack_uri in texttrack_uris:
url = f"https://api.vimeo.com/{texttrack_uri}"
payload = "{ \r\n \"active\": false \r\n}"
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {auth_token}'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
message = 'SETTING VIDEO TEXTTRACKS TO FALSE \n'
message += f'resp: {response.status_code} \n'
message += f'url: {url} \n'
print(message)
SECOND - is good to disable that feature in your account:
Upvotes: 1