none
object doesn't support property or method 'play'

    Question

  • I am using Visual C# Express 2010 and the webBrowser object to navigate to the following HTML5 web page:

    <!DOCTYPE HTML>
    <!-- saved from url=(0016)http://localhost -->
    <!-- the above line fixes the comment: -->
    <!-- internet explorer restricted this web page from running scripts or ActiveX controls -->

    <html>
     
      <head>
        <title>Simple Video Example</title>
         <script type="text/javascript">

      function playVideo()
         {
           var ip = document.getElementById('myVideo'); //text box
           var v = document.getElementById('v1');      //video element
           v.src = ip.value;    
           v.play();    
         }   
     
     function pauseVideo()
         {
           var v = document.getElementById('v1');
           v.pause();         
         }        
         </script>
      </head>
     
      <body>
     <video id="v1" style="width:25%" controls="controls" >Video tag is not supported</video>
     <input type="text" id="myVideo" size="60" />
     <button onclick="playVideo();">Play</button>
     <button onclick="pauseVideo();">Pause</button>
      </body>

    </html>

    The machine runs Windows 7, the browser I use is IE9. The webBrowser object is 9.0.8112.16430.

    Although this page runs fine on the IE9 browser (outside of the VC# 2010 Forms app) when I run it using the webBrowser object in VC# 2010 I see the following error:

    Object doesn't support property or method 'play' when I click the play button.

    Can you please tell me how I can fix this?

    Thursday, July 14, 2011 4:36 AM

Answers