What I’m trying to do:
I’m trying to successfully save end-user submitted videos (via File Loader component) to an Anvil Data Table. In scenarios where the video file is greater/larger than 10MB, I receive the error ‘anvil.server.TimeoutError:’.
What I’ve tried and what’s not working:
I don’t know how to overcome this challenge so I haven’t tried anything yet but, perhaps the solution is to add code to Native Library which compresseses the user submitted video before saving to Anvil Data Table.
Code Sample:
@anvil.server.callable
def save_orig_video(file, url):
# Assuming 'public' table has a column named 'user_video_file' for storing the video file
user = anvil.users.get_user()
if user:
user_account = user['user_acct_number']
row = app_tables.public.get(user_acct_number=user_account) # Find User row in Public datatable via user's account number
if row:
row['blob_url'] = url
row['user_input_video'] = file
row['input_vid_datetime'] = datetime.datetime.now()
row['processed_video'] = None
row['processed_vid_datetime'] = None
else:
app_tables.public.add_row(user_acct_number=user_account, blob_url=url, user_input_video=file, input_vid_datetime=datetime.datetime.now())
else:
return "Please log-in to your account"