HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

This plugin is Fixed and works

edited May 2013 in Feedback

I went ahead and fixed this plugin , it now works on 2.1 also. I fixed the js which was all messed up too.

The way this works is you post the link to the mp3 file into the discussion as you would any other link and this makes a small but functional button next to the file so it can be played on the page. It also ads the play button to the attachment thumbnail of the mp3 linked file if you upload the mp3 content to your forum.

you can see it working here

http://www.vrijvlinder.com/forum/discussion/4/embedding-objects#Item_5

just install this version I attached as you would any other plugin and enable in the dashboard.

Tagged:
«13

Comments

  • This still isn't working for me. Is there anything I need to edit? I'm still just getting a regular mp3 link.

  • it is important to change the path to the flash player in the default.php of the plugin

    
    <?php if (!defined('APPLICATION')) exit();
    
    $PluginInfo['PlayMP3Links'] = array(
        'Name' => 'Play MP3 Links',
        'Description' => "Automatically adds a Play button to each link that refers to an mp3 file so you can listen to them right in the page. Thanks to 1 Bit Audio Player: http://1bit.markwheeler.net",
        'Version' => '1.0',
        'Author' => "Rémi Cieplicki",
        'AuthorEmail' => '',
        'AuthorUrl' => '',
    );
    
    class PlayMP3LinksPlugin extends Gdn_Plugin {
    
        public function Base_Render_Before($Sender) {
            $Sender->AddCssFile($this->GetResource('pml.css', FALSE, FALSE));
            $Sender->AddJsFile($this->GetResource('swfobject.js', FALSE, FALSE));
            $Sender->AddJsFile($this->GetResource('1bit.js', FALSE, FALSE));
            $js_insert = '
    
        oneBit = new OneBit("/plugins/PlayMP3Links/1bit.swf");
        oneBit.ready(function() {
            oneBit.specify("playerSize", "25");
            oneBit.apply("a");
        });
    
    ';
            $Sender->Head->AddString($js_insert);
        }
        
        public function Setup() {}
    }
    
    

    notice in the section where there is script ,

    oneBit = new OneBit("/plugins/PlayMP3Links/1bit.swf");

    you need to add or change this part to match your forum set up

    example:

    if your forum is called forum this is what it would have to look like

    oneBit = new OneBit("/forum/plugins/PlayMP3Links/1bit.swf");

    this will be the case with most plugins that have link wraps including links to images.
    If you find that the resource is not being loaded this is the reason.

    I am enclosing a newer version with a css file so the style and position of things can be changed more easily.

  • Also, in your example I can't actually play the files. I don't know if it's a problem on my end, or what. The only way the mp3s will play is if I click the title and it takes me to a new page with the default mp3 player for my browser.

  • edited May 2013

    the way to enter the link is :

    you write the name/ title then select it , you click the cleditor link icon to enter the link to the mp3 then the text you wrote becomes the link and a player will appear after you post the comment or discussion.

    you can also enter the link using html in the html side of the editor

    < a href="link to mp3" > name< /a >

    the point is the file needs to be put into a link it won't just make a link out of

    http://mp3file

    it has to be in a < a> tag to work

    also you need to refresh page to see the changes.

  • edited May 2013

    here is the file I used for the button in case I did not include it, put it in the plugin folder if you use the last version I posted, also if you are using flash block or anything that will block flash you won't see the player.

    ps if you went to look while I was editing then you could well have not seen the player, but I put a few songs up and they work fine, even in 2.1 bugs works good. I actually like it a lot and would not have known it existed had you not brought it up.

    not sure how it works using i.e. likely does not ....

  • imijjimijj New
    edited May 2013

    Yeah, I don't know. I've done all you said and don't have any weird flash blockers running. Tried it multiple browsers too. Cleared the cache both on the browser and the forum. Strange.

  • imijjimijj New
    edited May 2013

    I tried using multiple browsers with your page too and they still wont play when I click the icon. Very strange that it works for you and not me. I don't have any weird addons running my browsers or anything. The youtube embeds work fine.

    Edit: Also, do you put that image file in the PlayMP3Links folder? And is the name supposed to be "metalborder.png"?

  • edited May 2013

    can't explain that, did you check it on safari?

    the other option is embedding the mp3 the old fashion way either by uploading and inserting the file into the post.

    or by using html to embed the mp3 link

    
    
    < embed src='http://www.ockstompingmeteorock.com/all_good_people.mp3' width='250' height='20' allowscriptaccess='always'allowfullscreen='true' type="audio/mpeg" pluginspace="http://www.apple.com/quicktime/download/" loop="false" autostart="false"bgcolor=
    "purple">< /embed >
    
    

    or by using script in your master.php or tpl of your theme to make it pop up in a smaller pop up window. This will work using this plugin because it wraps it in a span with a class so you can target it specifically.

    < script type="text/javascript" > $(document).ready(function() {
          $("span.onebit_mp3 a").popup();
    });
    < /script >
    
  • @imijj said:
    I tried using multiple browsers with your page too and they still wont play when I click the icon. Very strange that it works for you and not me. I don't have any weird addons running my browsers or anything. The youtube embeds work fine.

    It could be that the flash version for the player is older and is not supported by some browsers. That is all I can think of. I will see if using a more modern version helps.

    Edit: Also, do you put that image file in the PlayMP3Links folder? And is the name supposed to be "metalborder.png"?

    Yes and you will need to point the images right just like the flash player but in the css file.

    you can change the name of the picture to anything you want just make sure you also change it in the links to it in the css file.

  • edited May 2013

    I loaded a song here different forum maybe it works there for you?

    http://www.fumamx.org/foro/activity

    It works for me on safari, firefox chrome, opera, on the mac, maybe my forum is messed up , or you need to install the shockwave flash plugin

    http://get.adobe.com/shockwave/

    EDIT: about my forum, the css size for the player was too small for firefox so it was hiding behind button in firefox.
    I change the size in the css. it should work for all now in that forum.

    span embed {
    -webkit-border-image: url(images/metalborder.png) 105 105 105 105!important;
    -o-border-image: url(images/metalborder.png) 105 105 105 105!important;
    border-image: url(images/metalborder.png) 105 105 105 105!important;
    -moz-border-image: url(images/metalborder.png) 105 105 105 105!important;
    width: 65px!important;
    height:65px!important;
    z-index:100;
    }
    
  • imijjimijj New
    edited May 2013

    I redownloaded and installed flash and shockwave player and now both your forums work, but mine is still just posting a link

  • My only guess is that it's taking a while for it to update on my server for some reason.

  • please link me and I will take a look ? also take note on the changes I made to the css that could be an issue on other browsers . make sure the size is at least 50px or experiment with what works best.

  • http://forum.elessdee.com/discussion/16/mp3

    Also, I don't have safari. Is that even available on windows? I'm in Windows 7.

  • yes it is available for windows however that is not your problem, it looks as though you have not enabled the plugin, please check in the dashboard to see if it is enabled.

    I know this because I don't see any of the files pertaining to the plugin in firebug web inspector.

  • It's enabled.

    That's why I think it just hasn't updated on the server for some reason.

  • edited May 2013

    ok I believe you lol it happens though one might disable and forget to re enable.
    You can try to remove the files inside the cache folder they are called ini files and they sometimes need to be dumped after modifying and installing plugins. You can try to disable and re enable. Else wait and see if it's your server.
    I will keep an eye on it see if it appears later on

    Oh I see you are using page speed, try disabling that and see if it works without it. It has a way of hiding scripts. Also minify don't use it, it hurts more than helps .

  • Yeah, I don't use minify. It's just still on there for some reason. I disabled page speed and cleared the cache, but I don't think it did anything. I think I'll just wait and see what it looks like tomorrow. Thanks for the help.

  • edited May 2013

    I see the files now, but you need to change the path of some things, do you have your forum installed in the root?

    if so you must change this because this part is what calls the flash player and that is why you can't see it wrapped:

    oneBit = new OneBit("/plugins/PlayMP3Links/1bit.swf");

    to this in the plugin default.php

    oneBit = new OneBit("plugins/PlayMP3Links/1bit.swf");

    so the url to your player is here

    http://forum.elessdee.com/plugins/PlayMP3Links/1bit.swf

    and you must change the size of the player in the css file like I did in the above edit to more than 50px by 50px so it shows in firefox.

    width: 55px!important;
    height:55px!important;

    and also the path to the images for the border image

    change all these that have the path to an image from this

    url(/forum/plugins/PlayMP3Links/images/metalborder.png) 105 105 105 105!important;

    to this

    url(plugins/PlayMP3Links/metalborder.png) 105 105 105 105!important;

    so the image path is here

    http://forum.elessdee.com/plugins/PlayMP3Links/metalborder.png

  • imijjimijj New
    edited May 2013

    I swear i edited that file to http:forum.elessdee.com/etc, but I'll do it again.

    It might be looking at the first version I uploaded, because I just downloaded the file off of the server and it is pointing to the right address. I wonder why it's taking so long to update today.

    Anyway, I will change the other stuff you mentioned.

    EDIT: Actually maybe I didn't do it right. I was just using the entire url "http://forums.elesdde.com/... instead of the plugins/... address

Sign In or Register to comment.