You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, i am experiencing a really long wait time once performing a Tus upload with the api. For a 280mb video (created on my phone) it takes a total of 2 mins and 28 seconds. This is with the chunk size set to 130 * 1024 * 1024 also. I have tried decreasing the chunk size however then it starts taking even longer. What's the best way to have this run in the background so a user can continue browsing?
My code (helper function that takes the uploaded video from form as parameter):
def video_upload(video, offer_pk):
chunk_size = (130 * 1024 * 1024) # 200 MB
#Initial sending, get an upload link
url = 'https://api.vimeo.com/me/videos'
headers = {
'Authorization': 'bearer %s' % settings.VIMEO_TOKEN, 'Content-Type' : 'application/json', 'Accept' : 'application/vnd.vimeo.*+json;version=3.4'}
data = {'upload' :{ 'approach' : 'tus', 'size' : video.size}, 'name' : str(offer_pk)}
r = requests.post(url, headers=headers, data=json.dumps(data))
if r.status_code == 200:
uri = r.json()['uri'] # link to final video
upload_link = r.json()['upload']['upload_link']
approach = r.json()['upload']['approach']#should be tus
if approach == 'tus':
try:
tus_client = client.TusClient('https://files.tus.vimeo.com')
uploader = tus_client.uploader(
chunk_size=chunk_size,
file_stream=video,
retries=3,
url=upload_link)
uploader.upload()
except Exception as e:
raise exceptions.VideoUploadFailure(
e,
'Unexpected error when uploading through tus.'
)
result = uploader.verify_upload()
if result == True:
return uri
The text was updated successfully, but these errors were encountered:
Hi, I changed my implementation to having the video uploaded on the client
side with the tus js package. Now it's only effected by the clients
internet speed. Thank you for following up on this. Is there anyway to
improve the speed further from what I am currently doing?
Hi, i am experiencing a really long wait time once performing a Tus upload with the api. For a 280mb video (created on my phone) it takes a total of 2 mins and 28 seconds. This is with the chunk size set to 130 * 1024 * 1024 also. I have tried decreasing the chunk size however then it starts taking even longer. What's the best way to have this run in the background so a user can continue browsing?
My code (helper function that takes the uploaded video from form as parameter):
def video_upload(video, offer_pk):
The text was updated successfully, but these errors were encountered: