Nnamdi's Blog

Nnamdi's Blog

New Week: Gather-Video and Dynamodb doings!

Hi people! Greetings.

This week i will be working on a mini-project titled "gather-video" using a video service known as "Mux". It generates and plays videos by passing the url of the video or the video asset id; not so far fetched from the work i did with a previous project - gather-games - which entailed getting, uploading and storing pictures using the "cloudinary" service.

Started already and my boss has asked i write a functional "lib.test" to test the MUX APIs. I have written about two tests that are not so functional yet. They keep returning certain errors but i will still term it a progress. About a month ago i could not attempt to write a non-functional lib test to test out the functionality of a services' API. lol.

A little diversion for the week. My Boss took the team on a full course on the mechanics of "Dynamodb". It is an amazon web service that is used to store series of information about a topic/subject and can be called forth by entering the primary key assigned which includes the partition key (pk) and the sort key (sk) (An overly simple explanation that does little justice to dynamodb). The whole team made inputs in trying to figure out how best to get it to work and how it will best align with our own micro-service.
we did figure it all out though i am yet to include it to my micro-service - "gather-game".

Back to my struggles with the lib test. I wrote two tests:

  • test to upload a video using the video's id.

  • test to get a video using the video's id.

The two tests keep returning errors and I am still at a loss. I have set the environment right by generating the "Mux Token id and Mux Token Secret" from the MUX website and putting it in the .env file. It still returns an error. I have also used multiple id for the test and even changed the id from numbers to strings and back to numbers. I keep getting an invalid parameter error. I should be frustrated at this point but i am going the "ross way". I know i will get it eventually.

So my boss and i had a crack at it and it finally works. The lib tests are functional! We achieved this by putting in a video url that was generated from the mux service. And also copied the asset id that was generated from the first test and used it to make the second test functional.

One of the many lessons i took away from this is that mux is not really built for video storage. It is rather more effective for passing a video url in it and having it play the video efficiently.

Also discovered that not all browsers can play a ".m3u8" video file. So i will be using the "ReactHlsPlayer" tag in my code to ensure the scalability of videos with respect to browsers.

So i will be taking a new route for this mini project: Creating a folder for video uploads in my cloudinary database, copying the generated video url from cloudinary and passing it in the mux service albeit wrapping my video code with a "ReactHlsPlayer" tag. My experiment page is about to get real busy!

I will be keeping you all updated!


Share this