HTML5 Video JavaScript Listener

Are there any libraries that will assist in allowing a video played in html5 video tag to be listened to and fire a JavaScript function when a certain tone or series of tones are played in the video?  Or could added data to the stream be read and fire a JavaScript function based on the data.  

I am trying to fire a script on the client/browser side of a live stream.  We have a custom encoding/streaming application and would like it when our moderators click a button in the application it is timed with the video stream on the client end.  I realize this can be done with streaming players like Silverlight and flash, but I would like this to work on all devices including mobile phones.
SitewizardAsked:
Who is Participating?
 
skijCommented:
I understand what you are trying to accomplish.

It is not possible to trigger a JavaScript function based on a certain tone or a series of streamed tones without the use a a third-party application like Flash or Silverlight.  Even if it were possible (which is is not) it would be extremely inefficient for JavaScript to process the streaming data, and the process would be so resource-intensive that it would be unreliable.

You asked it data could be added to the stream that could fire a JavaScript function.  Fortunately,  HTML5 WebSockets provide a reliable way to accomplish this.  Any browser that supports HTML5 video should also support HTML5 WebSockets.

Here is an example demonstration of  videos being controlled through the use of HTML5 WebSockets:
https://www.youtube.com/watch?v=r90ti4MbecM

You asked if there are any libraries that would assist with this.  I recommend Popcorn.js:
http://popcornjs.org/

Here is a story, along with sample code that is relevant:
http://blog.kaazing.com/2014/01/23/extreme-html5-video-interactivity-sending-websocket-messages-with-popcorn-js/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.