Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Embedded music + selection

    hi,

    I want to embed a windows media player object into the HTML window and show only the controls to playback music.. Below this i want a list of links to different music tracks.

    Now when the user clicks on a track it starts playing in the embedded control.

    How can this be done is there a tutorial or template i could use?

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by 3dkingpin View Post
    hi,

    I want to embed a windows media player object into the HTML window and show only the controls to playback music.. Below this i want a list of links to different music tracks.

    Now when the user clicks on a track it starts playing in the embedded control.

    How can this be done is there a tutorial or template i could use?
    I don't readily know of any tutorial or template, but if you know how to embed a windows media player (do a google search and you should find ample examples) all you need to do is add a javascript function to change the source of the media in the player. So assuming your HTML was something like this:
    Code:
    <object id="media_player1" height="62" width="250" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6">
    ...
    </object>
    <h2>Track List:</h2>
    <ul>
      <li><a href="/music/track1.mp3" onclick="switch_track();">Track 1</a></li>
      <li><a href="/music/track2.mp3" onclick="switch_track();">Track 2</a></li>
      <li><a href="/music/track3.mp3" onclick="switch_track();">Track 3</a></li>
    </ul>
    Something generally like this:
    Code:
    function switch_track(){
    document.getElementById("media_player1").url=this.href;
    }
    I haven't tested any of the code but this should be a fair approximation of what you want. Once you have the basic embedding finished post back if the script doesn't work.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting


  •  

    Posting Permissions

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