Video by HeyTimDev · streamed from YouTube. All rights remain with the creator.
Lesson 13: Liking and Unliking Videos
About this lesson
In this tutorial, HeyTimDev adds the ability to like and unlike videos to the short-video app, one of the most important ways for users to interact with content, just as in the real app. It begins by creating a like and unlike system with Supabase that tracks which users have liked which videos. You learn how likes are added to the Supabase database and associated with both the user who liked the video and the video itself, so that the information can be used throughout the app. The like button in the video overlay is then implemented so that it toggles between a liked and an unliked state when tapped, giving users immediate visual feedback about whether they have already liked a video. To keep the app efficient, the video shows how to store the ids of liked videos locally in the app, so that it does not need to make repeated, redundant requests to the back end every time a video appears in the feed just to find out whether the user has liked it. The tutorial also displays the total number of likes, both the number received by each individual video and the total received across a user's videos on their profile, which helps creators see how their content is doing. By the end of the video, the app has a fully functional like system that lets users engage with videos seamlessly, and the next part builds the follower and following features that connect users to each other. Afterwards, read Chapter 13 of the course book, which works out how many requests the local list of likes saves.