HTML5 video playing after setting source

I'm trying to share html5 video using Node.js.

I have browser A with video url and browser B without it. I connect both using web-sockets and node.js. So far I'm getting and setting the video source from A to B. but when I try to play it in B using a new command is not working.

It is like the video is not loaded. So I'm using next code so that not get an error:

$('#v').on('loadeddata', function () {  
   if (v.readyState != 0) {  
   } else {
      $('#v').on('loadedmetadata', function () {

I set source on load page and later I press play on A and send the order to B. However it starts playing when another event occurs.

I used JQuery and Javascript load function trying to solve it but I couldn't get it works:



var v = document.getElementById('v'); 

Any idea? how to really load the video ones you set the source?

I'm using Chrome (V.32) and Firefox (v.26).


Depending on how you have the video element set up, you may not be receiving the loadeddata event for a while, in which case it will not play right away, if ever. Fortunately, you don't need to wait for any of those events to start playing.

As soon as you've set the source URL, call load and then play right away. That should cause the browser to start loading and play it when its ready (unless you're on an iPad, in which case the user will need to click a play button).

Need Your Help

$_GET loading content before head tag instead of in specified div

php css xhtml html

The problem is that when the content loads it displays before the tag before i added the <!DOCTYPE>, <html> <head></head> in the index.php file NOW $content loads before the...

Which is the code that creates captured variables / closures?

c# .net clr dynamic-language-runtime

I understand that variable capturing is done by the compiler and not by the classes in the .NET framework itself. However, when the DLR was introduced, some of this work must surely have needed to ...