Video Component source from anvil without HTTP API

I was trying to add anvil media object mp4’s from a data table to a video tag’'s source with the method @meredydd supplied in this post:

but I’m really clueless when ti comes to API endpoints and keeping them secure, so I just decided to get ChatGPT’s help on encoding the MediaObject and then set the source like this:

import base64
self.video_player_1.source = f'data:video/mp4;base64,{base64.b64encode(<MediaObject>.get_bytes()).decode("utf-8")}'```

Sharing this in case anyone else wants an alternative to the http route.
1 Like