Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
728 views
in Plugins by

I had a site for audio students to ask thing music/audio related.

I can see youtube videos just writing the URL thanks to Embed v1.7 por NoahY plugin.

I would like to do the same with soundcloud links. Is this possible? Is there a plugin for this? If not can you point me to where can I look so I can play a little with the code? (I have some knowledge of php)

Thanks

Q2A version: 1.6.3
by
edited by
Ok so far I found the $types Array in qa-embed-layer.php and added:

'soundcloud'=>array(
    array(
    'https{0,1}:\/\/w{0,3}\.*soundcloud\.com\/([0-9]+)[^< ]*',
    '<iframe width="100%" height="200px" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=$1&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;visual=true"></iframe>'),

and this in qa-embed-admin

$fields[] = array(
    'label' => 'Enable soundcloud embedding',
    'tags' => 'NAME="embed_enable_soundcloud"',
    'value' => qa_opt('embed_enable_soundcloud'),
    'type' => 'checkbox',
        );   

There's no errors showed, but doesn't work either

1 Answer

+2 votes
by

I implemented this using jquery, put this in your page.js file: 

$(document).ready(function(){
        $('a[href*="soundcloud.com"]').each(function(){
            var $link = $(this);
            $.getJSON('http://soundcloud.com/oembed?format=js&url=' + $link.attr('href') + '&iframe=true&callback=?', function(response){
            $link.replaceWith(response.html);
            });
        });
});

Good luck,
Kai

 

by
Thanks, I ended up doing adding this regex `https{0,1}:\/\/w{0,3}\.*soundcloud\.com\/([^< ]+)[< ]*` in the search and putting a height menu.
...