www.webdeveloper.com
Results 1 to 3 of 3

Thread: displaying current position not working in firefox with WM plugin

  1. #1
    Join Date
    Feb 2009
    Posts
    14

    Question displaying current position not working in firefox with WM plugin

    Hi guys

    I have a piece of code that works with IE7 and IE8 but don't work with firefox with the windows media plugin installed.

    I'm trying to "alert" the current position (timeline) of a video.

    html code:
    HTML Code:
    <div class='videoDiv' id='showDis'>
    <object classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' ID='MediaPlayer1'>
      <param name='url' value='myvideo.asx' />
      <param name='src' value='myvideo.asx' />
      <param name='showcontrols' value='true' />
      <param name='autostart' value='true' />
      <!--[if !IE]>-->
      <object type='video/x-ms-wmv' data='myvideo.asx' height='400' width='450'>
        <param name='src' value='myvideo.asx' />
        <param name='autostart' value='true' />
        <param name='controller' value='true' />
      </object>
      <!--<![endif]-->
    </object>
    </div>
    
    <input type=button onclick="showCurrentPosition();" value="Show Timeline Position">
    javascript code:
    Code:
    function showCurrentPosition(){
    	objPlayer = document.getElementById('MediaPlayer1');
    	alert(objPlayer.controls.currentPosition);
    }

    I get the following error:
    Code:
    Error: objPlayer.controls is undefined
    here it says the "controls" object is suppose to work in firefox
    what am I doing wrong in the javascript or html code ?
    Last edited by yashish444; 06-23-2009 at 06:04 AM.

  2. #2
    Join Date
    Oct 2008
    Posts
    28
    Could it be something related to how the object is defined in the HTML?

    Looks like for non-IE browsers, it defines an object within the MediaPlayer1 object.

    Maybe try something like giving that object an id.

    Code:
    <div class='videoDiv' id='showDis'>
    <object classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' ID='MediaPlayer1'>
      <param name='url' value='myvideo.asx' />
      <param name='src' value='myvideo.asx' />
      <param name='showcontrols' value='true' />
      <param name='autostart' value='true' />
      <!--[if !IE]>-->
      <object type='video/x-ms-wmv' data='myvideo.asx' height='400' width='450' ID='MediaPlayer2'>
        <param name='src' value='myvideo.asx' />
        <param name='autostart' value='true' />
        <param name='controller' value='true' />
      </object>
      <!--<![endif]-->
    </object>
    </div>
    
    <input type=button onclick="showCurrentPosition();" value="Show Timeline Position">
    Code:
    function showCurrentPosition(){
    	objPlayer = document.getElementById('MediaPlayer2');
    	alert(objPlayer.controls.currentPosition);
    }

    If that works in FF, then you would just need to add proper javascript to determine which browser is being used.

  3. #3
    Join Date
    Feb 2009
    Posts
    14
    Quote Originally Posted by animalj7 View Post
    Could it be something related to how the object is defined in the HTML?

    Looks like for non-IE browsers, it defines an object within the MediaPlayer1 object.

    Maybe try something like giving that object an id.

    Code:
    <div class='videoDiv' id='showDis'>
    <object classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' ID='MediaPlayer1'>
      <param name='url' value='myvideo.asx' />
      <param name='src' value='myvideo.asx' />
      <param name='showcontrols' value='true' />
      <param name='autostart' value='true' />
      <!--[if !IE]>-->
      <object type='video/x-ms-wmv' data='myvideo.asx' height='400' width='450' ID='MediaPlayer2'>
        <param name='src' value='myvideo.asx' />
        <param name='autostart' value='true' />
        <param name='controller' value='true' />
      </object>
      <!--<![endif]-->
    </object>
    </div>
    
    <input type=button onclick="showCurrentPosition();" value="Show Timeline Position">
    Code:
    function showCurrentPosition(){
    	objPlayer = document.getElementById('MediaPlayer2');
    	alert(objPlayer.controls.currentPosition);
    }

    If that works in FF, then you would just need to add proper javascript to determine which browser is being used.
    that worked thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles