2
window.onclickofButton= function (ID) {
        $('#divEmbed').html("<embed id='teste' type='application/x-mplayer2' pluginspage='http:///www.microsoft.com/Windows/MediaPlayer/' src='video'+ID>")};

Above is my code , onclick of button i have dynamically pass video prefix number and loads video according it . This works fine for me.

But now I want to show loading image until video is loaded in to embed tag or until video taking time to ready to run.

I have seen so many solutions but i can not find any to resove this.

Note: by googling this i reached to following conclusion , is this correct or not i dont know
(i) - embed tag not support onload event
(ii) - iframe onload event supports for only html documents , not for non-html documents like .mp4 or any video extensions**

I have seen so many posts like below :
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_21214591.html
Javascript - load events for embed elements

I must have to use embed tag, not iframe or any other similars but I cannot get it to work.

Community
  • 1
  • 1
Kashyap Vyas
  • 129
  • 1
  • 12

1 Answers1

0

Can you please try this.

<script type="text/javascript">


function doLoad() {
     alert( "The load event is executing" );
  }
  if ( window.addEventListener ) { 
     window.addEventListener( "load", doLoad, false );
  }
  else 
     if ( window.attachEvent ) { 
        window.attachEvent( "onload", doLoad );
  } else 
        if ( window.onLoad ) {
           window.onload = doLoad;
  }
  </script>

Embaded Load Event

AB Vyas
  • 2,349
  • 6
  • 26
  • 43