Whether we're looking at a web page, reading a massive pdf, or navigating through a huge code base, we can always rely on the "CTRL+F" functionality to tell us where we can find a particular string or a particular topics, out of all the content present. We realized, though, that there are hardly any resources that provide this functionality for YouTube videos! It is probably the first website on our list when we want to learn something or entertain ourselves, but in order to know whether or not the topic you are looking for is in the video, you must look through the whole thing! Our team intended to implement a chrome extention that takes in an input string, scans through a given video and highlights the moments where that string was spoken.
When building a chrome extension, we must have multiple javascript files where each controls a different component of the system. When we first click on the extension, a small window with a text box shows up. The functionality of this window was controlled by the popup.js file. Since the scope of popup.js is limited to that window, DOM manipulation on the YouTube page must be done by another javascript file (content.js). The presense of two files demands that there be a messaging protocol between the two, so that popup.js can notify content.js when a search has been done (and its time to process the string).
Despite trying multiple approaches, the two files failed to connect together; we couldn't send the string through from one file to another. using listeners.
Technologies used
Discussion