Answered

Need to choose custom thumbnail for video


Userlevel 4
Badge +2

Has anyone been able to choose a custom thumbnail for videos? There’s no option to choose one and the thumbnail is random.

 

If there’s an option to have a custom thumbnail this would increase performance a lot and be applicable to everyone on the platform. 

icon

Best answer by andrew_videoask 31 August 2022, 21:34

View original

37 replies

Userlevel 7
Badge +5

Thanks for sharing the image, @Dan L!

Here’s the binary output from my side. (Don’t include the <hide> tag that you see at the end of the code.) 

When I first tested this on a new videoask, I ran into the same issue as you. The thumbnail wouldn’t change. 

Make sure that A) you’re using the question_id for the first step of the video, and B) the video content for the first step is a video you’ve created; not a Pexels video or the default grey placeholder video.

Let me know if this works!

Userlevel 4
Badge +2

The binary code you have shared, we tried to execute that under the below syntax :
<img src="data:image/gif;base64,xxxxxxxxxxxxxxxx (this is the binary code)xxxxxxxxxxxxxx" 
width="16" height="14" alt="embedded folder icon">
Now , we are unable to handle the binary code you have shared and that is throwing 500 Internal Server error.
Link: https://cosmicvibestoday.com/videoask/update-thumnail/test_image_videoask_community.php

We have encoded the image in binary format using PHP functions and ran through the same syntax like above, in that case the image is showing properly.
Link: https://cosmicvibestoday.com/videoask/update-thumnail/testimage.php

Can you please double check the binary code that you give is correct?

And yes we are already passing the question_id in our script.
Screenshot:
 

In the above screenshot you can see the question_id  that is getting passed.

So is there any idea that can be implemented to get the thumbnail issue resolved?

Userlevel 7
Badge +5

Hi @Dan L, thanks for the update!

What happens when you call the VideoAsk API? What error message are you getting?

Userlevel 4
Badge +2

@andrew_videoask wanted to follow up on this 

Userlevel 4
Badge +2

We have applied the binary output in the code but the server is throwing 500 internal server error as may be the server is unable yo handle the binary output. So we would request you to recheck the binary output once again at your end that you sent us and send us again.

Userlevel 7
Badge +5

@Dan L Out of curiosity, why are you including the binary code within this larger chunk of code?

<img src="data:image/gif;base64,xxxxxxxxxxxxxxxx (this is the binary code)xxxxxxxxxxxxxx" 
width="16" height="14" alt="embedded folder icon">

I’m just using the binary code itself as the file contents. Can you try that?

I wish I could be more helpful here, but I’m not well versed in PHP.

Let me know!

Userlevel 4
Badge +2

okay so can you just wrap the binary code in a variable like for example:
$variable=’xxxxxxxxxxx(binary code)xxxxxxxxxxxxxxx’;
so that we feel confirmed that we are correctly enclosing the binary code in a variable. We would request you to assign the binary code in a variable because we are not sure whether we are missing any characters from the binary code while assigning it inside a variable.

Userlevel 7
Badge +5

@Dan L 

file_contents = file.read()

is the part of my code that assigns the binary data to the file_contents variable. So I’m not technically hard-coding the binary data to a variable.

Then in this part of the code…

requests.request("PUT", presigned_thumbnail_url, headers=aws_headers, data=file_contents)

I’m passing the file_contents variable in the API call. 

All you should need to do is read the binary data of the image file, assign that to a variable, then include that variable in your API request. 

I think you may be using an incorrect PHP function for reading the binary data of a file. I wish I could debug this more in depth on my side, but I’m not experienced with PHP and we don’t have software to run PHP code unfortunately. 

Userlevel 4
Badge +2

Okay we are doing at our end whatever is possible, but just to let you know that the python code which you sent at the 1st of this communication chat, it is not funnel specific. I mean if the same question ID exist in other funnels then uploading custom thumbnail is affecting the other funnel as well. So is there any specific code for funnel specific.?
This is the python code that you sent

 

import jsonimport requests# Assign variablesapi_token = ""thumbnail_file_path = ""# Set headers for VideoAsk API callsvideoask_headers = {    'Authorization': f'Bearer {api_token}',    'content-type': 'application/json',    'organization_id': organization_id}# Get Media ID of first questionresponse = requests.request("GET", f"https://api.videoask.com/questions/{question_id}", headers=videoask_headers)json_response = response.json()media_id = json_response['media_id']# Generate thumbnail upload URLpayload = json.dumps({    'extension': 'jpeg'})response = requests.request("POST", f"https://api.videoask.com/media/{media_id}/thumbnail-upload-url", headers=videoask_headers, data=payload)json_response = response.json()presigned_thumbnail_url = json_response['presigned_thumbnail_url']thumbnail_object_key = json_response['thumbnail_object_key']# Read and upload binary contents of image filefile = open(thumbnail_file_path, "rb")file_contents = file.read()file.close()aws_headers = {    'content-type': 'image/jpeg'}requests.request("PUT", presigned_thumbnail_url, headers=aws_headers, data=file_contents)# Confirm uploaded thumbnailpayload = json.dumps({    'thumbnail_object_key': thumbnail_object_key})requests.request("POST", f"https://api.videoask.com/media/{media_id}/confirm-thumbnail", headers=videoask_headers, data=payload)
Userlevel 7
Badge +5

Hi @Dan L, you raise a good point here! That’s correct.

This code changes the thumbnail for the media_id that you input. If you use that same media_id (video) in multiple videoasks, then the thumbnail for that video will be changed in each of those videoasks. This is a workaround, and not something natively supported in VideoAsk, so it’s certainly not a perfect solution.

That being said, if you want the thumbnail to apply only to one specific videoask, you can reupload the same video. This will create a new media_id, which you can then use only in the specific videoask you want the thumbnail applied to.

I would like to push this up on the list of requests for this feature. Would like the ability to upload a custom photo for easier and better styling for social media sharing. It’s a limitation that only so many auto-generated clips are the options. Thanks! 

Userlevel 7
Badge +5

Hi @Kelly Riordan thanks so much, I have added your feedback to the feature request and we’ll be sure to post here if anything changes 😊

Reply