Web Analytics Made Easy -
StatCounter Custom Controls for media player - CodingForum

Announcement

Collapse
No announcement yet.

Custom Controls for media player

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Controls for media player

    I have a custom player that I embed windows media files in. I have been using this script for awhile now but only recently added custom controls for volume and I am getting a "object or method not supported" error when I clcik the volume controls. I was hoping someone could help me spot the error in my code. Is this code outdated, or am I using the wrong command for volume? Any help appreciated. Thanks again

    Here is the code (also attached in notepad)
    ----------------------------------------------------------

    In Head of Doc
    ---------------------
    <script language="javascript">
    var bolIsPlaying;
    var intVolumeBarState=4;

    function videoFullScreen()
    {
    objMediaPlayer.DisplaySize=3;
    }

    function videoPlay()
    {
    objMediaPlayer.Play();
    bolIsPlaying = true;
    }

    function videoStop()
    {
    objMediaPlayer.Stop();
    bolIsPlaying = false;
    }

    function videoPause()
    {
    if(bolIsPlaying)
    objMediaPlayer.Pause();
    }

    function videoFastReverse()
    {
    if(bolIsPlaying)
    objMediaPlayer.FastReverse();
    }

    function videoFastForward()
    {
    if(bolIsPlaying)
    objMediaPlayer.FastForward();
    }

    function setVolume(intVolume)
    {
    intVolume=((intVolume-8)*1250);
    objMediaPlayer.Volume=intVolume;
    }

    function videoVolumeIncrease()
    {
    if(bolIsPlaying)
    objMediaPlayer.VolumeIncrease();
    }

    function videoVolumeDecrease()
    {
    if(bolIsPlaying)
    objMediaPlayer.VolumeDecrease();
    }

    function applicationLoad()
    {
    objMediaPlayer.Volume=0 // sets the volume equal to 50% of max volume. The corresponding divs are already set to the correct background colors, which is why volume change is not called here.
    }
    </script>




    Commands on the img buttons
    ------------------------------
    onClick="videoFastReverse()">
    onClick="videoStop()">
    onClick="videoPlay()">
    onClick="videoPause()">
    onClick="videoFastForward()">
    onClick="videoFullScreen()">
    onClick="videoVolumeIncrease(300)">
    onClick="videoVolumeDecrease(300)">
    Attached Files

  • #2
    If these are your commands:
    ______________________________
    onClick="videoVolumeIncrease(300)">
    onClick="videoVolumeDecrease(300)">
    ______________________________

    And these are your methods (Functions):
    _________________________________
    function videoVolumeIncrease()
    {
    if(bolIsPlaying)
    objMediaPlayer.VolumeIncrease();
    }

    function videoVolumeDecrease()
    {
    if(bolIsPlaying)
    objMediaPlayer.VolumeDecrease();
    }
    _________________________________

    Shouldn't you be accepting the values being passed to the methods?

    ...something like this:
    _________________________________
    function videoVolumeIncrease( X )
    {
    if(bolIsPlaying)
    objMediaPlayer.VolumeIncrease( X );
    }

    function videoVolumeDecrease( X )
    {
    if(bolIsPlaying)
    objMediaPlayer.VolumeDecrease( X );
    }
    _________________________________

    Also, depending on whether or not it's autoplay on all files, it might be a good idea to assign "bolIsPlaying" an initial value so that it doesn't reference a variable with a null value.

    **Hope I was helpful**
    L8R
    Difinity


    He who laughs last, didn't get the joke!

    Comment


    • #3
      Thanks alot Difinity. I finally got everything working correctly.

      Comment

      Working...
      X