Forums

Use Audio Player in a sidebar widget? (10 posts)

  1. marillawex
    Member
    Posted 2 years ago #

    Hey everyone

    My friend is trying to put the audio players into a text widget in a sidebar, but having no luck. Is there a special trick to this? He's just putting in code like this:

    [audio:http://www.hootnannie.us/wp-content/uploads/2010/02/03-Cluck-Old-Hen_Cripple-Creek-02-10.mp3|titles=Cluck Old Hen/Cripple Creek]

    but it's not working. Is there any way of doing it?

    Thanks.

  2. sgordon
    Member
    Posted 2 years ago #

    If he's putting it in the generic 'text' sidebar widget - it takes HTML - inline code isn't going to work since the widget isn't geared for that (I tried that with WPAudio a couple of weeks ago, but have since decided I didn't need the audio in a sidebar).

    If the current audio plugin isn't working then he might try simply using either an audioplayer widget for the sidebar or getting a player that outputs HTML so that it can be used.

  3. marillawex
    Member
    Posted 2 years ago #

    Hmmm......okay - thanks! Audio Player is working well in the rest of the site - but I'll look for another plugin that has a widget. Thanks for your help!

  4. doryphores
    Member
    Posted 2 years ago #

    You could use the PHP Code widget: http://wordpress.org/extend/plugins/php-code-widget/

    Then insert the PHP code found in my FAQ page: http://wpaudioplayer.com/frequently-asked-questions

    Martin

  5. Mattrogers13
    Member
    Posted 2 years ago #

    I tried your solution as described above and It doesn't seem to be working. I'm most likely doing something wrong, but I'm not sure what.

    Here is the site in question. I'm trying to get a test file to play in the widget with Music as the title.

    http://www.shiphighintransit.com/

    Here is the code I'm using.

    <?php if (function_exists("insert_audio_player")) {insert_audio_player("[audio:http://www.shiphighintransit.com/wordpress2/wp-content/audio/test01.mp3]"); } ?>

    Thanks

  6. Mattrogers13
    Member
    Posted 2 years ago #


  7. mahvin
    Member
    Posted 2 years ago #

    Much easier way to use the same Audio Player in a widget is to download the standalone version and extract "player.swf" and "audio-player.js" to your server, and call up the player.swf using object type:

    <object type="application/x-shockwave-flash" data="http://your server location/player.swf" id="audioplayer1" height="24" width="240">
    <param name="movie" value="http://your server location/player.swf">
    <param name="FlashVars" value="playerID=audioplayer1&soundFile=http://YOUR_URL.mp3">
    <param name="quality" value="high">
    <param name="menu" value="false">
    <param name="wmode" value="transparent">

    Works like a charm for me.

    Check out this website for more details: http://www.macloo.com/examples/audio_player/index.html

  8. imkamalkumar
    Member
    Posted 2 years ago #

  9. Vogelpesto
    Member
    Posted 1 year ago #

    I recommend mahvin's solution. Thanks for that, mahvin.

    I used another method though, by creating a child theme and adding this code to the top of the sidebar.php

    <?php if (function_exists("insert_audio_player")) {
      insert_audio_player("[audio:http://example.org/path/to/audiofile/song.mp3|autostart=yes|loop=yes]");
    } ?>

    Adding |autostart=yes|loop=yes makes the file start when the page is loaded and loops the file.
    The player is loaded in the top of the sidebar and does not act like a widget. The player starts over when the visitor browses to a different page. For me this did the trick.

  10. jstaub1125
    Member
    Posted 1 year ago #

    Hi

    I'm using the "get custom fields" plugin to call an mp3 link from a weekly post into the sidebar.

    the idea is to have a track of the week so I cant use the php to hard code a single mp3 into the sidebar. I want it to dynamically call the link from the weekly post.

    is there some way I can edit the code

    <?php if (function_exists("insert_audio_player")) { insert_audio_player("[audio:http://www.domain.com/path/to/song.mp3]");
    } ?>

    to replace the audio:"URL" with the link in the custom field?

Topic Closed

This topic has been closed to new replies.

About this Topic