Have you ever thought it would be cool if the chat in live streams was archived with the video? I did, so in my spare I time I wrote a little demonstration of the concept (be patience, it may take a moment to load the 4,000 comments). I figured out how to save the chat and link it to a video several weeks ago, but I had to wait for another live stream of a Quick Look so I could demonstrate it with a YouTube video. The popcorn.js API would work with any video, but obviously I can't serve a Giant Bomb video in my own web space. If it bothers you that I'm hosting your comments, let me know and I'll remove them from the demonstration.
To store the live chat feed, I created a local node.js server which stores HTTP get request data to file. Then, I opened the console in Google Chrome, and inserted a callback which is invoked when the chat window updates. This callback removes the new message, parses out its elements, and sends it to the node.js server to be stored. Surprising what you can do to a live website, huh?
Next, I needed to tie the chat to the archived video. This is done using the popcorn.js library. I copied the style of the live stream page so I could duplicate the presentation. Popcorn allows me to add a callback every time the video advances, so every second I repopulate the chat window with comments that would have appeared at that moment during the live stream. I synced the chat to the video by manually determining the time-stamp of the first moment of the video.
Here's a chart of the chat frequency over time for all the comments I recorded:
This is something that could be aligned with the width of the video, giving you an impression where amusing stuff is happening. In this case, the first major peak coincides with Brad driving off of a broken bridge, and the second peak is when Brad escaped certain death with a divekick.
Hope you guys find this interesting! It was fun to do.
Note: I didn't store membership or moderator information, so messages don't show up highlighted or with their appropriate metals. Since this is just a proof-of-concept prototype, I didn't see the need to take the extra effort. No disrespect intended!
Edit: Here are the files for extracting the chat data in your browser:
node.js server for storing the input:
http://www.rabbitfury.com/gbchat/server.js
code inserted into the console during a live show for capture:
http://www.rabbitfury.com/gbchat/gbchat_insertion.txt
Note: the insertion code produces an error after each message is sent to the node.js server because it can't accept the response to the HTTP get request. Its annoying but it doesn't adversely effect operation.
Log in to comment